Merge pull request #315 from Sergwest585/main
small ide stuff + search controls
This commit is contained in:
@@ -79,6 +79,7 @@ struct ContentPack {
|
||||
case ContentType::ENTITY: return ContentPack::ENTITIES_FOLDER;
|
||||
case ContentType::GENERATOR: return ContentPack::GENERATORS_FOLDER;
|
||||
case ContentType::NONE: return fs::u8path("");
|
||||
default: return fs::u8path("");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -64,6 +64,20 @@ static int l_get_bindings(lua::State* L) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int l_get_binding_text(lua::State* L) {
|
||||
auto bindname = lua::require_string(L, 1);
|
||||
auto index = Events::bindings.find(bindname);
|
||||
|
||||
if (index == Events::bindings.end()) {
|
||||
throw std::runtime_error("unknown binding " + util::quote(bindname));
|
||||
lua::pushstring(L, "");
|
||||
} else {
|
||||
lua::pushstring(L, index->second.text());
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int l_is_active(lua::State* L) {
|
||||
auto bindname = lua::require_string(L, 1);
|
||||
const auto& bind = Events::bindings.find(bindname);
|
||||
@@ -101,6 +115,7 @@ const luaL_Reg inputlib[] = {
|
||||
{"add_callback", lua::wrap<l_add_callback>},
|
||||
{"get_mouse_pos", lua::wrap<l_get_mouse_pos>},
|
||||
{"get_bindings", lua::wrap<l_get_bindings>},
|
||||
{"get_binding_text", lua::wrap<l_get_binding_text>},
|
||||
{"is_active", lua::wrap<l_is_active>},
|
||||
{"is_pressed", lua::wrap<l_is_pressed>},
|
||||
{NULL, NULL}};
|
||||
|
||||
Reference in New Issue
Block a user