hx3d  1
2D/3D Simple Game Framework
input_handler.hpp
1 /*
2  Input handling.
3  Copyright (C) 2015 Denis BOURGE
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
21 #ifndef HX3D_WINDOW_INPUTHANDLER
22 #define HX3D_WINDOW_INPUTHANDLER
23 
24 #include "hx3d/window/events.hpp"
25 
26 #include <glm/glm.hpp>
27 
28 namespace hx3d {
29 namespace window {
30 
34 class InputHandler {
35 public:
41  virtual void onWindowEvent(WindowEvent::Type type);
42 
49  virtual void onMouseClicked(MouseButtonEvent::Button button, glm::vec2 mousePosition);
50 
57  virtual void onMouseReleased(MouseButtonEvent::Button button, glm::vec2 mousePosition);
58 
65  virtual void onMouseWheel(MouseWheelEvent::Direction direction, glm::vec2 wheelMovement);
66 
73  virtual void onMouseMotion(glm::vec2 mousePosition, glm::vec2 mouseMovement);
74 
81  virtual void onTouchDown(glm::vec2 touchPosition, float touchPressure);
82 
89  virtual void onTouchUp(glm::vec2 touchPosition, float touchPressure);
90 
98  virtual void onTouchMotion(glm::vec2 touchPosition, glm::vec2 touchMovement, float touchPressure);
99 
105  virtual void onKeyPressed(KeyEvent::Key key);
106 
112  virtual void onKeyReleased(KeyEvent::Key key);
113 };
114 
115 } /* window */
116 } /* hx3d */
117 
118 #endif /* HX3D_WINDOW_INPUTHANDLER */
virtual void onMouseWheel(MouseWheelEvent::Direction direction, glm::vec2 wheelMovement)
When a mouse wheel event occur.
virtual void onKeyReleased(KeyEvent::Key key)
When a key is released.
virtual void onMouseReleased(MouseButtonEvent::Button button, glm::vec2 mousePosition)
When a mouse click release event occur.
virtual void onMouseMotion(glm::vec2 mousePosition, glm::vec2 mouseMovement)
When a mouse move event occur.
hx3d framework namespace
Definition: audio.hpp:26
virtual void onKeyPressed(KeyEvent::Key key)
When a key is pressed.
virtual void onMouseClicked(MouseButtonEvent::Button button, glm::vec2 mousePosition)
When a mouse click event occur.
virtual void onTouchUp(glm::vec2 touchPosition, float touchPressure)
When a touch up event occur.
Button
Mouse button value.
Definition: events.hpp:101
Direction
Mouse wheel direction.
Definition: events.hpp:124
virtual void onTouchDown(glm::vec2 touchPosition, float touchPressure)
When a touch down event occur.
Type
Window event type.
Definition: events.hpp:71
virtual void onTouchMotion(glm::vec2 touchPosition, glm::vec2 touchMovement, float touchPressure)
When a touch move event occur.
Input management: use with screens !
virtual void onWindowEvent(WindowEvent::Type type)
When a window event occur.