File tree Expand file tree Collapse file tree 7 files changed +63
-10
lines changed
utilities/peripheral/keyboard Expand file tree Collapse file tree 7 files changed +63
-10
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ enum_cpp(
14
14
"save" ,
15
15
"load" ,
16
16
"build" ,
17
+ "delete" ,
18
+ "undo" ,
17
19
"none" ,
18
20
],
19
21
)
Original file line number Diff line number Diff line change 21
21
if ((state.keyboard.ctrl == Key_State::DOWN || state.keyboard.ctrl == Key_State::PRESSED) && state.keyboard.b == Key_State::PRESSED){
22
22
return Global_Action::BUILD;
23
23
}
24
+ if ((state.keyboard.ctrl == Key_State::DOWN || state.keyboard.ctrl == Key_State::PRESSED) && state.keyboard.d == Key_State::PRESSED){
25
+ return Global_Action::DELETE;
26
+ }
27
+ if ((state.keyboard.ctrl == Key_State::DOWN || state.keyboard.ctrl == Key_State::PRESSED) && state.keyboard.z == Key_State::PRESSED){
28
+ return Global_Action::UNDO;
29
+ }
24
30
25
31
return Global_Action::NONE;
26
32
❱
Original file line number Diff line number Diff line change 59
59
else if (action == Global_Action::BUILD){
60
60
Build(settings,window);
61
61
}
62
+ else if (action == Global_Action::DELETE){
63
+ Delete(settings,window);
64
+ }
65
+ else if (action == Global_Action::UNDO){
66
+ Undo(settings,window);
67
+ }
62
68
else if (action == Global_Action::QUIT){
63
69
Exit(settings,window);
64
70
}
88
94
◀private: static▶ void ☀Build(Ide_Settings & settings, SDL_Window* window)❰
89
95
auto code = State_To_Code_Converter::Convert(settings.elements);
90
96
❱
91
-
97
+ ◀private: static▶ void ☀Delete(Ide_Settings & settings, SDL_Window* window)❰
98
+ //TODO
99
+ ❱
100
+ ◀private: static▶ void ☀Undo(Ide_Settings & settings, SDL_Window* window)❰
101
+ //TODO
102
+ ❱
92
103
◀private: static▶ void ☀Load_Unilang_File(Ide_Settings & settings, SDL_Window* window)❰
93
104
Save_State_Serializer::Load(settings);
94
105
❱
Original file line number Diff line number Diff line change 5
5
◀
6
6
public:
7
7
8
+ // The order is important because the information is serliazed and deserialized.
9
+ // If you change the order, then an old save file will have issues deserializing.
8
10
std::variant<
9
11
10
- // Basic Shape
11
- Positioned_Rectangle_Settings,
12
+ // GUI Tree Builders
13
+ Positioned_Buildable_Face_Tree,
14
+ Positioned_Buildable_Schema_Faced_Tree,
12
15
13
16
// Images
14
17
Positioned_Image_Data,
15
18
Positioned_Animated_Image_Data,
16
19
17
- // Text-like boxes
18
- Positioned_Label,
19
- Positioned_Faced_Label,
20
-
21
20
// GUI Menu
22
21
Positioned_Select_Menu,
23
22
24
- // GUI Tree Builders
25
- Positioned_Buildable_Face_Tree,
26
- Positioned_Buildable_Schema_Faced_Tree
23
+ // Basic Shape
24
+ Positioned_Rectangle_Settings,
25
+
26
+ // Text-like boxes
27
+ Positioned_Label,
28
+ Positioned_Faced_Label
29
+
27
30
> ፠element፠;
28
31
▶
Original file line number Diff line number Diff line change @@ -345,6 +345,33 @@ class
345
345
return Key_State::NONE;
346
346
❱
347
347
348
+ //D Button
349
+ ◀public: static▶ bool ☀D_Down()❰
350
+ return ImGui::IsKeyDown(static_cast<ImGuiKey>(7));
351
+ ❱
352
+ ◀public: static▶ bool ☀D_Pressed()❰
353
+ return ImGui::IsKeyPressed(static_cast<ImGuiKey>(7),true);
354
+ ❱
355
+ ◀public: static▶ Key_State ☀Get_D_State()❰
356
+
357
+ if (D_Pressed()){ return Key_State::PRESSED; }
358
+ if (D_Down()){ return Key_State::DOWN; }
359
+ return Key_State::NONE;
360
+ ❱
361
+ //Z Button
362
+ ◀public: static▶ bool ☀Z_Down()❰
363
+ return ImGui::IsKeyDown(static_cast<ImGuiKey>(29));
364
+ ❱
365
+ ◀public: static▶ bool ☀Z_Pressed()❰
366
+ return ImGui::IsKeyPressed(static_cast<ImGuiKey>(29),true);
367
+ ❱
368
+ ◀public: static▶ Key_State ☀Get_Z_State()❰
369
+
370
+ if (Z_Pressed()){ return Key_State::PRESSED; }
371
+ if (Z_Down()){ return Key_State::DOWN; }
372
+ return Key_State::NONE;
373
+ ❱
374
+
348
375
//B Button
349
376
◀public: static▶ bool ☀B_Down()❰
350
377
return ImGui::IsKeyDown(static_cast<ImGuiKey>(5));
Original file line number Diff line number Diff line change 37
37
x.v = Key_Detector::Get_V_State();
38
38
x.s = Key_Detector::Get_S_State();
39
39
x.l = Key_Detector::Get_L_State();
40
+ x.d = Key_Detector::Get_D_State();
41
+ x.z = Key_Detector::Get_Z_State();
40
42
41
43
x.left = Key_Detector::Get_Left_Key_State();
42
44
x.right = Key_Detector::Get_Right_Key_State();
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ public:
34
34
Key_State v = Key_State::NONE;
35
35
Key_State s = Key_State::NONE;
36
36
Key_State l = Key_State::NONE;
37
+ Key_State d = Key_State::NONE;
38
+ Key_State z = Key_State::NONE;
37
39
38
40
Key_State left = Key_State::NONE;
39
41
Key_State right = Key_State::NONE;
You can’t perform that action at this time.
0 commit comments