mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
PagesControl, refactor
This commit is contained in:
parent
41f9c51a27
commit
4ea7bda249
15 changed files with 339 additions and 117 deletions
|
|
@ -66,12 +66,45 @@ namespace keycode {
|
|||
extern int NUM_7;
|
||||
extern int NUM_8;
|
||||
extern int NUM_9;
|
||||
|
||||
extern const char* name(int code);
|
||||
}
|
||||
|
||||
namespace mousecode {
|
||||
extern int BUTTON_1;
|
||||
extern int BUTTON_2;
|
||||
extern int BUTTON_3;
|
||||
|
||||
extern const char* name(int code);
|
||||
}
|
||||
|
||||
enum class inputtype {
|
||||
keyboard,
|
||||
button,
|
||||
};
|
||||
|
||||
struct Binding {
|
||||
inputtype type;
|
||||
int code;
|
||||
bool state = false;
|
||||
bool justChange = false;
|
||||
|
||||
bool active() const {
|
||||
return state;
|
||||
}
|
||||
|
||||
bool jactive() const {
|
||||
return state && justChange;
|
||||
}
|
||||
|
||||
const char* text() const {
|
||||
switch (type) {
|
||||
case inputtype::keyboard: return keycode::name(code);
|
||||
case inputtype::button: return mousecode::name(code);
|
||||
}
|
||||
return "<unknown input type>";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // WINDOW_INPUT_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue