60 lines
1.1 KiB
C++
60 lines
1.1 KiB
C++
/* -----------------------------------------------------------------------------
|
|
GSFramework
|
|
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
|
----------------------------------------------------------------------------- */
|
|
|
|
|
|
#ifndef __INPUT_TOUCH__
|
|
#define __INPUT_TOUCH__
|
|
|
|
|
|
#include "input/input_device.h"
|
|
|
|
|
|
namespace GS {
|
|
namespace Input {
|
|
|
|
/*
|
|
@short Touch input device.
|
|
@author Emmanuel Julien (ejulien@nworks.fr)
|
|
*/
|
|
class TouchDevice : public Device
|
|
{
|
|
protected:
|
|
|
|
struct State
|
|
{
|
|
float x, y;
|
|
bool button;
|
|
};
|
|
|
|
int index;
|
|
State state, last_state, pending_state;
|
|
|
|
public:
|
|
|
|
virtual Type GetType() const;
|
|
virtual const char *GetName() const;
|
|
|
|
virtual void Update();
|
|
|
|
virtual bool IsDown(KeyCode) const;
|
|
virtual bool WasDown(KeyCode) const;
|
|
|
|
virtual bool GetInputRange(InputCode, float &min, float &max) const;
|
|
|
|
virtual float GetValue(InputCode) const;
|
|
virtual float GetLastValue(InputCode) const;
|
|
|
|
void SetIndex(int);
|
|
void RegisterTouchEvent(float x, float y, float weight);
|
|
|
|
TouchDevice(int index = -1);
|
|
};
|
|
|
|
} // Input
|
|
} // GS
|
|
|
|
|
|
#endif // __INPUT_TOUCH__
|