X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fsmoothcontrol.cpp;h=f32e551d89c682e34e9de5157c83e400a6dd8938;hb=c430f2d7498e9c2daa515ee9aba3a95257e5e999;hp=d45c9536d5e3a5b586f7d28b27e42d8a629d2ecd;hpb=daf317db7a79a4c92880042125814ca942c3a6fa;p=libs%2Fgui.git diff --git a/source/input/smoothcontrol.cpp b/source/input/smoothcontrol.cpp index d45c953..f32e551 100644 --- a/source/input/smoothcontrol.cpp +++ b/source/input/smoothcontrol.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of libmspgbase -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include "smoothcontrol.h" namespace Msp { @@ -40,12 +33,12 @@ SmoothControl::~SmoothControl() void SmoothControl::set_dead_zone(float d) { - dead_zone=d; + dead_zone = d; } void SmoothControl::set_threshold(float t) { - threshold=t; + threshold = t; } void SmoothControl::pair(SmoothControl *ctrl) @@ -55,12 +48,12 @@ void SmoothControl::pair(SmoothControl *ctrl) if(paired_ctrl) { - SmoothControl *old_pair=paired_ctrl; - paired_ctrl=0; + SmoothControl *old_pair = paired_ctrl; + paired_ctrl = 0; old_pair->pair(0); } - paired_ctrl=ctrl; + paired_ctrl = ctrl; if(paired_ctrl) paired_ctrl->pair(this); @@ -80,15 +73,15 @@ void SmoothControl::on_release() void SmoothControl::on_motion(float v, float r) { if(v<-threshold) - value=-1; + value = -1; else if(v>threshold) - value=1; + value = 1; else if(v<-dead_zone) - value=(v+dead_zone)/(threshold-dead_zone); + value = (v+dead_zone)/(threshold-dead_zone); else if(v>dead_zone) - value=(v-dead_zone)/(threshold-dead_zone); + value = (v-dead_zone)/(threshold-dead_zone); else - value=0; + value = 0; signal_motion.emit(value);