From cd1d67a4da73f928bc832c4a5d2719fc42e8656e Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Wed, 21 Aug 2024 19:49:40 -0400 Subject: [PATCH 01/14] Update utils.cpp --- src/utils.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/utils.cpp b/src/utils.cpp index 4d47a32..cd70c86 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -10,6 +10,19 @@ EXTERN int luasteam_getAppID(lua_State *L) { return 1; } + + +// bool GetEnteredGamepadTextInput( char *pchText, uint32 cchText ); +EXTERN bool luasteam_getEnteredGamepadTextInput(lua_State *L) { + char pchText[1024]; + SteamApps()->GetEnteredGamepadTextInput(pchText, 1024); + lua_pushstring(L, pchText); + return 1; +} + + + + namespace luasteam { void add_utils(lua_State *L) { From 8a6bb3c7da7d295c21416c23aa7eb3308e77ca5a Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Wed, 21 Aug 2024 23:09:13 -0400 Subject: [PATCH 02/14] Update utils.cpp --- src/utils.cpp | 87 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 4 deletions(-) diff --git a/src/utils.cpp b/src/utils.cpp index cd70c86..3dacab8 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -4,6 +4,58 @@ // ======= SteamUtils ======= // ========================== + +using luasteam::CallResultListener; + +namespace { + +class CallbackListener; +CallbackListener *callback_listener = nullptr; +int userStats_ref = LUA_NOREF; + +//const char *sort_methods[] = {"Ascending", "Descending", nullptr}; +//const char *display_types[] = {"Numeric", "TimeSeconds", "TimeMilliSeconds", nullptr}; + + +class CallbackListener { + private: + STEAM_CALLBACK(CallbackListener, OnGamepadTextInputDismissed, GamepadTextInputDismissed_t); +}; + +void CallbackListener::OnGamepadTextInputDismissed(GamepadTextInputDismissed_t *data) { + if (data == nullptr) { + return; + } + lua_State *L = luasteam::global_lua_state; + if (!lua_checkstack(L, 4)) { + return; + } + lua_rawgeti(L, LUA_REGISTRYINDEX, userStats_ref); + lua_getfield(L, -1, "onGamepadTextInputDismissed"); + if (lua_isnil(L, -1)) { + lua_pop(L, 2); + } else { + + + lua_createtable(L, 0, 2); + + lua_pushboolean(L, data->m_bSubmitted); + lua_setfield(L, -2, "submitted"); + lua_pushnumber(L, data->m_unSubmittedText); + lua_setfield(L, -2, "submittedText");//len in bytes + lua_call(L, 1, 0); + lua_pop(L, 1); + + } +} + +} // namespace + + + + + + // uint32 GetAppID(); EXTERN int luasteam_getAppID(lua_State *L) { lua_pushnumber(L, SteamUtils()->GetAppID()); @@ -15,24 +67,51 @@ EXTERN int luasteam_getAppID(lua_State *L) { // bool GetEnteredGamepadTextInput( char *pchText, uint32 cchText ); EXTERN bool luasteam_getEnteredGamepadTextInput(lua_State *L) { char pchText[1024]; - SteamApps()->GetEnteredGamepadTextInput(pchText, 1024); + SteamUtils()->GetEnteredGamepadTextInput(pchText, 1024); lua_pushstring(L, pchText); return 1; } +// uint32 GetEnteredGamepadTextLength(); +EXTERN int luasteam_getEnteredGamepadTextLength(lua_State *L) { + lua_pushnumber(L, SteamUtils()->GetEnteredGamepadTextLength()); + return 1; +} +//SIMPLE AND O-O-O (0,0,cc,int,cc) +//bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText ); + //int sort_method = luaL_checkoption(L, 2, nullptr, sort_methods) + 1; + //int display_type = luaL_checkoption(L, 3, nullptr, display_types) + 1; +EXTERN int luasteam_showGamepadTextInput(lua_State *L) { + char pchDescription[1024]; + const char *url = luaL_checkstring(L, 1);//O-O-O! + SteamUtils()->ShowGamepadTextInput(url,0,0,pchDescription, 1024); + return 1; +} namespace luasteam { void add_utils(lua_State *L) { - lua_createtable(L, 0, 1); + lua_createtable(L, 0, 4); add_func(L, "getAppID", luasteam_getAppID); + add_func(L, "GetEnteredGamepadTextInput", luasteam_getEnteredGamepadTextInput); + add_func(L, "GetEnteredGamepadTextLength", luasteam_getEnteredGamepadTextLength); + add_func(L, "ShowGamepadTextInput", luasteam_showGamepadTextInput); + lua_pushvalue(L, -1); + + utils_ref = luaL_ref(L, LUA_REGISTRYINDEX); lua_setfield(L, -2, "utils"); } -void init_utils(lua_State *L) {} +void init_utils(lua_State *L) { callback_listener = new CallbackListener(); } + +void shutdown_utils(lua_State *L) { + luaL_unref(L, LUA_REGISTRYINDEX, utils_ref); + utils_ref = LUA_NOREF; + delete callback_listener; + callback_listener = nullptr; +} -void shutdown_utils(lua_State *L) {} } // namespace luasteam From de70a64d47d1b9ffadbd3e2ff0c4565a52c5c475 Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Wed, 4 Sep 2024 00:46:21 -0400 Subject: [PATCH 03/14] Update utils.cpp no errors; untested --- src/utils.cpp | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/src/utils.cpp b/src/utils.cpp index 3dacab8..450413c 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -4,18 +4,16 @@ // ======= SteamUtils ======= // ========================== - using luasteam::CallResultListener; namespace { class CallbackListener; CallbackListener *callback_listener = nullptr; -int userStats_ref = LUA_NOREF; - -//const char *sort_methods[] = {"Ascending", "Descending", nullptr}; -//const char *display_types[] = {"Numeric", "TimeSeconds", "TimeMilliSeconds", nullptr}; +int utils_ref = LUA_NOREF; +const char *InputModes[] = {"Normal", "Password", nullptr}; +const char *InputLineModes[] = {"SingleLine", "MultipleLines", nullptr}; class CallbackListener { private: @@ -23,14 +21,14 @@ class CallbackListener { }; void CallbackListener::OnGamepadTextInputDismissed(GamepadTextInputDismissed_t *data) { - if (data == nullptr) { + if (data == nullptr || !data->m_bSubmitted) { // The user cancelled return; } lua_State *L = luasteam::global_lua_state; if (!lua_checkstack(L, 4)) { return; } - lua_rawgeti(L, LUA_REGISTRYINDEX, userStats_ref); + lua_rawgeti(L, LUA_REGISTRYINDEX, utils_ref); lua_getfield(L, -1, "onGamepadTextInputDismissed"); if (lua_isnil(L, -1)) { lua_pop(L, 2); @@ -51,21 +49,14 @@ void CallbackListener::OnGamepadTextInputDismissed(GamepadTextInputDismissed_t * } // namespace - - - - - // uint32 GetAppID(); EXTERN int luasteam_getAppID(lua_State *L) { lua_pushnumber(L, SteamUtils()->GetAppID()); return 1; } - - // bool GetEnteredGamepadTextInput( char *pchText, uint32 cchText ); -EXTERN bool luasteam_getEnteredGamepadTextInput(lua_State *L) { +EXTERN int luasteam_getEnteredGamepadTextInput(lua_State *L) { char pchText[1024]; SteamUtils()->GetEnteredGamepadTextInput(pchText, 1024); lua_pushstring(L, pchText); @@ -78,18 +69,18 @@ EXTERN int luasteam_getEnteredGamepadTextLength(lua_State *L) { return 1; } -//SIMPLE AND O-O-O (0,0,cc,int,cc) //bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText ); - //int sort_method = luaL_checkoption(L, 2, nullptr, sort_methods) + 1; - //int display_type = luaL_checkoption(L, 3, nullptr, display_types) + 1; EXTERN int luasteam_showGamepadTextInput(lua_State *L) { - char pchDescription[1024]; - const char *url = luaL_checkstring(L, 1);//O-O-O! - SteamUtils()->ShowGamepadTextInput(url,0,0,pchDescription, 1024); + + int InputMode = luaL_checkoption(L, 1, nullptr, InputModes) + 1; + int InputLineMode = luaL_checkoption(L, 2, nullptr, InputLineModes) + 1; + //char pchDescription[1024]; + const char *pchDescription = luaL_checkstring(L, 3); + const char *pchExistingText = luaL_checkstring(L, 5); + SteamUtils()->ShowGamepadTextInput(static_cast(InputMode), static_cast(InputLineMode), pchDescription, 1024, pchExistingText); return 1; } - namespace luasteam { void add_utils(lua_State *L) { @@ -113,5 +104,4 @@ void shutdown_utils(lua_State *L) { callback_listener = nullptr; } - } // namespace luasteam From 8c2534341296d575cd1cb447c1073483dedfb438 Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Wed, 4 Sep 2024 00:59:37 -0400 Subject: [PATCH 04/14] Update utils.cpp --- src/utils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils.cpp b/src/utils.cpp index 450413c..8339d78 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -86,9 +86,9 @@ namespace luasteam { void add_utils(lua_State *L) { lua_createtable(L, 0, 4); add_func(L, "getAppID", luasteam_getAppID); - add_func(L, "GetEnteredGamepadTextInput", luasteam_getEnteredGamepadTextInput); - add_func(L, "GetEnteredGamepadTextLength", luasteam_getEnteredGamepadTextLength); - add_func(L, "ShowGamepadTextInput", luasteam_showGamepadTextInput); + add_func(L, "getEnteredGamepadTextInput", luasteam_getEnteredGamepadTextInput); + add_func(L, "getEnteredGamepadTextLength", luasteam_getEnteredGamepadTextLength); + add_func(L, "showGamepadTextInput", luasteam_showGamepadTextInput); lua_pushvalue(L, -1); utils_ref = luaL_ref(L, LUA_REGISTRYINDEX); From 5db5ac6424f431d44c03689509f41ca4396580a7 Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Sat, 7 Sep 2024 02:51:48 -0400 Subject: [PATCH 05/14] Update utils.cpp works if you emulate SteamAPI Example --- src/utils.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/utils.cpp b/src/utils.cpp index 8339d78..ccaae89 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -1,4 +1,5 @@ #include "utils.hpp" +#include // ========================== // ======= SteamUtils ======= @@ -12,8 +13,8 @@ class CallbackListener; CallbackListener *callback_listener = nullptr; int utils_ref = LUA_NOREF; -const char *InputModes[] = {"Normal", "Password", nullptr}; -const char *InputLineModes[] = {"SingleLine", "MultipleLines", nullptr}; +const char *input_modes[] = {"Normal", "Password", nullptr}; +const char *input_line_modes[] = {"SingleLine", "MultipleLines", nullptr}; class CallbackListener { private: @@ -21,29 +22,26 @@ class CallbackListener { }; void CallbackListener::OnGamepadTextInputDismissed(GamepadTextInputDismissed_t *data) { - if (data == nullptr || !data->m_bSubmitted) { // The user cancelled + if (data == nullptr) { return; } lua_State *L = luasteam::global_lua_state; if (!lua_checkstack(L, 4)) { return; } + lua_rawgeti(L, LUA_REGISTRYINDEX, utils_ref); lua_getfield(L, -1, "onGamepadTextInputDismissed"); if (lua_isnil(L, -1)) { lua_pop(L, 2); } else { - - lua_createtable(L, 0, 2); - lua_pushboolean(L, data->m_bSubmitted); lua_setfield(L, -2, "submitted"); lua_pushnumber(L, data->m_unSubmittedText); lua_setfield(L, -2, "submittedText");//len in bytes lua_call(L, 1, 0); lua_pop(L, 1); - } } @@ -72,12 +70,12 @@ EXTERN int luasteam_getEnteredGamepadTextLength(lua_State *L) { //bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText ); EXTERN int luasteam_showGamepadTextInput(lua_State *L) { - int InputMode = luaL_checkoption(L, 1, nullptr, InputModes) + 1; - int InputLineMode = luaL_checkoption(L, 2, nullptr, InputLineModes) + 1; + int input_mode = luaL_checkoption(L, 1, nullptr, input_modes); + int input_line_mode = luaL_checkoption(L, 2, nullptr, input_line_modes); //char pchDescription[1024]; const char *pchDescription = luaL_checkstring(L, 3); const char *pchExistingText = luaL_checkstring(L, 5); - SteamUtils()->ShowGamepadTextInput(static_cast(InputMode), static_cast(InputLineMode), pchDescription, 1024, pchExistingText); + lua_pushboolean(L, SteamUtils()->ShowGamepadTextInput(static_cast(input_mode), static_cast(input_line_mode), pchDescription, 1024, pchExistingText)); return 1; } From 3b7630873a01e708d8043ab2d44cd5c0b2a07ae0 Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Thu, 23 Jan 2025 20:17:58 -0500 Subject: [PATCH 06/14] Update utils.cpp Added showGamepadTextInput and its callback. Added showFloatingGamepadTextInput and its callback. Added 4 minor functions. --- src/utils.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/src/utils.cpp b/src/utils.cpp index ccaae89..87686f8 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -1,5 +1,5 @@ #include "utils.hpp" -#include +//#include // ========================== // ======= SteamUtils ======= @@ -15,10 +15,12 @@ int utils_ref = LUA_NOREF; const char *input_modes[] = {"Normal", "Password", nullptr}; const char *input_line_modes[] = {"SingleLine", "MultipleLines", nullptr}; +const char *floating_input_modes[] = {"SingleLine", "MultipleLines", "Email", "Numeric", nullptr}; class CallbackListener { private: STEAM_CALLBACK(CallbackListener, OnGamepadTextInputDismissed, GamepadTextInputDismissed_t); + STEAM_CALLBACK(CallbackListener, OnFloatingGamepadTextInputDismissed, FloatingGamepadTextInputDismissed_t); }; void CallbackListener::OnGamepadTextInputDismissed(GamepadTextInputDismissed_t *data) { @@ -39,7 +41,25 @@ void CallbackListener::OnGamepadTextInputDismissed(GamepadTextInputDismissed_t * lua_pushboolean(L, data->m_bSubmitted); lua_setfield(L, -2, "submitted"); lua_pushnumber(L, data->m_unSubmittedText); - lua_setfield(L, -2, "submittedText");//len in bytes + lua_setfield(L, -2, "submittedText"); // len in bytes + lua_call(L, 1, 0); + lua_pop(L, 1); + } +} + +void CallbackListener::OnFloatingGamepadTextInputDismissed(FloatingGamepadTextInputDismissed_t *data) { + if (data == nullptr) { + return; + } + lua_State *L = luasteam::global_lua_state; + if (!lua_checkstack(L, 4)) { + return; + } + lua_rawgeti(L, LUA_REGISTRYINDEX, utils_ref); + lua_getfield(L, -1, "onFloatingGamepadTextInputDismissed"); + if (lua_isnil(L, -1)) { + lua_pop(L, 2); + } else { lua_call(L, 1, 0); lua_pop(L, 1); } @@ -67,26 +87,52 @@ EXTERN int luasteam_getEnteredGamepadTextLength(lua_State *L) { return 1; } -//bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText ); +//bool IsSteamInBigPictureMode(); +EXTERN int luasteam_isSteamInBigPictureMode(lua_State *L) { + lua_pushboolean(L, SteamUtils()->IsSteamInBigPictureMode()); + return 1; +} + +//bool IsSteamRunningOnSteamDeck(); +EXTERN int luasteam_isSteamRunningOnSteamDeck(lua_State *L) { + lua_pushboolean(L, SteamUtils()->IsSteamRunningOnSteamDeck()); + return 1; +} + +// bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText ); EXTERN int luasteam_showGamepadTextInput(lua_State *L) { int input_mode = luaL_checkoption(L, 1, nullptr, input_modes); int input_line_mode = luaL_checkoption(L, 2, nullptr, input_line_modes); - //char pchDescription[1024]; + // char pchDescription[1024]; const char *pchDescription = luaL_checkstring(L, 3); const char *pchExistingText = luaL_checkstring(L, 5); lua_pushboolean(L, SteamUtils()->ShowGamepadTextInput(static_cast(input_mode), static_cast(input_line_mode), pchDescription, 1024, pchExistingText)); return 1; } +//bool ShowFloatingGamepadTextInput(EFloatingGamepadTextInputMode eKeyboardMode, int nTextFieldXPosition, int nTextFieldYPosition, int nTextFieldWidth, int nTextFieldHeight); +EXTERN int luasteam_showFloatingGamepadTextInput(lua_State *L) { + int floating_input_mode = luaL_checkoption(L, 1, nullptr, floating_input_modes); + int nTextFieldXPosition = luaL_checkint(L, 2); + int nTextFieldYPosition = luaL_checkint(L, 3); + int nTextFieldWidth = luaL_checkint(L, 4); + int nTextFieldHeight = luaL_checkint(L, 5); + lua_pushboolean(L, SteamUtils()->ShowFloatingGamepadTextInput(static_cast(floating_input_mode), nTextFieldXPosition, nTextFieldYPosition, nTextFieldWidth, nTextFieldHeight)); + return 1; +} + namespace luasteam { void add_utils(lua_State *L) { - lua_createtable(L, 0, 4); + lua_createtable(L, 0, 7); add_func(L, "getAppID", luasteam_getAppID); add_func(L, "getEnteredGamepadTextInput", luasteam_getEnteredGamepadTextInput); add_func(L, "getEnteredGamepadTextLength", luasteam_getEnteredGamepadTextLength); + add_func(L, "isSteamInBigPictureMode", luasteam_isSteamInBigPictureMode); + add_func(L, "isSteamRunningOnSteamDeck", luasteam_isSteamRunningOnSteamDeck); add_func(L, "showGamepadTextInput", luasteam_showGamepadTextInput); + add_func(L, "showFloatingGamepadTextInput", luasteam_showFloatingGamepadTextInput); lua_pushvalue(L, -1); utils_ref = luaL_ref(L, LUA_REGISTRYINDEX); From 78bccc1efa59c86371a4c83339772f5fcd153fcf Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Thu, 23 Jan 2025 20:28:30 -0500 Subject: [PATCH 07/14] Update apps.rst 2 typos --- docs/apps.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/apps.rst b/docs/apps.rst index a73008f..e1f19e1 100644 --- a/docs/apps.rst +++ b/docs/apps.rst @@ -7,7 +7,7 @@ List of Functions * :func:`apps.getCurrentGameLanguage` * :func:`apps.isDlcInstalled` -* :func:`apps.getLaunchCommandLineParam` +* :func:`apps.getLaunchCommandLine` List of Callbacks @@ -37,7 +37,7 @@ Function Reference :param number appID: The App ID of the DLC to check. :returns: (`boolean`) true if the user owns the DLC and it's currently installed, otherwise false. - :SteamWorks: `GetCurrentGameLanguage `_ + :SteamWorks: `BIsDlcInstalled `_ Checks if the user owns a specific DLC and if the DLC is installed. From 8e211debed89cc90765ce2e539a59ef32bfa4ab8 Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Fri, 24 Jan 2025 00:56:35 -0500 Subject: [PATCH 08/14] Update utils.rst Added 6 functions and 2 callbacks. --- docs/utils.rst | 109 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 106 insertions(+), 3 deletions(-) diff --git a/docs/utils.rst b/docs/utils.rst index bb0d56e..4da479e 100644 --- a/docs/utils.rst +++ b/docs/utils.rst @@ -6,19 +6,122 @@ List of Functions ----------------- * :func:`utils.getAppID` +* :func:`utils.getEnteredGamepadTextInput` +* :func:`utils.getEnteredGamepadTextLength` +* :func:`utils.isSteamInBigPictureMode` +* :func:`utils.isSteamRunningOnSteamDeck` +* :func:`utils.showGamepadTextInput` +* :func:`utils.showFloatingGamepadTextInput` +List of Callbacks +----------------- + +* :func:`utils.onGamepadTextInputDismissed` +* :func:`utils.onFloatingGamepadTextInputDismissed` Function Reference ------------------ -.. function:: utils.getAppID () +.. function:: utils.getAppID() :returns: (`number`) The AppID. :SteamWorks: `GetAppID `_ - Gets the App ID of the current process. + Gets the App ID of the current process. -**Example**:: + **Example**:: print("My app id is " .. Steam.utils.getAppID()) +.. function:: utils.getEnteredGamepadTextInput(buffer,length) + + :param number buffer: We use 1024 chars. + :param number length: Number returned by getEnteredGamepadTextLength(). + :returns: (`string`) + :SteamWorks: `GetEnteredGamepadTextInput `_ + + Called within onGamepadTextInputDismissed: see that example. + Provides the text input as UTF-8. + +.. function:: utils.getEnteredGamepadTextLength() + + :returns: (`number`) + :SteamWorks: `GetEnteredGamepadTextLength `_ + + Called within onGamepadTextInputDismissed: see that example. + +.. function:: utils.isSteamInBigPictureMode() + + :returns: (`boolean`) + :SteamWorks: `IsSteamInBigPictureMode `_ + +.. function:: utils.isSteamRunningOnSteamDeck() + + :returns: (`boolean`) + :SteamWorks: `IsSteamRunningOnSteamDeck `_ + +.. function:: utils.showGamepadTextInput(input_mode,input_line_mode,description,char_max,existing_text) + + :param string input_mode: Valid options are: "Normal", "Password". + :param string input_line_mode: Valid options are: "SingleLine", "MultipleLines". + :param string description: Sets the description that should inform the user what the input dialog is for. + :param string char_max: We use 1024 chars. + :param string existing_text: Sets the preexisting text which the user can edit. + :returns: (`boolean`) true if the big picture overlay is running; otherwise, false + :SteamWorks: `ShowGamepadTextInput `_ + +.. function:: utils.showFloatingGamepadTextInput(floating_input_mode,TextFieldXPosition,TextFieldYPosition,TextFieldWidth,TextFieldHeight) + + :param string floating_input_mode: Valid options are: "SingleLine", "MultipleLines", "Email", "Numeric". + :param string TextFieldXPosition: X coordinate of text field which shouldn't be obscured by the floating keyboard. + :param string TextFieldYPosition: Y coordinate of text field which shouldn't be obscured by the floating keyboard. + :param string TextFieldWidth: Width of text field which shouldn't be obscured by the floating keyboard. + :param string TextFieldHeight: Height of text field which shouldn't be obscured by the floating keyboard. + :returns: (`boolean`) true if the floating keyboard was shown, otherwise, false + :SteamWorks: `ShowFloatingGamepadTextInput `_ + +Callbacks Reference +------------------- + +.. warning:: + + Remember callbacks are functions that you should override in order to receive the events, and not call directly. + + Also, you **must** constantly call ``Steam.runCallbacks()`` (preferably in your game loop) in order for your callbacks to be called. + +.. function:: utils.OnGamepadTextInputDismissed(data) + + :param table data: A table similar to `GamepadTextInputDismissed_t `_ + + * **data.submitted** (`boolean`) -- true if user entered & accepted text (Call utils.getEnteredGamepadTextInput to receive the text), false if input was canceled. + * **data.submittedText** (`number`) -- Contains the length in bytes if there was text submitted. + :returns: nothing + :SteamWorks: `GamepadTextInputDismissed_t `_ + + Called when the big picture gamepad text input has been closed. + +**Example**:: + +function Steam.utils.onGamepadTextInputDismissed(data) + if not data.submitted then return end-- The user canceled + local length = Steam.utils.getEnteredGamepadTextLength(); + local newstring = Steam.utils.getEnteredGamepadTextInput(1024, length); + -- Use the newstring made by the user. +end + +.. function:: utils.OnFloatingGamepadTextInputDismissed() + + :returns: nothing + :SteamWorks: `FloatingGamepadTextInputDismissed_t `_ + + Called when the floating keyboard invoked from utils.showFloatingGamepadTextInput has been closed. + +**Example with notes**:: + +function Steam.utils.onGamepadTextInputDismissed(data) + -- x,y,w,h are the ''field which shouldn't be obscured by the floating keyboard'' + -- However, it is finicky around window edges. Really, you want the keyboard at the top or bottom of the window. + -- For bottom of window use 0,0,0,0 + -- For top of window use 50, window width-250, window height-100, 200 + Steam.utils.showFloatingGamepadTextInput("SingleLine",x,y,w,h) +end From 00bcee02ad9feaff98baa1bd37d6628840c20cb8 Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Fri, 24 Jan 2025 21:22:19 -0500 Subject: [PATCH 09/14] Update utils.rst --- docs/utils.rst | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/utils.rst b/docs/utils.rst index 4da479e..e37ecf1 100644 --- a/docs/utils.rst +++ b/docs/utils.rst @@ -70,6 +70,9 @@ Function Reference :returns: (`boolean`) true if the big picture overlay is running; otherwise, false :SteamWorks: `ShowGamepadTextInput `_ + Activates the Big Picture text input dialog which only supports gamepad input. + Notes: Steam must be in Big Picture Mode. Non-Steam games ran through Steam will not overlay properly; however, you can alt-tab out of BPMode and test with steam_api64.dll. + .. function:: utils.showFloatingGamepadTextInput(floating_input_mode,TextFieldXPosition,TextFieldYPosition,TextFieldWidth,TextFieldHeight) :param string floating_input_mode: Valid options are: "SingleLine", "MultipleLines", "Email", "Numeric". @@ -80,6 +83,10 @@ Function Reference :returns: (`boolean`) true if the floating keyboard was shown, otherwise, false :SteamWorks: `ShowFloatingGamepadTextInput `_ + Opens a floating keyboard over the game content and sends OS keyboard keys directly to the game. + The text field position is specified in pixels relative the origin of the game window and is used to position the floating keyboard in a way that doesn't cover the text field. + Notes: Steam must be in Big Picture Mode. Non-Steam games ran through Steam will not overlay properly; however, you can alt-tab out of BPMode and test with steam_api64.dll. + Callbacks Reference ------------------- @@ -102,12 +109,12 @@ Callbacks Reference **Example**:: -function Steam.utils.onGamepadTextInputDismissed(data) - if not data.submitted then return end-- The user canceled - local length = Steam.utils.getEnteredGamepadTextLength(); - local newstring = Steam.utils.getEnteredGamepadTextInput(1024, length); - -- Use the newstring made by the user. -end + function Steam.utils.onGamepadTextInputDismissed(data) + if not data.submitted then return end-- The user canceled + local length = Steam.utils.getEnteredGamepadTextLength(); + local newstring = Steam.utils.getEnteredGamepadTextInput(1024, length); + -- Use the newstring made by the user. + end .. function:: utils.OnFloatingGamepadTextInputDismissed() @@ -118,10 +125,8 @@ end **Example with notes**:: -function Steam.utils.onGamepadTextInputDismissed(data) -- x,y,w,h are the ''field which shouldn't be obscured by the floating keyboard'' -- However, it is finicky around window edges. Really, you want the keyboard at the top or bottom of the window. -- For bottom of window use 0,0,0,0 -- For top of window use 50, window width-250, window height-100, 200 Steam.utils.showFloatingGamepadTextInput("SingleLine",x,y,w,h) -end From a8b6f69424d1a96a113fbbccc2457ba9f620520a Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Fri, 24 Jan 2025 21:25:14 -0500 Subject: [PATCH 10/14] Update utils.rst --- docs/utils.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/utils.rst b/docs/utils.rst index e37ecf1..d3ad5e1 100644 --- a/docs/utils.rst +++ b/docs/utils.rst @@ -107,7 +107,7 @@ Callbacks Reference Called when the big picture gamepad text input has been closed. -**Example**:: + **Example**:: function Steam.utils.onGamepadTextInputDismissed(data) if not data.submitted then return end-- The user canceled @@ -123,7 +123,7 @@ Callbacks Reference Called when the floating keyboard invoked from utils.showFloatingGamepadTextInput has been closed. -**Example with notes**:: + **Example with notes**:: -- x,y,w,h are the ''field which shouldn't be obscured by the floating keyboard'' -- However, it is finicky around window edges. Really, you want the keyboard at the top or bottom of the window. From cff9e3bd04ccae28d27c8b98d863cd6a31e8c9f8 Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Fri, 24 Jan 2025 21:39:59 -0500 Subject: [PATCH 11/14] Update utils.rst --- docs/utils.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/utils.rst b/docs/utils.rst index d3ad5e1..b9f972b 100644 --- a/docs/utils.rst +++ b/docs/utils.rst @@ -71,7 +71,7 @@ Function Reference :SteamWorks: `ShowGamepadTextInput `_ Activates the Big Picture text input dialog which only supports gamepad input. - Notes: Steam must be in Big Picture Mode. Non-Steam games ran through Steam will not overlay properly; however, you can alt-tab out of BPMode and test with steam_api64.dll. + Notes: Steam must be in Big Picture Mode. Non-Steam games ran through Steam will not overlay properly; however, you can minimize Steam BPMode and test with steam_api64.dll. .. function:: utils.showFloatingGamepadTextInput(floating_input_mode,TextFieldXPosition,TextFieldYPosition,TextFieldWidth,TextFieldHeight) @@ -85,7 +85,7 @@ Function Reference Opens a floating keyboard over the game content and sends OS keyboard keys directly to the game. The text field position is specified in pixels relative the origin of the game window and is used to position the floating keyboard in a way that doesn't cover the text field. - Notes: Steam must be in Big Picture Mode. Non-Steam games ran through Steam will not overlay properly; however, you can alt-tab out of BPMode and test with steam_api64.dll. + Notes: Steam must be in Big Picture Mode. Non-Steam games ran through Steam will not overlay properly; however, you can minimize Steam BPMode and test with steam_api64.dll. Callbacks Reference ------------------- From 30e89cd7e0a648fd90df01f9e6a9b3503f02251b Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Sat, 25 Jan 2025 23:12:10 -0500 Subject: [PATCH 12/14] Update utils.rst --- docs/utils.rst | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/docs/utils.rst b/docs/utils.rst index b9f972b..9c1d9f8 100644 --- a/docs/utils.rst +++ b/docs/utils.rst @@ -29,19 +29,18 @@ Function Reference Gets the App ID of the current process. - **Example**:: +**Example**:: print("My app id is " .. Steam.utils.getAppID()) .. function:: utils.getEnteredGamepadTextInput(buffer,length) - :param number buffer: We use 1024 chars. + :param number buffer: 1024 :param number length: Number returned by getEnteredGamepadTextLength(). :returns: (`string`) :SteamWorks: `GetEnteredGamepadTextInput `_ Called within onGamepadTextInputDismissed: see that example. - Provides the text input as UTF-8. .. function:: utils.getEnteredGamepadTextLength() @@ -65,28 +64,42 @@ Function Reference :param string input_mode: Valid options are: "Normal", "Password". :param string input_line_mode: Valid options are: "SingleLine", "MultipleLines". :param string description: Sets the description that should inform the user what the input dialog is for. - :param string char_max: We use 1024 chars. + :param number char_max: 1024 :param string existing_text: Sets the preexisting text which the user can edit. :returns: (`boolean`) true if the big picture overlay is running; otherwise, false :SteamWorks: `ShowGamepadTextInput `_ Activates the Big Picture text input dialog which only supports gamepad input. + Notes: Steam must be in Big Picture Mode. Non-Steam games ran through Steam will not overlay properly; however, you can minimize Steam BPMode and test with steam_api64.dll. +**Example**:: + + Steam.utils.showGamepadTextInput("Normal","SingleLine",description,1024,existing_text) + .. function:: utils.showFloatingGamepadTextInput(floating_input_mode,TextFieldXPosition,TextFieldYPosition,TextFieldWidth,TextFieldHeight) :param string floating_input_mode: Valid options are: "SingleLine", "MultipleLines", "Email", "Numeric". - :param string TextFieldXPosition: X coordinate of text field which shouldn't be obscured by the floating keyboard. - :param string TextFieldYPosition: Y coordinate of text field which shouldn't be obscured by the floating keyboard. - :param string TextFieldWidth: Width of text field which shouldn't be obscured by the floating keyboard. - :param string TextFieldHeight: Height of text field which shouldn't be obscured by the floating keyboard. + :param number TextFieldXPosition: X coordinate of text field which shouldn't be obscured by the floating keyboard. + :param number TextFieldYPosition: Y coordinate of text field which shouldn't be obscured by the floating keyboard. + :param number TextFieldWidth: Width of text field which shouldn't be obscured by the floating keyboard. + :param number TextFieldHeight: Height of text field which shouldn't be obscured by the floating keyboard. :returns: (`boolean`) true if the floating keyboard was shown, otherwise, false :SteamWorks: `ShowFloatingGamepadTextInput `_ - Opens a floating keyboard over the game content and sends OS keyboard keys directly to the game. + Opens a floating keyboard over the game content and sends OS keyboard keys directly to the game. The text field position is specified in pixels relative the origin of the game window and is used to position the floating keyboard in a way that doesn't cover the text field. + Notes: Steam must be in Big Picture Mode. Non-Steam games ran through Steam will not overlay properly; however, you can minimize Steam BPMode and test with steam_api64.dll. +**Example with notes**:: + + -- x,y,w,h are the ''field which shouldn't be obscured by the floating keyboard'' + -- However, it is finicky around window edges. Really, you want the keyboard at the top or bottom of the window. + -- For bottom of window use 0,0,0,0 + -- For top of window use 50, window width-250, window height-100, 200 + Steam.utils.showFloatingGamepadTextInput("SingleLine",x,y,w,h) + Callbacks Reference ------------------- @@ -96,7 +109,7 @@ Callbacks Reference Also, you **must** constantly call ``Steam.runCallbacks()`` (preferably in your game loop) in order for your callbacks to be called. -.. function:: utils.OnGamepadTextInputDismissed(data) +.. function:: utils.onGamepadTextInputDismissed(data) :param table data: A table similar to `GamepadTextInputDismissed_t `_ @@ -107,7 +120,7 @@ Callbacks Reference Called when the big picture gamepad text input has been closed. - **Example**:: +**Example**:: function Steam.utils.onGamepadTextInputDismissed(data) if not data.submitted then return end-- The user canceled @@ -116,17 +129,9 @@ Callbacks Reference -- Use the newstring made by the user. end -.. function:: utils.OnFloatingGamepadTextInputDismissed() +.. function:: utils.onFloatingGamepadTextInputDismissed() :returns: nothing :SteamWorks: `FloatingGamepadTextInputDismissed_t `_ Called when the floating keyboard invoked from utils.showFloatingGamepadTextInput has been closed. - - **Example with notes**:: - - -- x,y,w,h are the ''field which shouldn't be obscured by the floating keyboard'' - -- However, it is finicky around window edges. Really, you want the keyboard at the top or bottom of the window. - -- For bottom of window use 0,0,0,0 - -- For top of window use 50, window width-250, window height-100, 200 - Steam.utils.showFloatingGamepadTextInput("SingleLine",x,y,w,h) From 0ad47b0a2a9ba6262feca10f6cfef1bf93661d43 Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Fri, 31 Jan 2025 20:07:16 -0500 Subject: [PATCH 13/14] Update utils.rst --- docs/utils.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/utils.rst b/docs/utils.rst index 9c1d9f8..5dee317 100644 --- a/docs/utils.rst +++ b/docs/utils.rst @@ -94,10 +94,8 @@ Function Reference **Example with notes**:: - -- x,y,w,h are the ''field which shouldn't be obscured by the floating keyboard'' - -- However, it is finicky around window edges. Really, you want the keyboard at the top or bottom of the window. -- For bottom of window use 0,0,0,0 - -- For top of window use 50, window width-250, window height-100, 200 + -- For top of window use 0,window height/2,window width,window height/2 Steam.utils.showFloatingGamepadTextInput("SingleLine",x,y,w,h) Callbacks Reference From e20cb3f2ce6622f14dea742654765891d0e8d470 Mon Sep 17 00:00:00 2001 From: Cartread <69614530+Cartread@users.noreply.github.com> Date: Fri, 31 Jan 2025 20:07:41 -0500 Subject: [PATCH 14/14] Update utils.rst --- docs/utils.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/utils.rst b/docs/utils.rst index 5dee317..ec03581 100644 --- a/docs/utils.rst +++ b/docs/utils.rst @@ -92,7 +92,7 @@ Function Reference Notes: Steam must be in Big Picture Mode. Non-Steam games ran through Steam will not overlay properly; however, you can minimize Steam BPMode and test with steam_api64.dll. -**Example with notes**:: +**Example**:: -- For bottom of window use 0,0,0,0 -- For top of window use 0,window height/2,window width,window height/2