diff --git a/examples/utils/utils.gui b/examples/utils/utils.gui index 8efcb46..cef07db 100644 --- a/examples/utils/utils.gui +++ b/examples/utils/utils.gui @@ -54,6 +54,33 @@ nodes { parent: "panel" inherit_alpha: true } +nodes { + position { + x: -136.0 + y: 77.0 + } + size { + x: 200.0 + y: 100.0 + } + type: TYPE_TEXT + text: "" + font: "rpg" + id: "input" + pivot: PIVOT_NW + outline { + x: 1.0 + y: 1.0 + z: 1.0 + } + shadow { + x: 1.0 + y: 1.0 + z: 1.0 + } + parent: "panel" + inherit_alpha: true +} nodes { position { x: 71.0 diff --git a/examples/utils/utils.gui_script b/examples/utils/utils.gui_script index 3b84957..5912aec 100644 --- a/examples/utils/utils.gui_script +++ b/examples/utils/utils.gui_script @@ -20,6 +20,17 @@ function init(self) local steam_deck = steam.utils_is_steam_running_on_steam_deck() and "true" or "false" local server_real_time = steam.utils_get_server_real_time() gui.set_text(gui.get_node("info"), TEXT:format(seconds, app_id, steam_deck, server_real_time)) + + steam.set_listener(function(self, e, t) + print("listener event", e) + pprint(t) + if e == "GamepadTextInputDismissed_t" then + local text = t.m_szTextInput + gui.set_text(gui.get_node("input"), text) + elseif e == "FloatingGamepadTextInputDismissed_t" then + gui.set_text(gui.get_node("input"), "Dismissed floating text") + end + end) end function final(self) @@ -36,10 +47,22 @@ function on_input(self, action_id, action) end) rpg.button("floating_text", action_id, action, function() local ok = steam.utils_show_floating_gamepad_text_input(steam.EFloatingGamepadTextInputModeModeSingleLine, 10, 10, 100, 100) - print(ok) + if ok then + gui.set_text(gui.get_node("input"), "Showing floating gamepad text input") + else + gui.set_text(gui.get_node("input"), "Failed to show floating gamepad text input") + end end) rpg.button("gamepad_text", action_id, action, function() local ok = steam.utils_show_gamepad_text_input(steam.EGamepadTextInputModeNormal, steam.EGamepadTextInputLineModeSingleLine, "Some description", "Existing text") - print(ok) + if ok then + gui.set_text(gui.get_node("input"), "Showing gamepad text input") + else + gui.set_text(gui.get_node("input"), "Failed to show gamepad text input") + end end) + + if action_id == hash("text") then + gui.set_text(gui.get_node("input"), action.text) + end end \ No newline at end of file diff --git a/input/game.input_binding b/input/game.input_binding index b4ccf33..615891e 100644 --- a/input/game.input_binding +++ b/input/game.input_binding @@ -2,3 +2,11 @@ mouse_trigger { input: MOUSE_BUTTON_LEFT action: "touch" } +text_trigger { + input: TEXT + action: "text" +} +text_trigger { + input: MARKED_TEXT + action: "marked_text" +}