diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj index 3028a9a1..088ae397 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj @@ -514,6 +514,10 @@ + + + + @@ -807,6 +811,10 @@ + + + + diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters index 953bb628..5fa23f97 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters @@ -621,6 +621,9 @@ Header Files\steam + + Header Files + @@ -989,6 +992,9 @@ Source Files\Effects + + Source Files + diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 13ebbfbb..bd07c576 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -79,6 +79,7 @@ All rights reserved. #include "GameSettings.h" #include "LoadingScreen.h" #include "Tutorial.h" +#include "SteamKeyboardCallbackHandler.h" INCLUDE_EMITTER_LIST INCLUDE_ITEM_CATEGORIES @@ -2660,7 +2661,11 @@ int main() windowPosConf={loadSystemFile["Window Pos"].GetInt(0),loadSystemFile["Window Pos"].GetInt(1)}; } if(loadSystemFile.HasProperty("Window Size"))windowSizeConf={loadSystemFile["Window Size"].GetInt(0),loadSystemFile["Window Size"].GetInt(1)}; + size_t requiredSize; + + getenv_s( &requiredSize, NULL, 0, "SteamTenfoot"); if(loadSystemFile.HasProperty("Fullscreen"))fullscreenConf=loadSystemFile["Fullscreen"].GetBool(); + if(requiredSize>0)fullscreenConf=true; } #pragma endregion @@ -3791,6 +3796,9 @@ bool AiL::Steam_Init(){ SteamUtils()->SetWarningMessageHook([](int severity,const char*message){ std::cout<Init(false); diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index afdc3edb..269d8475 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -57,6 +57,9 @@ All rights reserved. #include "DynamicCounter.h" #include "UndefKeys.h" + +class SteamKeyboardCallbackHandler; + #define CreateBullet(type) BULLET_LIST.push_back(std::make_unique(type #define EndBullet )); @@ -185,6 +188,7 @@ private: ::discord::Result SetupDiscord(); #endif Audio audioEngine; + SteamKeyboardCallbackHandler*steamKeyboardCallbackListener=nullptr; public: AiL(); bool OnUserCreate() override; diff --git a/Adventures in Lestoria/ClassSelectionWindow.cpp b/Adventures in Lestoria/ClassSelectionWindow.cpp index 9fba51b1..66581bcf 100644 --- a/Adventures in Lestoria/ClassSelectionWindow.cpp +++ b/Adventures in Lestoria/ClassSelectionWindow.cpp @@ -45,6 +45,9 @@ All rights reserved. #include "SaveFileNameButton.h" #include "TextEntryLabel.h" #include "Checkbox.h" +#ifndef __EMSCRIPTEN__ + #include +#endif INCLUDE_game using A=Attribute; @@ -68,6 +71,12 @@ void Menu::InitializeClassSelectionWindow(){ Component(SAVE_FILE_NAME,"Save File Name Text Entry")->SetInput(std::string(SaveFile::GetSaveFileName())); game->TextEntryEnable(true); Menu::OpenMenu(SAVE_FILE_NAME); + vf2d textboxWindowPos=data.component.lock()->rect.pos*game->GetPixelSize(); + vf2d textboxWindowSize=data.component.lock()->rect.size*game->GetPixelSize(); + + if(SteamUtils()){ + SteamUtils()->ShowGamepadTextInput(k_EGamepadTextInputModeNormal,k_EGamepadTextInputLineModeSingleLine,"Character Name:",16U,std::string(SaveFile::GetSaveFileName()).c_str()); + } return true; },vf2d{2.f,2.f})END; diff --git a/Adventures in Lestoria/SteamKeyboardCallbackHandler.cpp b/Adventures in Lestoria/SteamKeyboardCallbackHandler.cpp new file mode 100644 index 00000000..40f7b446 --- /dev/null +++ b/Adventures in Lestoria/SteamKeyboardCallbackHandler.cpp @@ -0,0 +1,55 @@ +#pragma region License +/* +License (OLC-3) +~~~~~~~~~~~~~~~ + +Copyright 2024 Joshua Sigona + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions or derivations of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +2. Redistributions or derivative works in binary form must reproduce the above +copyright notice. This list of conditions and the following disclaimer must be +reproduced in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may +be used to endorse or promote products derived from this software without specific +prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +Portions of this software are copyright © 2024 The FreeType +Project (www.freetype.org). Please see LICENSE_FT.txt for more information. +All rights reserved. +*/ +#pragma endregion + +#include "SteamKeyboardCallbackHandler.h" + +void SteamKeyboardCallbackHandler::TextEntryComplete( GamepadTextInputDismissed_t* pCallback ){ + if(SteamUtils()){ + if(pCallback->m_bSubmitted){ + char enteredText[17]; + SteamUtils()->GetEnteredGamepadTextInput(enteredText,16); + Component(SAVE_FILE_NAME,"Save File Name Text Entry")->SetInput(std::string(enteredText)); + if(std::string(enteredText).length()>0){ + Component(SAVE_FILE_NAME,"Continue Button")->SetGrayedOut(false); + Component(SAVE_FILE_NAME,"Continue Button")->Click(); + }else{ + Component(SAVE_FILE_NAME,"Back Button")->Click(); + } + }else Component(SAVE_FILE_NAME,"Back Button")->Click(); + } +}; \ No newline at end of file diff --git a/Adventures in Lestoria/SteamKeyboardCallbackHandler.h b/Adventures in Lestoria/SteamKeyboardCallbackHandler.h new file mode 100644 index 00000000..eda3f90a --- /dev/null +++ b/Adventures in Lestoria/SteamKeyboardCallbackHandler.h @@ -0,0 +1,47 @@ +#pragma region License +/* +License (OLC-3) +~~~~~~~~~~~~~~~ + +Copyright 2024 Joshua Sigona + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions or derivations of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +2. Redistributions or derivative works in binary form must reproduce the above +copyright notice. This list of conditions and the following disclaimer must be +reproduced in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may +be used to endorse or promote products derived from this software without specific +prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +Portions of this software are copyright © 2024 The FreeType +Project (www.freetype.org). Please see LICENSE_FT.txt for more information. +All rights reserved. +*/ +#pragma endregion +#pragma once +#ifndef __EMSCRIPTEN__ + #include +#endif +#include +#include "TextEntryLabel.h" + +class SteamKeyboardCallbackHandler{ + STEAM_CALLBACK(SteamKeyboardCallbackHandler,TextEntryComplete,GamepadTextInputDismissed_t); +}; \ No newline at end of file diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index bb3c8e63..d835836b 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -16,10 +16,6 @@ Steam Rich Presence Add in vsync system option Remove Unlock All Button -Fix scaling on some UI equip windows. - -When your game wants keyboard input (e.g. when naming avatars), you use the API to automatically bring up the text entry UI. - Start your game in fullscreen by default when the user is running Steam Big Picture (the "SteamTenfoot" environment variable will be set) Sword attack should linger diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index f41a58d8..3490c485 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 0 #define VERSION_PATCH 0 -#define VERSION_BUILD 8369 +#define VERSION_BUILD 8394 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 2d1517e5..6e9d6dd3 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ