X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fbinarycontrol.h;h=64e4ab17be4ca1698e78c880a164f299d61b89e3;hb=69aaca13ae0949acf12056e390cbd1009a8487b2;hp=44aaef4214b98ddd0153aeb359f52a1e3a94c39e;hpb=999ca92aa9ee10585c0b2094d84364159253982f;p=libs%2Fgui.git diff --git a/source/input/binarycontrol.h b/source/input/binarycontrol.h index 44aaef4..64e4ab1 100644 --- a/source/input/binarycontrol.h +++ b/source/input/binarycontrol.h @@ -1,12 +1,5 @@ -/* $Id$ - -This file is part of libmspgbase -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - -#ifndef MSP_GBASE_BINARYCONTROL_H_ -#define MSP_GBASE_BINARYCONTROL_H_ +#ifndef MSP_INPUT_BINARYCONTROL_H_ +#define MSP_INPUT_BINARYCONTROL_H_ #include "control.h" @@ -15,8 +8,8 @@ namespace Input { /** A control with two possible states. Button state is mapped directly. An axis -is considered to be active when its value is above a threshold (defined by the -input device). +is considered to be active when its value is above a threshold (0.5 by +default). */ class BinaryControl: public Control { @@ -26,11 +19,18 @@ public: private: bool state; + float threshold; public: BinaryControl(); BinaryControl(const ControlSource &); BinaryControl(Device &, ControlSrcType, unsigned); + virtual ~BinaryControl(); + + /** Sets the threshold between states for axis sources. No effect on button + sources */ + void set_threshold(float); + bool get_state() const { return state; } private: