mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 02:40:00 +01:00
First working implementation of Inputs Mapping
Management of inputs in Control, Management of callbacks creator per input in Source, Saving and Loading in Session, Unified renaming of SourceCallbacks, User interface window for creating and editing input mapping from Keyboard and Numerical keypad, with appropriate Settings.
This commit is contained in:
21
Source.h
21
Source.h
@@ -147,10 +147,12 @@ public:
|
||||
|
||||
// add callback to each update
|
||||
void call(SourceCallback *callback, bool override = false);
|
||||
void setKeyCallback(int key, SourceCallback *callback);
|
||||
SourceCallback *keyCallback(int key);
|
||||
std::vector<int> callbackKeys();
|
||||
void updateCallbacks(bool *keys_status);
|
||||
|
||||
// callbacks associated to keys
|
||||
void addInputCallback(uint input, SourceCallback *callback);
|
||||
void removeInputCallback(SourceCallback *callback);
|
||||
std::list<SourceCallback *> inputCallbacks(uint input);
|
||||
std::list<uint> callbackInputs();
|
||||
|
||||
// update mode
|
||||
inline bool active () const { return active_; }
|
||||
@@ -321,17 +323,18 @@ protected:
|
||||
// callbacks
|
||||
std::list<SourceCallback *> update_callbacks_;
|
||||
std::mutex access_callbacks_;
|
||||
struct CallbackListener {
|
||||
bool was_pressed_;
|
||||
struct InputCallback {
|
||||
bool active_;
|
||||
SourceCallback *model_;
|
||||
SourceCallback *reverse_;
|
||||
CallbackListener() {
|
||||
was_pressed_ = false;
|
||||
InputCallback() {
|
||||
active_ = false;
|
||||
model_ = nullptr;
|
||||
reverse_ = nullptr;
|
||||
}
|
||||
};
|
||||
std::map<int, CallbackListener> key_callbacks_;
|
||||
std::multimap<uint, InputCallback> input_callbacks_;
|
||||
void updateCallbacks(float dt);
|
||||
|
||||
// clones
|
||||
CloneList clones_;
|
||||
|
||||
Reference in New Issue
Block a user