diff --git a/docs/src/includes/_types.md b/docs/src/includes/_types.md index d86cefc32..0ac75217d 100644 --- a/docs/src/includes/_types.md +++ b/docs/src/includes/_types.md @@ -1098,14 +1098,14 @@ Type | Name | Description float | [framerate](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=framerate) | | [wantkeyboard](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=wantkeyboard) | True if anyone else (i.e. some input box, OL hotkey) is already capturing keyboard or reacted to this keypress and you probably shouldn't.
Set this to true every GUIFRAME while you want to capture keyboard and disable UI key bindings and game keys. Won't affect UI or game keys on this frame though, that train has already sailed. Also see [Bucket](#Bucket)::[Overlunky](#Overlunky) for other ways to override key bindings.
Do not set this to false, unless you want the player input to bleed through input fields.
bool | [keys[ImGuiKey_COUNT]](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=keys) | ZeroIndexArray of currently held keys, indexed by [KEY](#KEY) <= 0xFF
- | [keydown](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=keydown) | Returns true if key or chord (e.g `KEY.X | KEY.OL_MOD_CTRL`) is down.
bool keydown(KEY keychord)
bool keydown(char key)
- | [keypressed](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=keypressed) | Returns true if key or chord (e.g `KEY.X | KEY.OL_MOD_CTRL`) was pressed this GUIFRAME.
bool keypressed(KEY keychord, bool repeat = false)
bool keypressed(char key, bool repeat = false)
- | [keyreleased](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=keyreleased) | Returns true if key or chord (e.g `KEY.X | KEY.OL_MOD_CTRL`) was released this GUIFRAME.
bool keyreleased(KEY keychord)
bool keyreleased(char key)
+ | [keydown](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=keydown) | Returns true if key or chord (e.g `KEY.X \| KEY.OL_MOD_CTRL`) is down.
bool keydown(KEY keychord)
bool keydown(char key)
+ | [keypressed](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=keypressed) | Returns true if key or chord (e.g `KEY.X \| KEY.OL_MOD_CTRL`) was pressed this GUIFRAME.
bool keypressed(KEY keychord, bool repeat = false)
bool keypressed(char key, bool repeat = false)
+ | [keyreleased](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=keyreleased) | Returns true if key or chord (e.g `KEY.X \| KEY.OL_MOD_CTRL`) was released this GUIFRAME.
bool keyreleased(KEY keychord)
bool keyreleased(char key)
bool | [keyctrl](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=keyctrl) | bool | [keyshift](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=keyshift) | bool | [keyalt](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=keyalt) | bool | [keysuper](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=keysuper) | - | [modifierdown](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=modifierdown) | bool modifierdown([KEY](#KEY) keychord)
Returns true if modifiers in chord (e.g. `KEY.OL_MOD_CTRL | KEY.OL_MOD_SHIFT | KEY.OL_MOD_ALT`) are down, ignores other keys in chord.
+ | [modifierdown](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=modifierdown) | bool modifierdown([KEY](#KEY) keychord)
Returns true if modifiers in chord (e.g. `KEY.OL_MOD_CTRL \| KEY.OL_MOD_SHIFT \| KEY.OL_MOD_ALT`) are down, ignores other keys in chord.
| [wantmouse](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=wantmouse) | True if anyone else (i.e. hovering some window) is already capturing mouse and you probably shouldn't.
Set this to true if you want to capture mouse and override UI mouse binding.
[Vec2](#Vec2) | [mousepos](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=mousepos) | bool | [mousedown[5]](https://github.com/spelunky-fyi/overlunky/search?l=Lua&q=mousedown) | diff --git a/src/game_api/script/usertypes/gui_lua.cpp b/src/game_api/script/usertypes/gui_lua.cpp index f99409026..81a83aa55 100644 --- a/src/game_api/script/usertypes/gui_lua.cpp +++ b/src/game_api/script/usertypes/gui_lua.cpp @@ -1150,20 +1150,20 @@ void register_usertypes(sol::state& lua) // keys // ZeroIndexArray of currently held keys, indexed by KEY <= 0xFF // keydown - // Returns true if key or chord (e.g `KEY.X | KEY.OL_MOD_CTRL`) is down. + // Returns true if key or chord (e.g `KEY.X \| KEY.OL_MOD_CTRL`) is down. // bool keydown(KEY keychord) // bool keydown(char key) // keypressed - // Returns true if key or chord (e.g `KEY.X | KEY.OL_MOD_CTRL`) was pressed this GUIFRAME. + // Returns true if key or chord (e.g `KEY.X \| KEY.OL_MOD_CTRL`) was pressed this GUIFRAME. // bool keypressed(KEY keychord, bool repeat = false) // bool keypressed(char key, bool repeat = false) // keyreleased - // Returns true if key or chord (e.g `KEY.X | KEY.OL_MOD_CTRL`) was released this GUIFRAME. + // Returns true if key or chord (e.g `KEY.X \| KEY.OL_MOD_CTRL`) was released this GUIFRAME. // bool keyreleased(KEY keychord) // bool keyreleased(char key) // modifierdown // bool modifierdown(KEY keychord) - // Returns true if modifiers in chord (e.g. `KEY.OL_MOD_CTRL | KEY.OL_MOD_SHIFT | KEY.OL_MOD_ALT`) are down, ignores other keys in chord. + // Returns true if modifiers in chord (e.g. `KEY.OL_MOD_CTRL \| KEY.OL_MOD_SHIFT \| KEY.OL_MOD_ALT`) are down, ignores other keys in chord. // gamepads // Gamepad gamepads(int index) // This is the XInput index 1..4, might not be the same as the player slot.