bindings, controls.json file
This commit is contained in:
@@ -3,8 +3,32 @@
|
||||
|
||||
#include "Window.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
class Events {
|
||||
public:
|
||||
static bool* _keys;
|
||||
@@ -18,6 +42,7 @@ public:
|
||||
static bool _cursor_started;
|
||||
static std::vector<uint> codepoints;
|
||||
static std::vector<int> pressedKeys;
|
||||
static std::unordered_map<std::string, Binding> bindings;
|
||||
|
||||
static int initialize();
|
||||
static void finalize();
|
||||
@@ -30,6 +55,10 @@ public:
|
||||
static bool jclicked(int button);
|
||||
|
||||
static void toggleCursor();
|
||||
|
||||
static void bind(std::string name, inputtype type, int code);
|
||||
static bool active(std::string name);
|
||||
static bool jactive(std::string name);
|
||||
};
|
||||
|
||||
#define _MOUSE_BUTTONS 1024
|
||||
|
||||
Reference in New Issue
Block a user