HoverRace  2.0
InputHandler.h
Go to the documentation of this file.
1 
2 // InputHandler.h
3 // Base class for input handlers.
4 //
5 // Copyright (c) 2010 Michael Imamura.
6 //
7 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
8 // you may not use this file except in compliance with the License.
9 //
10 // A copy of the license should have been attached to the package from which
11 // you have taken this file. If you can not find the license you can not use
12 // this file.
13 //
14 //
15 // The author makes no representations about the suitability of
16 // this software for any purpose. It is provided "as is" "AS IS",
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
18 // implied.
19 //
20 // See the License for the specific language governing permissions
21 // and limitations under the License.
22 
23 #pragma once
24 
25 #include <SDL2/SDL_keycode.h>
26 
27 #if defined(_WIN32) && defined(HR_ENGINE_SHARED)
28 # ifdef MR_ENGINE
29 # define MR_DllDeclare __declspec( dllexport )
30 # else
31 # define MR_DllDeclare __declspec( dllimport )
32 # endif
33 #else
34 # define MR_DllDeclare
35 #endif
36 
37 namespace HoverRace {
38 namespace Control {
39 
41 {
42  public:
44  virtual ~InputHandler() { }
45 
46  public:
47  virtual bool KeyPressed(SDL_Keycode kc, unsigned int text) { return true; }
48  virtual bool KeyReleased(SDL_Keycode kc, unsigned int text) { return true; }
49 
50  /*TODO
51  virtual bool MouseMoved(const OIS::MouseState &state) { return true; }
52  virtual bool MousePressed(const OIS::MouseState &state, OIS::MouseButtonID id) { return true; }
53  virtual bool MouseReleased(const OIS::MouseState &state, OIS::MouseButtonID id) { return true; }
54 
55  virtual bool ButtonPressed(const OIS::JoyStickState &state, int button) { return true; }
56  virtual bool ButtonReleased(const OIS::JoyStickState &state, int button) { return true; }
57  virtual bool AxisMoved(const OIS::JoyStickState &state, int axis) { return true; }
58  virtual bool PovMoved(const OIS::JoyStickState &state, int pov) { return true; }
59  */
60 };
61 typedef std::shared_ptr<InputHandler> InputHandlerPtr;
62 
63 } // namespace Control
64 } // namespace HoverRace
65 
66 #undef MR_DllDeclare
std::shared_ptr< InputHandler > InputHandlerPtr
Definition: Controller.h:52
virtual bool KeyPressed(SDL_Keycode kc, unsigned int text)
Definition: InputHandler.h:47
virtual ~InputHandler()
Definition: InputHandler.h:44
#define MR_DllDeclare
Definition: InputHandler.h:34
Definition: InputHandler.h:40
Definition: Announcement.h:24
InputHandler()
Definition: InputHandler.h:43
virtual bool KeyReleased(SDL_Keycode kc, unsigned int text)
Definition: InputHandler.h:48