-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIDekiInput.h
More file actions
92 lines (79 loc) · 2.25 KB
/
Copy pathIDekiInput.h
File metadata and controls
92 lines (79 loc) · 2.25 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#pragma once
#include <stdint.h>
#include <functional>
/**
* @brief Input event types
*/
enum class InputEventType
{
MOUSE_MOVE,
MOUSE_BUTTON_DOWN,
MOUSE_BUTTON_UP,
KEY_DOWN,
KEY_UP,
TOUCH_DOWN,
TOUCH_UP,
TOUCH_MOVE,
APP_QUIT // Application quit request
};
/**
* @brief Input event data structure
*/
struct InputEvent
{
InputEventType type;
int32_t x, y; // Position for mouse/touch events
uint32_t key; // Key code for keyboard events
bool pressed; // Button/key state
uint32_t timestamp; // Event timestamp
};
// Input event callback function type
using InputEventCallback = std::function<void(const InputEvent& event)>;
/**
* @brief Abstract interface for input package operations
*
* This interface defines the contract that input packages must implement
* to work with the Deki engine. It abstracts input initialization,
* event handling, and input device management.
*/
class IDekiInput
{
public:
virtual ~IDekiInput() = default;
/**
* @brief Initialize the platform input system
* @return true if initialization successful, false otherwise
*/
virtual bool Initialize() = 0;
/**
* @brief Shutdown the input system and cleanup resources
*/
virtual void Shutdown() = 0;
/**
* @brief Update input system and process events (called each frame)
*/
virtual void Update() = 0;
/**
* @brief Register a callback for input events
* @param callback Function to call when input events occur
*/
virtual void RegisterEventCallback(const InputEventCallback& callback) = 0;
/**
* @brief Check if the input system is initialized
* @return true if initialized, false otherwise
*/
virtual bool IsInitialized() const = 0;
/**
* @brief Get current mouse/touch position
* @param x Pointer to store X coordinate
* @param y Pointer to store Y coordinate
* @return true if position is valid, false otherwise
*/
virtual bool GetPointerPosition(int32_t* x, int32_t* y) const = 0;
/**
* @brief Check if a key is currently pressed
* @param key Key code to check
* @return true if key is pressed, false otherwise
*/
virtual bool IsKeyPressed(uint32_t key) const = 0;
};