Neo  0.5.0
Developer Documentation
InputContext.h
Go to the documentation of this file.
1 //========================================================================
2 // Copyright (c) 2003-2011 Anael Seghezzi <www.maratis3d.com>
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 //
8 // Permission is granted to anyone to use this software for any purpose,
9 // including commercial applications, and to alter it and redistribute it
10 // freely, subject to the following restrictions:
11 //
12 // 1. The origin of this software must not be misrepresented; you must not
13 // claim that you wrote the original software. If you use this software
14 // in a product, an acknowledgment in the product documentation would
15 // be appreciated but is not required.
16 //
17 // 2. Altered source versions must be plainly marked as such, and must not
18 // be misrepresented as being the original software.
19 //
20 // 3. This notice may not be removed or altered from any source
21 // distribution.
22 //
23 //========================================================================
24 
25 
26 #ifndef __INPUT_CONTEXT
27 #define __INPUT_CONTEXT
28 
29 namespace Neo
30 {
31 // multitouch
33 {
39 };
40 
41 
42 class NEO_CORE_EXPORT InputContext
43 {
44 public:
45 
46  virtual ~InputContext(void){}
47 
48  // create inputs
49  virtual void createKey(const char * name) = 0;
50  virtual void createAxis(const char * name, bool flush=false) = 0;
51  virtual void createProperty(const char * name) = 0;
52 
53  // inputs events
54  virtual void downKey(const char * name) = 0;
55  virtual void upKey(const char * name) = 0;
56  virtual void setAxis(const char * name, float axis) = 0;
57  virtual void setProperty(const char * name, int prop) = 0;
58 
59  virtual bool isKeyPressed(const char * name) = 0;
60  virtual bool onKeyDown(const char * name) = 0;
61  virtual bool onKeyUp(const char * name) = 0;
62  virtual float getAxis(const char * name) = 0;
63  virtual int getProperty(const char * name) = 0;
64 
65  // touch events
66  virtual void beginTouch(int touchID, Vector2 touchPoint) = 0;
67  virtual void updateTouch(int touchID, Vector2 touchPoint) = 0;
68  virtual void endTouch(int touchID, Vector2 touchPoint) = 0;
69  virtual void cancelTouch(int touchID, Vector2 touchPoint) = 0;
70 
71  virtual Vector2 getTouchPosition(int touchID) = 0;
72  virtual Vector2 getLastTouchPosition(int touchID) = 0;
73  virtual TOUCH_PHASE getTouchPhase(int touchID) = 0;
74 
75  // flush
76  virtual void flush(void) = 0;
77 
78  virtual void setLastChar(unsigned int c) = 0;
79  virtual unsigned int popLastChar() = 0;
80 };
81 }
82 #endif
Definition: InputContext.h:35
Definition: InputContext.h:42
Definition: InputContext.h:38
virtual ~InputContext(void)
Definition: InputContext.h:46
Definition: InputContext.h:36
Definition: InputContext.h:34
Definition: Vector2.h:31
Definition: InputContext.h:37
TOUCH_PHASE
Definition: InputContext.h:32
Definition: Color.h:29