feat: auto switching tooltips (not fully done)
This commit is contained in:
1 parent
39c22195fb
commit
4020b16864
3 files changed
+111
-8
No files matched your search
@@ -15,6 +15,7 @@
|
||||
#include <message_dialog.h>
|
||||
#elif _WINDOWS64
|
||||
#include "Windows64\Windows64_Minecraft.h"
|
||||
string m_LastControllerType = "mrow";
|
||||
#endif
|
||||
|
||||
// 4J Stu - Enable this to override the Iggy Allocator
|
||||
@@ -185,13 +186,6 @@ UIController::UIController()
|
||||
m_fScreenWidth = 1920.0f;
|
||||
m_fScreenHeight = 1080.0f;
|
||||
m_bScreenWidthSetup = true;
|
||||
#elif _WINDOWS64
|
||||
m_fScreenWidth = g_iScreenWidth;
|
||||
m_fScreenHeight = g_iScreenHeight;
|
||||
m_bScreenWidthSetup = true;
|
||||
#ifdef _DEBUG
|
||||
app.DebugPrintf("[UIController] Width: %d, Height: %d\n", static_cast<int>(m_fScreenWidth), static_cast<int>(m_fScreenHeight));
|
||||
#endif
|
||||
#else
|
||||
m_fScreenWidth = 1280.0f;
|
||||
m_fScreenHeight = 720.0f;
|
||||
@@ -264,6 +258,10 @@ void UIController::preInit(S32 width, S32 height)
|
||||
m_fScreenHeight = height;
|
||||
m_bScreenWidthSetup = true;
|
||||
|
||||
#ifdef _DEBUG
|
||||
app.DebugPrintf("[UIController] Width: %d, Height: %d\n", static_cast<int>(m_fScreenWidth), static_cast<int>(m_fScreenHeight));
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_IGGY_ALLOCATOR
|
||||
IggyAllocator allocator;
|
||||
allocator.user_callback_data = this;
|
||||
@@ -497,10 +495,89 @@ void UIController::tick()
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
//GetControllerType();
|
||||
#endif
|
||||
}
|
||||
|
||||
//str1k3r - this is what actually does all the autoswitching
|
||||
void UIController::GetControllerType()
|
||||
{
|
||||
const char* ControllerType = InputManager.GetControllerType(0);
|
||||
wstring controlTooltipsPath = L"";
|
||||
|
||||
if(ControllerType != m_LastControllerType)
|
||||
{
|
||||
m_LastControllerType = ControllerType;
|
||||
|
||||
if (strcmp(ControllerType, "PS3") == 0)
|
||||
{
|
||||
controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\PS3HDControls.swf" : L"ControlTooltips\\PS3Controls.swf";
|
||||
}
|
||||
else if (strcmp(ControllerType, "PS4") == 0)
|
||||
{
|
||||
controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\OrbisHDControls.swf" : L"ControlTooltips\\OrbisControls.swf";
|
||||
}
|
||||
else if (strcmp(ControllerType, "XBOXONE") == 0 || strcmp(ControllerType, "UNKNOWN") == 0)
|
||||
{
|
||||
controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\DurangoHDControls.swf" : L"ControlTooltips\\DurangoControls.swf";
|
||||
}
|
||||
else if (ControllerType == "XBOX360")
|
||||
{
|
||||
controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\XboxHDControls.swf" : L"ControlTooltips\\XboxControls.swf";
|
||||
}
|
||||
else
|
||||
{
|
||||
controlTooltipsPath = (ui.getScreenWidth() >= 1920) ? L"ControlTooltips\\HD\\Windows64HDControls.swf" : L"ControlTooltips\\Windows64Controls.swf";
|
||||
}
|
||||
|
||||
//ReloadSingleSkin(eLibrary_ControlTooltips, controlTooltipsPath, (m_fScreenHeight >= 1080.0f) ? L"skinControlTooltipsHD.swf" : L"skinControlTooltips.swf");
|
||||
|
||||
for(unsigned int i = 0; i < eUIGroup_COUNT; ++i)
|
||||
{
|
||||
if(m_groups[i]->getTooltips())
|
||||
m_groups[i]->getTooltips()->destroyMovie();
|
||||
if(m_groups[i]->getPressStartToPlay())
|
||||
m_groups[i]->getPressStartToPlay()->destroyMovie();
|
||||
|
||||
if(m_groups[i]->getTooltips())
|
||||
m_groups[i]->getTooltips()->reloadMovie(true);
|
||||
if(m_groups[i]->getPressStartToPlay())
|
||||
m_groups[i]->getPressStartToPlay()->reloadMovie(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wstring UIController::GetTooltipSkinPath()
|
||||
{
|
||||
const char* ControllerType = InputManager.GetControllerType(0);
|
||||
|
||||
if (strcmp(ControllerType, "PS3") == 0)
|
||||
{
|
||||
return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\PS3HDControls.swf" : L"ControlTooltips\\PS3Controls.swf";
|
||||
}
|
||||
else if (strcmp(ControllerType, "PS4") == 0)
|
||||
{
|
||||
return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\OrbisHDControls.swf" : L"ControlTooltips\\OrbisControls.swf";
|
||||
}
|
||||
else if (strcmp(ControllerType, "XBOXONE") == 0 || strcmp(ControllerType, "UNKNOWN") == 0)
|
||||
{
|
||||
return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\DurangoHDControls.swf" : L"ControlTooltips\\DurangoControls.swf";
|
||||
}
|
||||
else if (strcmp(ControllerType, "XBOX360") == 0)
|
||||
{
|
||||
return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\XboxHDControls.swf" : L"ControlTooltips\\XboxControls.swf";
|
||||
}
|
||||
else
|
||||
{
|
||||
return ui.getScreenWidth() >= 1920 ? L"ControlTooltips\\HD\\Windows64HDControls.swf" : L"ControlTooltips\\Windows64Controls.swf";
|
||||
}
|
||||
}
|
||||
|
||||
void UIController::loadSkins()
|
||||
{
|
||||
wstring tooltipsSkinPath = L"";
|
||||
wstring platformSkinPath = L"";
|
||||
|
||||
#ifdef __PS3__
|
||||
@@ -510,14 +587,17 @@ void UIController::loadSkins()
|
||||
#elif defined _WINDOWS64
|
||||
if(m_fScreenWidth >= 1920.0f)
|
||||
{
|
||||
//tooltipsSkinPath = GetTooltipSkinPath();
|
||||
platformSkinPath = L"skinHDWin.swf";
|
||||
}
|
||||
else if (m_fScreenWidth >= 960.0f && m_fScreenWidth < 1280.0f) //str1k3r - we need to check this to make sure we dont load the vita skin on 720p
|
||||
{
|
||||
//tooltipsSkinPath = GetTooltipSkinPath();
|
||||
platformSkinPath = L"skinWinVita.swf";
|
||||
}
|
||||
else
|
||||
{
|
||||
//tooltipsSkinPath = GetTooltipSkinPath();
|
||||
platformSkinPath = L"skinWin.swf";
|
||||
}
|
||||
#elif defined _DURANGO
|
||||
@@ -551,6 +631,9 @@ void UIController::loadSkins()
|
||||
m_iggyLibraries[eLibrary_GraphicsInGame] = loadSkin(L"skinHDGraphicsInGame.swf", L"skinHDGraphicsInGame.swf");
|
||||
m_iggyLibraries[eLibrary_GraphicsTooltips] = loadSkin(L"skinHDGraphicsTooltips.swf", L"skinHDGraphicsTooltips.swf");
|
||||
m_iggyLibraries[eLibrary_GraphicsLabels] = loadSkin(L"skinHDGraphicsLabels.swf", L"skinHDGraphicsLabels.swf");
|
||||
#ifdef _WINDOWS64
|
||||
//m_iggyLibraries[eLibrary_ControlTooltips] = loadSkin(tooltipsSkinPath, L"skinControlTooltipsHD.swf");
|
||||
#endif
|
||||
m_iggyLibraries[eLibrary_Labels] = loadSkin(L"skinHDLabels.swf", L"skinHDLabels.swf");
|
||||
m_iggyLibraries[eLibrary_InGame] = loadSkin(L"skinHDInGame.swf", L"skinHDInGame.swf");
|
||||
m_iggyLibraries[eLibrary_HUD] = loadSkin(L"skinHDHud.swf", L"skinHDHud.swf");
|
||||
@@ -565,6 +648,9 @@ void UIController::loadSkins()
|
||||
m_iggyLibraries[eLibrary_GraphicsInGame] = loadSkin(L"skinGraphicsInGame.swf", L"skinGraphicsInGame.swf");
|
||||
m_iggyLibraries[eLibrary_GraphicsTooltips] = loadSkin(L"skinGraphicsTooltips.swf", L"skinGraphicsTooltips.swf");
|
||||
m_iggyLibraries[eLibrary_GraphicsLabels] = loadSkin(L"skinGraphicsLabels.swf", L"skinGraphicsLabels.swf");
|
||||
#ifdef _WINDOWS64
|
||||
//m_iggyLibraries[eLibrary_ControlTooltips] = loadSkin(tooltipsSkinPath, L"skinControlTooltipsHD.swf");
|
||||
#endif
|
||||
m_iggyLibraries[eLibrary_Labels] = loadSkin(L"skinLabels.swf", L"skinLabels.swf");
|
||||
m_iggyLibraries[eLibrary_InGame] = loadSkin(L"skinInGame.swf", L"skinInGame.swf");
|
||||
m_iggyLibraries[eLibrary_HUD] = loadSkin(L"skinHud.swf", L"skinHud.swf");
|
||||
@@ -606,6 +692,17 @@ IggyLibrary UIController::loadSkin(const wstring &skinPath, const wstring &skinN
|
||||
return lib;
|
||||
}
|
||||
|
||||
void UIController::ReloadSingleSkin(ELibraries lib, const wstring &skinPath, const wstring &skinName)
|
||||
{
|
||||
if(m_iggyLibraries[lib] != IGGY_INVALID_LIBRARY)
|
||||
{
|
||||
IggyLibraryDestroy(m_iggyLibraries[lib]);
|
||||
m_iggyLibraries[lib] = IGGY_INVALID_LIBRARY;
|
||||
}
|
||||
|
||||
m_iggyLibraries[lib] = loadSkin(skinPath, skinName);
|
||||
}
|
||||
|
||||
void UIController::ReloadSkin()
|
||||
{
|
||||
// Destroy all scene swf
|
||||
|
||||
Reference in new issue
Block a user