Open Binding panel when controller configuration is selected. Move steam API initialization to the beginning of the program's execution. Release Build 8442.

This commit is contained in:
sigonasr2 2024-03-25 19:37:53 -05:00
parent 66cb19abc5
commit 0f2deb5f99
6 changed files with 34 additions and 30 deletions

View File

@ -321,19 +321,21 @@ bool AiL::OnUserCreate(){
#endif
State_OverworldMap::SetStageMarker("starting_map_name"_S);
if(SteamInput()!=nullptr){
SteamInput()->Init(false);
Input::LoadSteamButtonIcons();
Input::ingameControlsHandle=SteamInput()->GetActionSetHandle("InGameControls");
}
if(steamKeyboardCallbackListener==nullptr){
steamKeyboardCallbackListener=new SteamKeyboardCallbackHandler();
}
utils::datafile::INITIAL_SETUP_COMPLETE=true;
ValidateGameStatus(); //Checks to make sure everything has been initialized properly.
#ifndef __EMSCRIPTEN__
SetupDiscord();
if(SteamAPI_RestartAppIfNecessary(2895980U))return false; //Immediately quit if steam is detected and can be started through it.
if(Steam_Init()){
LOG("Steam API Initialized successfully!");
}else{
LOG("Steam API failed to initialize!");
}
#endif
gameInitialized=true;
@ -2650,8 +2652,26 @@ datafiledoubledata AiL::GetDoubleList(std::string key){
return {DATA,key};
}
bool Steam_Init(){
if(SteamAPI_Init()){
if(SteamUtils()!=nullptr){
SteamUtils()->SetWarningMessageHook([](int severity,const char*message){
LOG(std::format("STEAM[{}]: {}",severity,std::string(message)));
});
}
return true;
}
return false;
}
int main()
{
if(SteamAPI_RestartAppIfNecessary(2895980U))return false; //Immediately quit if steam is detected and can be started through it.
if(Steam_Init()){
LOG("Steam API Initialized successfully!");
}else{
LOG("Steam API failed to initialize!");
}
{
AiL demo;
@ -3808,26 +3828,6 @@ int AiL::GetLoadoutSize()const{
return loadout.size();
}
bool AiL::Steam_Init(){
if(SteamAPI_Init()){
if(SteamUtils()!=nullptr){
SteamUtils()->SetWarningMessageHook([](int severity,const char*message){
LOG(std::format("STEAM[{}]: {}",severity,std::string(message)));
});
if(steamKeyboardCallbackListener==nullptr){
steamKeyboardCallbackListener=new SteamKeyboardCallbackHandler();
}
}
if(SteamInput()!=nullptr){
SteamInput()->Init(false);
Input::LoadSteamButtonIcons();
Input::ingameControlsHandle=SteamInput()->GetActionSetHandle("InGameControls");
}
return true;
}
return false;
}
void AiL::ActivateActionSetForAllControllers(InputActionSetHandle_t actionSetHandle){
for(int i=0;i<Input::controllerCount;i++){
SteamInput()->ActivateActionSet(Input::steamControllers[i],actionSetHandle);

View File

@ -309,7 +309,6 @@ public:
const bool GameInitialized()const;
rcode LoadResource(Renderable&renderable,std::string_view imgPath,bool filter=false,bool clamp=true);
void UpdateMonsters();
bool Steam_Init();
void ActivateActionSetForAllControllers(InputActionSetHandle_t actionSetHandle);
struct TileGroupData{

View File

@ -99,6 +99,7 @@ class Input{
friend class InputGroup;
friend class State_MainMenu;
friend class InputHelper;
friend class Menu;
friend class AiL;
InputType type;
int key; //This will be interpreted differently depending on input type.

View File

@ -217,7 +217,11 @@ void Menu::InitializeSettingsWindow(){
settingsList->ADD("Controller Bindings Button",MenuComponent)(geom2d::rect<float>{{28,148.f},vf2d{settingsList->rect.size.x-12-56,24}},"Controller Bindings",[&](MenuFuncData data){
ChangeKeybindDisplayType(CONTROLLER);
Component<MenuLabel>(INPUT_KEY_DISPLAY,"Keyboard Mapping Label")->SetLabel("Controller Mappings");
Menu::OpenMenu(INPUT_KEY_DISPLAY);
if(SteamInput()){
SteamInput()->ShowBindingPanel(Input::steamControllers[Input::activeSteamControllerIndex]);
}else{
Menu::OpenMenu(INPUT_KEY_DISPLAY);
}
return true;
},vf2d{1.5f,2.f})END;

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 0
#define VERSION_PATCH 0
#define VERSION_BUILD 8427
#define VERSION_BUILD 8442
#define stringify(a) stringify_(a)
#define stringify_(a) #a