File: IInputEventHandler.h

package info (click to toggle)
jazz2-native 3.5.0-1
  • links: PTS, VCS
  • area: contrib
  • in suites:
  • size: 16,836 kB
  • sloc: cpp: 172,557; xml: 113; python: 36; makefile: 5; sh: 2
file content (62 lines) | stat: -rw-r--r-- 3,111 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#pragma once

#include "IInputManager.h"

namespace nCine
{
	/// Interface for handling input events from keyboard, screen touches, mouse, accelerometer and joystick
	class IInputEventHandler
	{
	public:
		IInputEventHandler() {
			IInputManager::setHandler(this);
		}
		inline virtual ~IInputEventHandler() { }

		/// Callback function called every time a key is pressed
		inline virtual void OnKeyPressed(const KeyboardEvent& event) { }
		/// Callback function called every time a key is released
		inline virtual void OnKeyReleased(const KeyboardEvent& event) { }
		/// Callback function called every time a text input is generated
		inline virtual void OnTextInput(const TextInputEvent& event) { }

		/// Callback function called every time a touch event is made
		inline virtual void OnTouchEvent(const TouchEvent& event) { }

		/// Callback function called at fixed time with the updated reading from the accelerometer sensor
		inline virtual void OnAcceleration(const AccelerometerEvent& event) { }

		/// Callback function called every time a mouse button is pressed
		inline virtual void OnMouseDown(const MouseEvent& event) { }
		/// Callback function called every time a mouse button is released
		inline virtual void OnMouseUp(const MouseEvent& event) { }
		/// Callback function called every time the mouse is moved
		inline virtual void OnMouseMove(const MouseState& state) { }
		/// Callback function called every time a scroll input occurs (mouse wheel, touchpad gesture, etc.)
		inline virtual void OnMouseWheel(const ScrollEvent& event) { }

		/// Callback function called every time a joystick button is pressed
		inline virtual void OnJoyButtonPressed(const JoyButtonEvent& event) { }
		/// Callback function called every time a joystick button is released
		inline virtual void OnJoyButtonReleased(const JoyButtonEvent& event) { }
		/// Callback function called every time a joystick hat is moved
		inline virtual void OnJoyHatMoved(const JoyHatEvent& event) { }
		/// Callback function called every time a joystick axis is moved
		inline virtual void OnJoyAxisMoved(const JoyAxisEvent& event) { }

		/// Callback function called every time a button of a joystick with mapping is pressed
		inline virtual void OnJoyMappedButtonPressed(const JoyMappedButtonEvent& event) { }
		/// Callback function called every time a button of a joystick with mapping is released
		inline virtual void OnJoyMappedButtonReleased(const JoyMappedButtonEvent& event) { }
		/// Callback function called every time an axis of a joystick with mapping is moved
		inline virtual void OnJoyMappedAxisMoved(const JoyMappedAxisEvent& event) { }

		/// Callback function called every time a joystick is connected
		inline virtual void OnJoyConnected(const JoyConnectionEvent& event) { }
		/// Callback function called every time a joystick is disconnected
		inline virtual void OnJoyDisconnected(const JoyConnectionEvent& event) { }

		/// Callback function called when the system sends a quit event, for example when the user clicks the window close button
		inline virtual bool OnQuitRequest() { return true; }
	};
}