Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDekiInputSystem.h
More file actions
Latest commit
76 lines (64 loc) · 2.53 KB
/
Copy pathDekiInputSystem.h
File metadata and controls
76 lines (64 loc) · 2.53 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
#pragma once
#include<cstdint>
#include"providers/IDekiInputSystem.h"
// Forward declarations
namespaceDeki { classObject; }
structInputEvent;
/**
* @brief Input dispatch system — routes input events to InputCollider components
*
* Concrete implementation of Deki::IInputSystem, lives in the input package DLL.
* Registered on Deki::Engine via SetInputSystem() during package 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.
*/
classDekiInputSystem : publicDeki::IInputSystem
{
public:
DekiInputSystem();
~DekiInputSystem() override;
voidInitialize() override;
voidShutdown() override;
voidDispatchInput(Deki::Scene* scene, float x, float y,
bool down, bool move, bool up) override;
/**
* @brief Inject a key state change from the host (editor play view).
*
* Backed by an "Injected" IDekiInput driver registered on demand, so
* DekiInput::IsKeyPressed() aggregates injected keys exactly like keys
* from a real driver (SDL3 on the desktop simulator).
*/
voidDispatchKey(uint32_t key, bool down) override;
boolIsInitialized() constoverride { return m_Initialized; }
voidUpdate() override;
boolShouldExit() constoverride;
private:
bool m_Initialized = false;
// Camera used for screen->world, found once per scene rather than by a
// full tree walk (through a heap-allocated std::function) on every
// mouse-move event. Reset when the root scene pointer changes.
classCameraComponent* m_CachedCamera = nullptr;
Deki::Scene* m_CachedCameraScene = nullptr;
CameraComponent* FindCamera(Deki::Scene* scene);
/**
* @brief Callback from DekiInput — converts screen→world and dispatches
*/
voidOnInputEvent(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 consumeInput=true handled it)
*/
boolDispatchToObject(Deki::Object* obj, float x, float y,
bool down, bool move, bool up);
};