-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDekiInputSystem.h
More file actions
54 lines (47 loc) · 1.7 KB
/
DekiInputSystem.h
File metadata and controls
54 lines (47 loc) · 1.7 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
#pragma once
#include "providers/IDekiInputSystem.h"
// Forward declarations
class DekiObject;
struct InputEvent;
/**
* @brief Input dispatch system — routes input events to InputCollider components
*
* Concrete implementation of IDekiInputSystem, lives in the input module DLL.
* Registered on DekiEngine via SetInputSystem() during module init.
*
* For embedded runtime: registers as a callback on DekiInput and
* auto-dispatches when input events arrive.
*
* For editor play mode: call DispatchInput() directly from PlayViewPanel.
*
* Coordinates: DispatchInput takes WORLD UNITS (float). Raw device pixels
* coming from InputEvent are converted via Camera::ScreenToWorld in
* OnInputEvent before reaching dispatch.
*/
class DekiInputSystem : public IDekiInputSystem
{
public:
DekiInputSystem();
~DekiInputSystem() override;
void Initialize() override;
void Shutdown() override;
void DispatchInput(Prefab* prefab, float x, float y,
bool down, bool move, bool up) override;
bool IsInitialized() const override { return m_Initialized; }
private:
bool m_Initialized = false;
/**
* @brief Callback from DekiInput — converts screen→world and dispatches
*/
void OnInputEvent(const InputEvent& event);
/**
* @brief Recursively dispatch input to an object and its children
*
* Uses children-first dispatch: deepest child processes first,
* giving inner/frontmost elements priority over parents.
*
* @return true if input was consumed (a collider with consume_input=true handled it)
*/
bool DispatchToObject(DekiObject* obj, float x, float y,
bool down, bool move, bool up);
};