mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-21 18:09:46 +00:00
fix 'mouse:' input prefix is not available
This commit is contained in:
parent
99a62710b8
commit
cf35023adf
6 changed files with 18 additions and 7 deletions
|
|
@ -44,10 +44,13 @@ static int l_add_callback(lua::State* L) {
|
|||
auto& input = engine->getInput();
|
||||
|
||||
if (pos != std::string::npos) {
|
||||
std::string prefix = bindname.substr(0, pos);
|
||||
auto prefix = std::string_view(bindname).substr(0, pos);
|
||||
if (prefix == "key") {
|
||||
auto key = input_util::keycode_from(bindname.substr(pos + 1));
|
||||
handler = input.addKeyCallback(key, actual_callback);
|
||||
} else if (prefix == "mouse") {
|
||||
auto mouse = input_util::mousecode_from(bindname.substr(pos + 1));
|
||||
handler = input.addMouseCallback(mouse, actual_callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ runnable lua::create_runnable(State* L) {
|
|||
};
|
||||
}
|
||||
|
||||
KeyCallback lua::create_simple_handler(State* L) {
|
||||
InputCallback lua::create_simple_handler(State* L) {
|
||||
auto funcptr = create_lambda_handler(L);
|
||||
return [=]() -> bool {
|
||||
if (!get_from_registry(L, LAMBDAS_TABLE, *funcptr, false)) {
|
||||
|
|
|
|||
|
|
@ -665,7 +665,7 @@ namespace lua {
|
|||
}
|
||||
|
||||
runnable create_runnable(lua::State*);
|
||||
KeyCallback create_simple_handler(lua::State*);
|
||||
InputCallback create_simple_handler(lua::State*);
|
||||
scripting::common_func create_lambda(lua::State*);
|
||||
scripting::common_func create_lambda_nothrow(lua::State*);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue