update doc/*/scripting/user-input.md
This commit is contained in:
parent
47c6c98b4a
commit
839211a310
@ -66,6 +66,18 @@ input.get_binding_text(bindname: str) -> str
|
||||
|
||||
Returns text representation of button by binding name.
|
||||
|
||||
```python
|
||||
input.is_active(bindname: str) -> bool
|
||||
```
|
||||
|
||||
Checks if the binding is active.
|
||||
|
||||
```python
|
||||
input.set_enabled(bindname: str, flag: bool)
|
||||
```
|
||||
|
||||
Enables/disables binding until leaving the world.
|
||||
|
||||
```python
|
||||
input.is_pressed(code: str) -> bool
|
||||
```
|
||||
|
||||
@ -70,6 +70,12 @@ input.is_active(bindname: str) -> bool
|
||||
|
||||
Проверяет активность привязки.
|
||||
|
||||
```python
|
||||
input.set_enabled(bindname: str, flag: bool)
|
||||
```
|
||||
|
||||
Включает/выключает привязку до выхода из мира.
|
||||
|
||||
```python
|
||||
input.is_pressed(code: str) -> bool
|
||||
```
|
||||
|
||||
@ -403,6 +403,9 @@ double Engine::getDelta() const {
|
||||
}
|
||||
|
||||
void Engine::setScreen(std::shared_ptr<Screen> screen) {
|
||||
// unblock all bindings
|
||||
Events::enableBindings();
|
||||
// reset audio channels (stop all sources)
|
||||
audio::reset_channel(audio::get_channel_index("regular"));
|
||||
audio::reset_channel(audio::get_channel_index("ambient"));
|
||||
this->screen = std::move(screen);
|
||||
|
||||
@ -60,8 +60,6 @@ static int l_close_world(lua::State* L) {
|
||||
if (save_world) {
|
||||
controller->saveWorld();
|
||||
}
|
||||
// unblock all bindings
|
||||
Events::enableBindings();
|
||||
// destroy LevelScreen and run quit callbacks
|
||||
engine->setScreen(nullptr);
|
||||
// create and go to menu screen
|
||||
|
||||
@ -133,7 +133,7 @@ static int l_reset_bindings(lua::State*) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_enable_binding(lua::State* L) {
|
||||
static int l_set_enabled(lua::State* L) {
|
||||
std::string bindname = lua::require_string(L, 1);
|
||||
bool enable = lua::toboolean(L, 2);
|
||||
const auto& bind = Events::bindings.find(bindname);
|
||||
@ -154,5 +154,5 @@ const luaL_Reg inputlib[] = {
|
||||
{"is_active", lua::wrap<l_is_active>},
|
||||
{"is_pressed", lua::wrap<l_is_pressed>},
|
||||
{"reset_bindings", lua::wrap<l_reset_bindings>},
|
||||
{"enable_binding", lua::wrap<l_enable_binding>},
|
||||
{"set_enabled", lua::wrap<l_set_enabled>},
|
||||
{NULL, NULL}};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user