-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontrol.h
118 lines (74 loc) · 2.23 KB
/
control.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#ifndef _CONTROL_
#define _CONTROL_
#pragma once
#include <vector>
#include <string>
#include <SFML/Window.hpp>
#include "window.h"
namespace spl {
class EventInterface {
public:
virtual void moveTop() {} //for player
virtual void moveBottom() {} //for player
virtual void moveLeft() {} //for player
virtual void moveRight() {} //for player
virtual void moveRadiusMinus() {} //for player
virtual void moveRadiusPlus() {} //for player
virtual void haste() {} //for player
virtual void apply() {}
virtual void primaryMouseAction() {} //mouse
virtual void secondaryMouseAction() {} //mouse
virtual void wheelMouse(float delta) {} //mouse
virtual void positionMouse(int x, int y) {} //mouse
virtual void l_ctrl() {}
virtual void l_shift() {}
};
class ControlBox {
private:
/*class Console {
public:
#define cendl '\n'
~Console() {
history.clear();
}
void hide();
void show();
void renderAll();
template<class T>
void render(T &in);
template<class T>
Console &operator<<(T &in);
private:
void clear();
void saveHistory(); //Saving available console history to file "consoleLog.txt"
// void listenCommand();
template <class T>
Console &operator>>(std::string &in);
std::string history;
};*/
struct KeyBindings {
sf::Keyboard::Key moveTop = sf::Keyboard::W;
sf::Keyboard::Key moveBottom = sf::Keyboard::S;
sf::Keyboard::Key moveLeft = sf::Keyboard::A;
sf::Keyboard::Key moveRight = sf::Keyboard::D;
sf::Keyboard::Key haste = sf::Keyboard::LShift;
sf::Keyboard::Key apply = sf::Keyboard::F;
sf::Keyboard::Key console = sf::Keyboard::Tilde;
sf::Keyboard::Key l_ctrl = sf::Keyboard::LControl;
sf::Keyboard::Key l_shift = sf::Keyboard::LShift;
sf::Mouse::Button primaryMouseAction = sf::Mouse::Button::Left;
sf::Mouse::Button secondaryMouseAction = sf::Mouse::Button::Right;
} keyBindings;
std::vector<spl::EventInterface*> controlObjects;
sf::Event event;
public:
//static Console *console;
ControlBox();
void updateKeyBindings();
void saveKeyBindings();
bool deleteControlObject(spl::EventInterface*);
void setControlObject(spl::EventInterface*);
void resulveControl(spl::Window &window);
};
}
#endif