-
Notifications
You must be signed in to change notification settings - Fork 0
/
uistate.h
103 lines (81 loc) · 2.59 KB
/
uistate.h
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
93
94
95
96
97
98
99
100
101
102
103
#ifndef UISTATE_H
#define UISTATE_H
#include <memory>
#include "state.h"
#include "robotgame.h"
#include "pge/olcPixelGameEngine.h"
#include "pge/imgui_impl_pge.h"
#include "pge/imgui_stdlib.h"
#include "block.h"
class RobotGame;
namespace UIState
{
class EditIdleState : public IState
{
public:
virtual std::unique_ptr<IState> HandleInput(RobotGame* game);
};
class IOSelectState : public IState
{
public:
Block* target;
ImVec2 mousepos;
IOSelectState(Block* target, ImVec2 mousepos) : target(target), mousepos(mousepos) {}
virtual std::unique_ptr<IState> HandleInput(RobotGame* game);
void OnExit(RobotGame* game);
};
class DraggingState : public IState
{
public:
Block* target;
olc::vi2d startpos;
olc::vi2d handlepos;
DraggingState(Block* target, olc::vi2d startpos, olc::vi2d handlepos) : target(target), startpos(startpos), handlepos(handlepos) {}
virtual std::unique_ptr<IState> HandleInput(RobotGame* game);
};
class LinkingState : public IState
{
public:
Block* target;
IPort* port;
LinkingState(Block* target, IPort* port) : target(target), port(port) {}
virtual std::unique_ptr<IState> HandleInput(RobotGame* game);
virtual void Update(RobotGame* game);
};
class IOSelectSecondState : public IState
{
public:
Block* source;
IPort* sourcePort;
Block* target;
ImVec2 mousepos;
IOSelectSecondState(Block* source, IPort* sourcePort, Block* target, ImVec2 mousepos) : source(source), sourcePort(sourcePort), target(target), mousepos(mousepos) {}
virtual std::unique_ptr<IState> HandleInput(RobotGame* game);
};
class CodeEditState : public IState
{
public:
ProgrammableBlock* target;
CodeEditState(ProgrammableBlock* target) : target(target) {}
virtual std::unique_ptr<IState> HandleInput(RobotGame* game);
};
class BlockPlaceState : public IState
{
public:
std::shared_ptr<Block> target;
BlockPlaceState(std::shared_ptr<Block> target) : target(target) {}
virtual std::unique_ptr<IState> HandleInput(RobotGame* game);
virtual void Update(RobotGame* game);
};
class InteractIdleState : public IState
{
private:
float timeCounter;
public:
virtual std::unique_ptr<IState> HandleInput(RobotGame* game);
virtual void Update(RobotGame* game);
void OnEnter(RobotGame* game);
void OnExit(RobotGame* game);
};
}
#endif // UISTATE_H