mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
feat: key pressed event interception & 'owner' input.add_callback third argument
This commit is contained in:
parent
7fce735ca1
commit
b9ff1db086
17 changed files with 192 additions and 63 deletions
|
|
@ -23,7 +23,7 @@ bool Events::_cursor_locked = false;
|
|||
std::vector<uint> Events::codepoints;
|
||||
std::vector<keycode> Events::pressedKeys;
|
||||
std::unordered_map<std::string, Binding> Events::bindings;
|
||||
std::unordered_map<keycode, util::RunnablesList> Events::keyCallbacks;
|
||||
std::unordered_map<keycode, util::HandlersList<>> Events::keyCallbacks;
|
||||
|
||||
bool Events::pressed(keycode keycode) {
|
||||
return pressed(static_cast<int>(keycode));
|
||||
|
|
@ -180,7 +180,7 @@ void Events::setPosition(float xpos, float ypos) {
|
|||
Events::cursor.y = ypos;
|
||||
}
|
||||
|
||||
observer_handler Events::addKeyCallback(keycode key, runnable callback) {
|
||||
observer_handler Events::addKeyCallback(keycode key, KeyCallback callback) {
|
||||
return keyCallbacks[key].add(std::move(callback));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue