Some GamepadUI fixes
This commit is contained in:
parent
19ce478dd0
commit
091308106b
@ -1334,6 +1334,16 @@ void CHLClient::HudUpdate( bool bActive )
|
|||||||
CRTime::UpdateRealTime();
|
CRTime::UpdateRealTime();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef GAMEPADUI
|
||||||
|
if (IsGamepadUI())
|
||||||
|
{
|
||||||
|
if (!enginevgui->IsGameUIVisible())
|
||||||
|
{
|
||||||
|
engine->ExecuteClientCmd("gamepadui_resetfade");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // GAMEPADUI
|
||||||
|
|
||||||
GetClientVoiceMgr()->Frame( frametime );
|
GetClientVoiceMgr()->Frame( frametime );
|
||||||
|
|
||||||
gHUD.UpdateHud( bActive );
|
gHUD.UpdateHud( bActive );
|
||||||
@ -1373,7 +1383,12 @@ void CHLClient::HudUpdate( bool bActive )
|
|||||||
void CHLClient::HudReset( void )
|
void CHLClient::HudReset( void )
|
||||||
{
|
{
|
||||||
gHUD.VidInit();
|
gHUD.VidInit();
|
||||||
|
#ifdef GAMEPADUI
|
||||||
|
if (IsGamepadUI())
|
||||||
|
{
|
||||||
|
engine->ExecuteClientCmd("gamepadui_resetfade");
|
||||||
|
}
|
||||||
|
#endif // GAMEPADUI
|
||||||
PhysicsReset();
|
PhysicsReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,6 +96,8 @@ $Project
|
|||||||
$File "gamepadui_options.cpp"
|
$File "gamepadui_options.cpp"
|
||||||
$File "gamepadui_scrollbar.cpp"
|
$File "gamepadui_scrollbar.cpp"
|
||||||
$File "gamepadui_util.cpp"
|
$File "gamepadui_util.cpp"
|
||||||
|
$File "gamepadui_loadingscreen.cpp"
|
||||||
|
$File "gamepadui_loadingscreen.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
$Folder "Link Libraries"
|
$Folder "Link Libraries"
|
||||||
|
@ -31,7 +31,7 @@ GamepadUIBasePanel::GamepadUIBasePanel( vgui::VPANEL parent ) : BaseClass( NULL,
|
|||||||
|
|
||||||
m_pSizingPanel = new GamepadUISizingPanel( this );
|
m_pSizingPanel = new GamepadUISizingPanel( this );
|
||||||
|
|
||||||
m_pMainMenu = new GamepadUIMainMenu( this );
|
m_pMainMenu = new GamepadUIMainMenu( this );
|
||||||
OnMenuStateChanged();
|
OnMenuStateChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,19 +82,19 @@ void GamepadUIBasePanel::SetCurrentFrame( GamepadUIFrame *pFrame )
|
|||||||
|
|
||||||
void GamepadUIBasePanel::OnMenuStateChanged()
|
void GamepadUIBasePanel::OnMenuStateChanged()
|
||||||
{
|
{
|
||||||
if ( m_bBackgroundMusicEnabled && GamepadUI::GetInstance().IsGamepadUIVisible() )
|
if (m_bBackgroundMusicEnabled && GamepadUI::GetInstance().IsGamepadUIVisible())
|
||||||
{
|
{
|
||||||
if ( !IsBackgroundMusicPlaying() )
|
if (!IsBackgroundMusicPlaying())
|
||||||
ActivateBackgroundEffects();
|
ActivateBackgroundEffects();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ReleaseBackgroundMusic();
|
ReleaseBackgroundMusic();
|
||||||
|
|
||||||
if (m_pCurrentFrame && m_pCurrentFrame != m_pMainMenu)
|
if (m_pCurrentFrame && m_pCurrentFrame != m_pMainMenu)
|
||||||
{
|
{
|
||||||
m_pCurrentFrame->Close();
|
m_pCurrentFrame->Close();
|
||||||
m_pCurrentFrame = NULL;
|
m_pCurrentFrame = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamepadUIBasePanel::ActivateBackgroundEffects()
|
void GamepadUIBasePanel::ActivateBackgroundEffects()
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include "vgui/IVGui.h"
|
#include "vgui/IVGui.h"
|
||||||
#include "vgui/ISurface.h"
|
#include "vgui/ISurface.h"
|
||||||
|
|
||||||
|
#include "../../public/vgui_controls/Panel.h"
|
||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
#include "gamepadui_string.h"
|
#include "gamepadui_string.h"
|
||||||
#include "gamepadui_glyph.h"
|
#include "gamepadui_glyph.h"
|
||||||
#include "vgui_controls/Button.h"
|
#include "vgui_controls/Button.h"
|
||||||
|
//#include "../../public/vgui_controls/Button.h"
|
||||||
|
//#include "../../public/vgui_controls/Button.h"
|
||||||
|
|
||||||
namespace ButtonStates
|
namespace ButtonStates
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
// 🐸
|
// 🐸
|
||||||
|
//shut up
|
||||||
#include "gamepadui_frame.h"
|
#include "gamepadui_frame.h"
|
||||||
#include "gamepadui_button.h"
|
#include "gamepadui_button.h"
|
||||||
#include "gamepadui_interface.h"
|
#include "gamepadui_interface.h"
|
||||||
#include "gamepadui_basepanel.h"
|
#include "gamepadui_basepanel.h"
|
||||||
|
#include "gamepadui_mainmenu.h"
|
||||||
|
|
||||||
#include "inputsystem/iinputsystem.h"
|
#include "inputsystem/iinputsystem.h"
|
||||||
#include "vgui/ISurface.h"
|
#include "vgui/ISurface.h"
|
||||||
|
@ -134,11 +134,8 @@ CON_COMMAND( gamepadui_opengenerictextdialog, "Opens a generic text dialog.\nFor
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vgui::Panel *pParent = GamepadUI::GetInstance().GetCurrentFrame();
|
// TODO: Parent to current frame
|
||||||
if (!pParent)
|
new GamepadUIGenericConfirmationPanel( GamepadUI::GetInstance().GetBasePanel(), "GenericConfirmationPanel", args.Arg(1), args.Arg(2),
|
||||||
pParent = GamepadUI::GetInstance().GetBasePanel();
|
|
||||||
|
|
||||||
new GamepadUIGenericConfirmationPanel( pParent, "GenericConfirmationPanel", args.Arg(1), args.Arg(2),
|
|
||||||
[](){}, args.Arg(3)[0] != '0', false );
|
[](){}, args.Arg(3)[0] != '0', false );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,35 +147,15 @@ CON_COMMAND( gamepadui_opengenericconfirmdialog, "Opens a generic confirmation d
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vgui::Panel *pParent = GamepadUI::GetInstance().GetCurrentFrame();
|
// TODO: Parent to current frame
|
||||||
if (!pParent)
|
const char *pCmd = args.Arg( 4 );
|
||||||
pParent = GamepadUI::GetInstance().GetBasePanel();
|
new GamepadUIGenericConfirmationPanel( GamepadUI::GetInstance().GetBasePanel(), "GenericConfirmationPanel", args.Arg(1), args.Arg(2),
|
||||||
|
|
||||||
// To get the command, we just use the remaining string after the small font parameter
|
|
||||||
// This method is fairly dirty and relies a bit on guesswork, but it allows spaces and quotes to be used
|
|
||||||
// without having to worry about how the initial dialog command handles it
|
|
||||||
const char *pCmd = args.GetCommandString();
|
|
||||||
char *pSmallFont = V_strstr( pCmd, args.Arg( 3 )[0] != '0' ? " 1 " : " 0 " );
|
|
||||||
if (!pSmallFont)
|
|
||||||
{
|
|
||||||
// Look for quotes instead
|
|
||||||
pSmallFont = V_strstr( pCmd, args.Arg( 3 )[0] != '0' ? " \"1\" " : " \"0\" " );
|
|
||||||
if (pSmallFont)
|
|
||||||
pCmd += (pSmallFont - pCmd) + 5;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Give up and use the 4th argument
|
|
||||||
pCmd = args.Arg( 4 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pCmd += (pSmallFont - pCmd) + 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
new GamepadUIGenericConfirmationPanel( pParent, "GenericConfirmationPanel", args.Arg(1), args.Arg(2),
|
|
||||||
[pCmd]()
|
[pCmd]()
|
||||||
{
|
{
|
||||||
GamepadUI::GetInstance().GetEngineClient()->ClientCmd_Unrestricted( pCmd );
|
// Replace '' with quotes
|
||||||
|
char szCmd[512];
|
||||||
|
V_StrSubst( pCmd, "''", "\"", szCmd, sizeof(szCmd) );
|
||||||
|
|
||||||
|
GamepadUI::GetInstance().GetEngineClient()->ClientCmd_Unrestricted( szCmd );
|
||||||
}, args.Arg(3)[0] != '0', true );
|
}, args.Arg(3)[0] != '0', true );
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,13 @@ public:
|
|||||||
m_nId = vgui::surface()->CreateNewTextureID();
|
m_nId = vgui::surface()->CreateNewTextureID();
|
||||||
vgui::surface()->DrawSetTextureFile( m_nId, pName, true, false );
|
vgui::surface()->DrawSetTextureFile( m_nId, pName, true, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GetImageSize(int& width, int& heigth)
|
||||||
|
{
|
||||||
|
vgui::surface()->DrawGetTextureSize(m_nId, width, heigth);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void SetTGAImage( const char* pName )
|
void SetTGAImage( const char* pName )
|
||||||
{
|
{
|
||||||
Cleanup();
|
Cleanup();
|
||||||
@ -64,4 +71,5 @@ private:
|
|||||||
int m_nId = -1;
|
int m_nId = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // GAMEPADUI_IMAGE_H
|
#endif // GAMEPADUI_IMAGE_H
|
||||||
|
@ -82,7 +82,7 @@ void GamepadUI::Initialize( CreateInterfaceFn factory )
|
|||||||
m_pAnimationController = new vgui::AnimationController( m_pBasePanel );
|
m_pAnimationController = new vgui::AnimationController( m_pBasePanel );
|
||||||
m_pAnimationController->SetProportional( false );
|
m_pAnimationController->SetProportional( false );
|
||||||
|
|
||||||
GetMainMenu()->Activate();
|
//GetMainMenu()->Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamepadUI::Shutdown()
|
void GamepadUI::Shutdown()
|
||||||
@ -108,6 +108,14 @@ void GamepadUI::OnUpdate( float flFrametime )
|
|||||||
{
|
{
|
||||||
if ( m_pAnimationController )
|
if ( m_pAnimationController )
|
||||||
m_pAnimationController->UpdateAnimations( GetTime() );
|
m_pAnimationController->UpdateAnimations( GetTime() );
|
||||||
|
|
||||||
|
static bool tempNumDraw = true;
|
||||||
|
|
||||||
|
if (ConVarRef("cl_gamepadui_mainmenu_draw").GetBool() && tempNumDraw)
|
||||||
|
{
|
||||||
|
GetMainMenu()->Activate();
|
||||||
|
tempNumDraw=false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamepadUI::OnLevelInitializePreEntity()
|
void GamepadUI::OnLevelInitializePreEntity()
|
||||||
@ -242,16 +250,6 @@ void GamepadUI::GetSizingPanelOffset( int &nX, int &nY ) const
|
|||||||
pPanel->GetPos( nX, nY );
|
pPanel->GetPos( nX, nY );
|
||||||
}
|
}
|
||||||
|
|
||||||
GamepadUIFrame *GamepadUI::GetCurrentFrame() const
|
|
||||||
{
|
|
||||||
return m_pBasePanel->GetCurrentFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
vgui::VPANEL GamepadUI::GetCurrentFrameVPanel() const
|
|
||||||
{
|
|
||||||
return m_pBasePanel->GetCurrentFrame()->GetVPanel();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
void GamepadUI::BonusMapChallengeNames( char *pchFileName, char *pchMapName, char *pchChallengeName )
|
void GamepadUI::BonusMapChallengeNames( char *pchFileName, char *pchMapName, char *pchChallengeName )
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,6 @@ class GamepadUIMainMenu;
|
|||||||
|
|
||||||
class GamepadUIBasePanel;
|
class GamepadUIBasePanel;
|
||||||
class GamepadUISizingPanel;
|
class GamepadUISizingPanel;
|
||||||
class GamepadUIFrame;
|
|
||||||
|
|
||||||
class GamepadUI : public IGamepadUI
|
class GamepadUI : public IGamepadUI
|
||||||
{
|
{
|
||||||
@ -80,6 +79,8 @@ public:
|
|||||||
ISource2013SteamInput *GetSteamInput() const { return m_pSteamInput; }
|
ISource2013SteamInput *GetSteamInput() const { return m_pSteamInput; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GamepadUIMainMenu* GetMainMenu() const;
|
||||||
|
|
||||||
vgui::AnimationController *GetAnimationController() const { return m_pAnimationController; }
|
vgui::AnimationController *GetAnimationController() const { return m_pAnimationController; }
|
||||||
float GetTime() const { return Plat_FloatTime(); }
|
float GetTime() const { return Plat_FloatTime(); }
|
||||||
GradientHelper *GetGradientHelper() { return &m_GradientHelper; }
|
GradientHelper *GetGradientHelper() { return &m_GradientHelper; }
|
||||||
@ -93,9 +94,6 @@ public:
|
|||||||
void GetSizingPanelScale( float &flX, float &flY ) const;
|
void GetSizingPanelScale( float &flX, float &flY ) const;
|
||||||
void GetSizingPanelOffset( int &nX, int &nY ) const;
|
void GetSizingPanelOffset( int &nX, int &nY ) const;
|
||||||
|
|
||||||
GamepadUIFrame *GetCurrentFrame() const;
|
|
||||||
vgui::VPANEL GetCurrentFrameVPanel() const;
|
|
||||||
|
|
||||||
#ifdef MAPBASE
|
#ifdef MAPBASE
|
||||||
void BonusMapChallengeNames( char *pchFileName, char *pchMapName, char *pchChallengeName ) OVERRIDE;
|
void BonusMapChallengeNames( char *pchFileName, char *pchMapName, char *pchChallengeName ) OVERRIDE;
|
||||||
void BonusMapChallengeObjectives( int &iBronze, int &iSilver, int &iGold ) OVERRIDE;
|
void BonusMapChallengeObjectives( int &iBronze, int &iSilver, int &iGold ) OVERRIDE;
|
||||||
@ -133,8 +131,6 @@ private:
|
|||||||
GradientHelper m_GradientHelper;
|
GradientHelper m_GradientHelper;
|
||||||
CSteamAPIContext m_SteamAPIContext;
|
CSteamAPIContext m_SteamAPIContext;
|
||||||
|
|
||||||
GamepadUIMainMenu* GetMainMenu() const;
|
|
||||||
|
|
||||||
float m_flScreenXRatio = 1.0f;
|
float m_flScreenXRatio = 1.0f;
|
||||||
float m_flScreenYRatio = 1.0f;
|
float m_flScreenYRatio = 1.0f;
|
||||||
|
|
||||||
@ -147,6 +143,9 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static GamepadUI *s_pGamepadUI;
|
static GamepadUI *s_pGamepadUI;
|
||||||
|
|
||||||
|
public:
|
||||||
|
float GetTimeDelta() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GAMEPADUI_INTERFACE_H
|
#endif // GAMEPADUI_INTERFACE_H
|
||||||
|
0
game/gamepadui/gamepadui_loadingscreen.cpp
Normal file
0
game/gamepadui/gamepadui_loadingscreen.cpp
Normal file
0
game/gamepadui/gamepadui_loadingscreen.h
Normal file
0
game/gamepadui/gamepadui_loadingscreen.h
Normal file
@ -2,6 +2,8 @@
|
|||||||
#include "gamepadui_basepanel.h"
|
#include "gamepadui_basepanel.h"
|
||||||
#include "gamepadui_mainmenu.h"
|
#include "gamepadui_mainmenu.h"
|
||||||
|
|
||||||
|
//#include "..\client\cdll_client_int.h"
|
||||||
|
|
||||||
#include "vgui/ISurface.h"
|
#include "vgui/ISurface.h"
|
||||||
#include "vgui/ILocalize.h"
|
#include "vgui/ILocalize.h"
|
||||||
#include "vgui/IVGui.h"
|
#include "vgui/IVGui.h"
|
||||||
@ -19,7 +21,37 @@ ConVar gamepadui_show_ez2_version( "gamepadui_show_ez2_version", "1", FCVAR_NONE
|
|||||||
ConVar gamepadui_show_old_ui_button( "gamepadui_show_old_ui_button", "1", FCVAR_NONE, "Show button explaining how to switch to the old UI (Changes may not take effect until changing level)" );
|
ConVar gamepadui_show_old_ui_button( "gamepadui_show_old_ui_button", "1", FCVAR_NONE, "Show button explaining how to switch to the old UI (Changes may not take effect until changing level)" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GamepadUIMainMenu::GamepadUIMainMenu( vgui::Panel* pParent )
|
#define BUTTONS_DEVIDE_SIZE 2
|
||||||
|
|
||||||
|
float m_flButtonsRealOffsetX = -500;
|
||||||
|
float m_flButtonsRealAlpha = 0;
|
||||||
|
int m_flButtonsAlpha = 255;
|
||||||
|
|
||||||
|
float m_flLogoRealOffsetX = -500;
|
||||||
|
int m_flLogoAlpha = 255;
|
||||||
|
|
||||||
|
bool ResetFade = false;
|
||||||
|
|
||||||
|
int LogoSizeX, LogoSizeY;
|
||||||
|
|
||||||
|
int nMaxLogosW = 0, nTotalLogosH = 0;
|
||||||
|
|
||||||
|
float TimeDelta = 0;
|
||||||
|
float LastTime = 0;
|
||||||
|
|
||||||
|
float TimeDeltaLogo = 0;
|
||||||
|
float LastTimeLogo = 0;
|
||||||
|
|
||||||
|
float curtime = 0;
|
||||||
|
|
||||||
|
void CC_ResetFade()
|
||||||
|
{
|
||||||
|
ResetFade = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConCommand gamepadui_resetfade("gamepadui_resetfade", CC_ResetFade);
|
||||||
|
|
||||||
|
GamepadUIMainMenu::GamepadUIMainMenu( vgui::Panel* pParent )
|
||||||
: BaseClass( pParent, "MainMenu" )
|
: BaseClass( pParent, "MainMenu" )
|
||||||
{
|
{
|
||||||
vgui::HScheme hScheme = vgui::scheme()->LoadSchemeFromFileEx( GamepadUI::GetInstance().GetSizingVPanel(), GAMEPADUI_MAINMENU_SCHEME, "SchemeMainMenu" );
|
vgui::HScheme hScheme = vgui::scheme()->LoadSchemeFromFileEx( GamepadUI::GetInstance().GetSizingVPanel(), GAMEPADUI_MAINMENU_SCHEME, "SchemeMainMenu" );
|
||||||
@ -30,14 +62,17 @@ GamepadUIMainMenu::GamepadUIMainMenu( vgui::Panel* pParent )
|
|||||||
{
|
{
|
||||||
if ( pModData->LoadFromFile( g_pFullFileSystem, "gameinfo.txt" ) )
|
if ( pModData->LoadFromFile( g_pFullFileSystem, "gameinfo.txt" ) )
|
||||||
{
|
{
|
||||||
m_LogoText[ 0 ] = pModData->GetString( "gamepadui_title", pModData->GetString( "title" ) );
|
m_LogoText[ 0 ].SetText(pModData->GetString( "gamepadui_title", pModData->GetString( "title" ) ) );
|
||||||
m_LogoText[ 1 ] = pModData->GetString( "gamepadui_title2", pModData->GetString( "title2" ) );
|
m_LogoText[ 1 ].SetText(pModData->GetString( "gamepadui_title2", pModData->GetString( "title2" ) ) );
|
||||||
}
|
}
|
||||||
pModData->deleteThis();
|
pModData->deleteThis();
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadMenuButtons();
|
LoadMenuButtons();
|
||||||
|
|
||||||
|
TimeDelta = 0;
|
||||||
|
LastTime = GamepadUI::GetInstance().GetEngineClient()->Time();
|
||||||
|
|
||||||
SetFooterButtons( FooterButtons::Select, FooterButtons::Select );
|
SetFooterButtons( FooterButtons::Select, FooterButtons::Select );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,12 +80,12 @@ void GamepadUIMainMenu::UpdateGradients()
|
|||||||
{
|
{
|
||||||
const float flTime = GamepadUI::GetInstance().GetTime();
|
const float flTime = GamepadUI::GetInstance().GetTime();
|
||||||
GamepadUI::GetInstance().GetGradientHelper()->ResetTargets( flTime );
|
GamepadUI::GetInstance().GetGradientHelper()->ResetTargets( flTime );
|
||||||
#ifdef GAMEPADUI_GAME_EZ2
|
//#if defined(GAMEPADUI_GAME_EZ2) //enabled in city52 as well
|
||||||
// E:Z2 reduces the gradient so that the background map can be more easily seen
|
// E:Z2 reduces the gradient so that the background map can be more easily seen
|
||||||
GamepadUI::GetInstance().GetGradientHelper()->SetTargetGradient( GradientSide::Left, { 1.0f, GamepadUI::GetInstance().IsInBackgroundLevel() ? 0.333f : 0.666f }, flTime );
|
GamepadUI::GetInstance().GetGradientHelper()->SetTargetGradient( GradientSide::Left, { 1.0f, GamepadUI::GetInstance().IsInBackgroundLevel() ? 0 : 0.666f }, flTime );
|
||||||
#else
|
//#else
|
||||||
GamepadUI::GetInstance().GetGradientHelper()->SetTargetGradient( GradientSide::Left, { 1.0f, 0.666f }, flTime );
|
// GamepadUI::GetInstance().GetGradientHelper()->SetTargetGradient( GradientSide::Left, { 1.0f, 0.666f }, flTime );
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
// In case a controller is added mid-game
|
// In case a controller is added mid-game
|
||||||
SetFooterButtons( FooterButtons::Select, FooterButtons::Select );
|
SetFooterButtons( FooterButtons::Select, FooterButtons::Select );
|
||||||
@ -58,6 +93,8 @@ void GamepadUIMainMenu::UpdateGradients()
|
|||||||
|
|
||||||
void GamepadUIMainMenu::LoadMenuButtons()
|
void GamepadUIMainMenu::LoadMenuButtons()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
KeyValues* pDataFile = new KeyValues( "MainMenuScript" );
|
KeyValues* pDataFile = new KeyValues( "MainMenuScript" );
|
||||||
if ( pDataFile )
|
if ( pDataFile )
|
||||||
{
|
{
|
||||||
@ -75,6 +112,8 @@ void GamepadUIMainMenu::LoadMenuButtons()
|
|||||||
pButton->SetPriority( V_atoi( pData->GetString( "priority", "0" ) ) );
|
pButton->SetPriority( V_atoi( pData->GetString( "priority", "0" ) ) );
|
||||||
pButton->SetVisible( true );
|
pButton->SetVisible( true );
|
||||||
|
|
||||||
|
//pButton->SetSize(pButton->GetWide() / BUTTONS_DEVIDE_SIZE , pButton->GetTall() / BUTTONS_DEVIDE_SIZE);
|
||||||
|
|
||||||
const char* pFamily = pData->GetString( "family", "all" );
|
const char* pFamily = pData->GetString( "family", "all" );
|
||||||
if ( !V_strcmp( pFamily, "ingame" ) || !V_strcmp( pFamily, "all" ) )
|
if ( !V_strcmp( pFamily, "ingame" ) || !V_strcmp( pFamily, "all" ) )
|
||||||
m_Buttons[ GamepadUIMenuStates::InGame ].AddToTail( pButton );
|
m_Buttons[ GamepadUIMenuStates::InGame ].AddToTail( pButton );
|
||||||
@ -105,13 +144,36 @@ void GamepadUIMainMenu::ApplySchemeSettings( vgui::IScheme* pScheme )
|
|||||||
{
|
{
|
||||||
BaseClass::ApplySchemeSettings( pScheme );
|
BaseClass::ApplySchemeSettings( pScheme );
|
||||||
|
|
||||||
|
/*float flX, flY;
|
||||||
|
if (GamepadUI::GetInstance().GetScreenRatio(flX, flY))
|
||||||
|
{
|
||||||
|
m_flButtonsOffsetX *= (flX * flX);
|
||||||
|
}
|
||||||
|
|
||||||
|
int nX, nY;
|
||||||
|
GamepadUI::GetInstance().GetSizingPanelOffset(nX, nY);
|
||||||
|
if (nX > 0)
|
||||||
|
{
|
||||||
|
GamepadUI::GetInstance().GetSizingPanelScale(flX, flY);
|
||||||
|
m_flButtonsOffsetX += ((float)nX) * flX * 0.5f;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int nParentW, nParentH;
|
int nParentW, nParentH;
|
||||||
GetParent()->GetSize( nParentW, nParentH );
|
GetParent()->GetSize( nParentW, nParentH );
|
||||||
SetBounds( 0, 0, nParentW, nParentH );
|
SetBounds( 0, 0, nParentW, nParentH );
|
||||||
|
|
||||||
const char *pImage = pScheme->GetResourceString( "Logo.Image" );
|
const char *pImage = pScheme->GetResourceString( "Logo.Image" );
|
||||||
if ( pImage && *pImage )
|
|
||||||
m_LogoImage.SetImage( pImage );
|
Msg(pImage);
|
||||||
|
|
||||||
|
if (pImage && *pImage)
|
||||||
|
{
|
||||||
|
m_LogoImage.SetImage(pImage);
|
||||||
|
m_LogoImage.GetImageSize(LogoSizeX, LogoSizeY);
|
||||||
|
}
|
||||||
m_hLogoFont = pScheme->GetFont( "Logo.Font", true );
|
m_hLogoFont = pScheme->GetFont( "Logo.Font", true );
|
||||||
|
|
||||||
#ifdef GAMEPADUI_GAME_EZ2
|
#ifdef GAMEPADUI_GAME_EZ2
|
||||||
@ -120,19 +182,86 @@ void GamepadUIMainMenu::ApplySchemeSettings( vgui::IScheme* pScheme )
|
|||||||
ConVarRef ez2_version( "ez2_version" );
|
ConVarRef ez2_version( "ez2_version" );
|
||||||
m_strEZ2Version = ez2_version.GetString();
|
m_strEZ2Version = ez2_version.GetString();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (m_flButtonsStartOffsetX == 0)
|
||||||
|
m_flButtonsRealOffsetX = m_flButtonsStartOffsetX = m_flButtonsOffsetX;
|
||||||
|
else
|
||||||
|
m_flButtonsRealOffsetX = m_flButtonsStartOffsetX;
|
||||||
|
|
||||||
|
m_flButtonsRealAlpha = 0;
|
||||||
|
|
||||||
|
if (m_flLogoStartOffsetX == 0)
|
||||||
|
m_flLogoRealOffsetX = m_flLogoOffsetX;
|
||||||
|
else
|
||||||
|
m_flLogoRealOffsetX = m_flLogoStartOffsetX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LogoID;
|
||||||
|
|
||||||
void GamepadUIMainMenu::LayoutMainMenu()
|
void GamepadUIMainMenu::LayoutMainMenu()
|
||||||
{
|
{
|
||||||
int nY = GetCurrentButtonOffset();
|
int nY = GetCurrentButtonOffset();
|
||||||
CUtlVector<GamepadUIButton*>& currentButtons = GetCurrentButtons();
|
CUtlVector<GamepadUIButton*>& currentButtons = GetCurrentButtons();
|
||||||
|
|
||||||
|
|
||||||
|
//HACK if we have more than 0.7 sec of delay between frames, we possybly lagging
|
||||||
|
if (GamepadUI::GetInstance().GetTime() - LastTime <= 0.7f)
|
||||||
|
TimeDelta = GamepadUI::GetInstance().GetTime() - LastTime;
|
||||||
|
|
||||||
|
curtime += TimeDelta;
|
||||||
|
//curtime = clamp(curtime, 0, m_flButtonsAnimTime);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
for ( GamepadUIButton *pButton : currentButtons )
|
for ( GamepadUIButton *pButton : currentButtons )
|
||||||
{
|
{
|
||||||
|
|
||||||
nY += pButton->GetTall();
|
nY += pButton->GetTall();
|
||||||
pButton->SetPos( m_flButtonsOffsetX, GetTall() - nY );
|
pButton->SetPos( m_flButtonsRealOffsetX, GetTall() - nY );
|
||||||
|
pButton->SetAlpha(m_flButtonsRealAlpha);
|
||||||
|
|
||||||
|
//FIXME ive tried to make this anim seperatly for each button so they whould move next to each other,
|
||||||
|
//but the life planned other plans, so when im subtracting 0.5*i it stopping them at some distance and they dont go all the way.
|
||||||
|
float TdC;
|
||||||
|
|
||||||
|
float func;
|
||||||
|
|
||||||
|
|
||||||
|
if (GetCurrentMenuState() == GamepadUIMenuStates::InGame && !GamepadUI::GetInstance().IsInBackgroundLevel())
|
||||||
|
{
|
||||||
|
TdC = clamp(curtime, 0, m_flButtonsAnimTimeInGame);
|
||||||
|
func = clamp(pow((TdC / m_flButtonsAnimTimeInGame),
|
||||||
|
m_flButtonsAnimPowerInGame) / (pow((TdC / m_flButtonsAnimTimeInGame),
|
||||||
|
m_flButtonsAnimPowerInGame) + pow(1 - (TdC / m_flButtonsAnimTimeInGame),
|
||||||
|
m_flButtonsAnimPowerInGame)), 0, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TdC = clamp(curtime, 0, m_flButtonsAnimTime);
|
||||||
|
func = clamp(pow((TdC / m_flButtonsAnimTime),
|
||||||
|
m_flButtonsAnimPower) / (pow((TdC / m_flButtonsAnimTime),
|
||||||
|
m_flButtonsAnimPower) + pow(1 - (TdC / m_flButtonsAnimTime),
|
||||||
|
m_flButtonsAnimPower)), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_flButtonsRealOffsetX = RemapVal(func, 0, 1, m_flButtonsStartOffsetX, m_flButtonsOffsetX);
|
||||||
|
m_flButtonsRealAlpha = RemapVal(func, 0, 1, 0, m_flButtonsAlpha);
|
||||||
|
|
||||||
|
//pButton->SetPos( m_flButtonsOffsetX, GetTall() - nY );
|
||||||
|
i++;
|
||||||
nY += m_flButtonSpacing;
|
nY += m_flButtonSpacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LastTime = GamepadUI::GetInstance().GetTime();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef GAMEPADUI_GAME_EZ2
|
#ifdef GAMEPADUI_GAME_EZ2
|
||||||
if ( m_pSwitchToOldUIButton && m_pSwitchToOldUIButton->IsVisible() )
|
if ( m_pSwitchToOldUIButton && m_pSwitchToOldUIButton->IsVisible() )
|
||||||
{
|
{
|
||||||
@ -146,7 +275,11 @@ void GamepadUIMainMenu::LayoutMainMenu()
|
|||||||
|
|
||||||
void GamepadUIMainMenu::PaintLogo()
|
void GamepadUIMainMenu::PaintLogo()
|
||||||
{
|
{
|
||||||
vgui::surface()->DrawSetTextColor( m_colLogoColor );
|
#ifdef GAMEPADUI_GAME_HL2 //a little hack to make default hl2 logo be yellow and still be able to change it later in res file
|
||||||
|
vgui::surface()->DrawSetTextColor(m_colLogoNewColor);
|
||||||
|
#else
|
||||||
|
vgui::surface()->DrawSetTextColor(m_colLogoColor);
|
||||||
|
#endif
|
||||||
vgui::surface()->DrawSetTextFont( m_hLogoFont );
|
vgui::surface()->DrawSetTextFont( m_hLogoFont );
|
||||||
|
|
||||||
int nMaxLogosW = 0, nTotalLogosH = 0;
|
int nMaxLogosW = 0, nTotalLogosH = 0;
|
||||||
@ -166,20 +299,54 @@ void GamepadUIMainMenu::PaintLogo()
|
|||||||
if ( m_LogoImage.IsValid() )
|
if ( m_LogoImage.IsValid() )
|
||||||
{
|
{
|
||||||
int nY1 = nLogoY;
|
int nY1 = nLogoY;
|
||||||
int nY2 = nY1 + nLogoH[ 0 ];
|
int nY2 = nY1 + /*nLogoH[0]*/ m_flLogoSizeY;
|
||||||
int nX1 = m_flLogoOffsetX;
|
//int nX1 = m_flLogoOffsetX;
|
||||||
int nX2 = nX1 + ( nLogoH[ 0 ] * 3 );
|
|
||||||
vgui::surface()->DrawSetColor( Color( 255, 255, 255, 255 ) );
|
int nX1 = m_flLogoRealOffsetX;
|
||||||
vgui::surface()->DrawSetTexture( m_LogoImage );
|
int nX2 = nX1 + /*(nLogoH[0] * 3)*/ m_flLogoSizeX;
|
||||||
vgui::surface()->DrawTexturedRect( nX1, nY1, nX2, nY2 );
|
|
||||||
vgui::surface()->DrawSetTexture( 0 );
|
vgui::surface()->DrawSetColor(Color(255, 255, 255, 255));
|
||||||
|
vgui::surface()->DrawSetTexture(m_LogoImage);
|
||||||
|
vgui::surface()->DrawTexturedRect(nX1, nY1, nX2, nY2);
|
||||||
|
vgui::surface()->DrawSetTexture(0);
|
||||||
|
|
||||||
|
//TimeDeltaLogo = GamepadUI::GetInstance().GetTime() - LastTimeLogo;
|
||||||
|
//TimeDeltaLogo = clamp(TimeDeltaLogo, 0.2, 0.5);
|
||||||
|
|
||||||
|
float TdC;
|
||||||
|
|
||||||
|
//m_flLogoRealOffsetX = Lerp<float>(m_flLogoLerp * TimeDeltaLogo, m_flLogoRealOffsetX, m_flLogoOffsetX);
|
||||||
|
float func;
|
||||||
|
|
||||||
|
if (GetCurrentMenuState() == GamepadUIMenuStates::InGame)
|
||||||
|
{
|
||||||
|
TdC = clamp(curtime, 0, m_flLogoAnimTimeInGame);
|
||||||
|
func = clamp(pow((TdC / m_flLogoAnimTimeInGame),
|
||||||
|
m_flLogoAnimPowerInGame) / (pow((TdC / m_flLogoAnimTimeInGame),
|
||||||
|
m_flLogoAnimPowerInGame) + pow(1 - (TdC / m_flLogoAnimTimeInGame),
|
||||||
|
m_flLogoAnimPowerInGame)), 0, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TdC = clamp(curtime, 0, m_flLogoAnimTime);
|
||||||
|
func = clamp(pow((TdC / m_flLogoAnimTime),
|
||||||
|
m_flLogoAnimPower) / (pow((TdC / m_flLogoAnimTime),
|
||||||
|
m_flLogoAnimPower) + pow(1 - (TdC / m_flLogoAnimTime),
|
||||||
|
m_flLogoAnimPower)), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_flLogoRealOffsetX = RemapVal(func, 0, 1, -m_flLogoSizeX, m_flLogoOffsetX);
|
||||||
|
|
||||||
|
//LastTimeLogo = GamepadUI::GetInstance().GetTime();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for ( int i = 1; i >= 0; i-- )
|
for ( int i = 1; i >= 0; i-- )
|
||||||
{
|
{
|
||||||
vgui::surface()->DrawSetTextPos( m_flLogoOffsetX, nLogoY );
|
vgui::surface()->DrawSetTextPos( m_flLogoOffsetX, nLogoY );
|
||||||
vgui::surface()->DrawPrintText( m_LogoText[ i ].String(), m_LogoText[ i ].Length() );
|
int aboba = m_LogoText[i].Length();
|
||||||
|
vgui::surface()->DrawPrintText( m_LogoText[ i ].String(), aboba);
|
||||||
|
|
||||||
nLogoY -= nLogoH[ i ];
|
nLogoY -= nLogoH[ i ];
|
||||||
}
|
}
|
||||||
@ -204,13 +371,35 @@ void GamepadUIMainMenu::OnThink()
|
|||||||
BaseClass::OnThink();
|
BaseClass::OnThink();
|
||||||
|
|
||||||
LayoutMainMenu();
|
LayoutMainMenu();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamepadUIMainMenu::Paint()
|
void GamepadUIMainMenu::Paint()
|
||||||
{
|
{
|
||||||
|
|
||||||
BaseClass::Paint();
|
BaseClass::Paint();
|
||||||
|
|
||||||
|
if (ResetFade)
|
||||||
|
{
|
||||||
|
curtime = 0;
|
||||||
|
|
||||||
|
if (m_flButtonsStartOffsetX == 0)
|
||||||
|
m_flButtonsRealOffsetX = m_flButtonsStartOffsetX = m_flButtonsOffsetX;
|
||||||
|
else
|
||||||
|
m_flButtonsRealOffsetX = m_flButtonsStartOffsetX;
|
||||||
|
|
||||||
|
m_flButtonsRealAlpha = 0;
|
||||||
|
|
||||||
|
if (m_flLogoStartOffsetX == 0)
|
||||||
|
m_flLogoRealOffsetX = m_flLogoOffsetX;
|
||||||
|
else
|
||||||
|
m_flLogoRealOffsetX = m_flLogoStartOffsetX;
|
||||||
|
|
||||||
|
ResetFade = false;
|
||||||
|
}
|
||||||
|
|
||||||
PaintLogo();
|
PaintLogo();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamepadUIMainMenu::OnCommand( char const* pCommand )
|
void GamepadUIMainMenu::OnCommand( char const* pCommand )
|
||||||
@ -252,6 +441,7 @@ void GamepadUIMainMenu::OnMenuStateChanged()
|
|||||||
|
|
||||||
void GamepadUIMainMenu::UpdateButtonVisibility()
|
void GamepadUIMainMenu::UpdateButtonVisibility()
|
||||||
{
|
{
|
||||||
|
|
||||||
for ( CUtlVector<GamepadUIButton*>& buttons : m_Buttons )
|
for ( CUtlVector<GamepadUIButton*>& buttons : m_Buttons )
|
||||||
{
|
{
|
||||||
for ( GamepadUIButton* pButton : buttons )
|
for ( GamepadUIButton* pButton : buttons )
|
||||||
|
@ -18,6 +18,7 @@ namespace GamepadUIMenuStates
|
|||||||
Count
|
Count
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
using GamepadUIMenuState = GamepadUIMenuStates::GamepadUIMenuState;
|
using GamepadUIMenuState = GamepadUIMenuStates::GamepadUIMenuState;
|
||||||
|
|
||||||
class GamepadUIMainMenu : public GamepadUIFrame
|
class GamepadUIMainMenu : public GamepadUIFrame
|
||||||
@ -40,6 +41,7 @@ public:
|
|||||||
void PaintLogo();
|
void PaintLogo();
|
||||||
void OnMenuStateChanged();
|
void OnMenuStateChanged();
|
||||||
|
|
||||||
|
|
||||||
void OnKeyCodeReleased( vgui::KeyCode code );
|
void OnKeyCodeReleased( vgui::KeyCode code );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -62,16 +64,35 @@ private:
|
|||||||
GamepadUIString m_LogoText[ 2 ];
|
GamepadUIString m_LogoText[ 2 ];
|
||||||
GamepadUIImage m_LogoImage;
|
GamepadUIImage m_LogoImage;
|
||||||
|
|
||||||
|
/////// Animation stuff
|
||||||
|
GAMEPADUI_PANEL_PROPERTY(float, m_flButtonsStartOffsetX, "Buttons.OffsetX.Start", "0", SchemeValueTypes::ProportionalFloat);
|
||||||
|
GAMEPADUI_PANEL_PROPERTY(float, m_flButtonsAnimTime, "Buttons.AnimTime", "1", SchemeValueTypes::Float);
|
||||||
|
GAMEPADUI_PANEL_PROPERTY(float, m_flButtonsAnimTimeInGame, "Buttons.AnimTime.InGame", "1", SchemeValueTypes::Float);
|
||||||
|
GAMEPADUI_PANEL_PROPERTY(float, m_flButtonsAnimPower, "Buttons.AnimPower", "1", SchemeValueTypes::Float);
|
||||||
|
GAMEPADUI_PANEL_PROPERTY(float, m_flButtonsAnimPowerInGame, "Buttons.AnimPower.InGame", "1", SchemeValueTypes::Float);
|
||||||
|
|
||||||
|
GAMEPADUI_PANEL_PROPERTY(float, m_flLogoStartOffsetX, "Logo.OffsetX.Start", "0", SchemeValueTypes::ProportionalFloat);
|
||||||
|
GAMEPADUI_PANEL_PROPERTY(float, m_flLogoAnimTime, "Logo.AnimTime", "1", SchemeValueTypes::Float);
|
||||||
|
GAMEPADUI_PANEL_PROPERTY(float, m_flLogoAnimTimeInGame, "Logo.AnimTime.InGame", "1", SchemeValueTypes::Float);
|
||||||
|
GAMEPADUI_PANEL_PROPERTY(float, m_flLogoAnimPower, "Logo.AnimPower", "1", SchemeValueTypes::Float);
|
||||||
|
GAMEPADUI_PANEL_PROPERTY(float, m_flLogoAnimPowerInGame, "Logo.AnimPower.InGame", "1", SchemeValueTypes::Float);
|
||||||
|
///////
|
||||||
|
|
||||||
GAMEPADUI_PANEL_PROPERTY( float, m_flButtonSpacing, "Buttons.Space", "0", SchemeValueTypes::ProportionalFloat );
|
GAMEPADUI_PANEL_PROPERTY( float, m_flButtonSpacing, "Buttons.Space", "0", SchemeValueTypes::ProportionalFloat );
|
||||||
GAMEPADUI_PANEL_PROPERTY( float, m_flButtonsOffsetX, "Buttons.OffsetX", "0", SchemeValueTypes::ProportionalFloat );
|
GAMEPADUI_PANEL_PROPERTY( float, m_flButtonsOffsetX, "Buttons.OffsetX", "0", SchemeValueTypes::ProportionalFloat );
|
||||||
|
|
||||||
GAMEPADUI_PANEL_PROPERTY( float, m_flButtonsOffsetYMenu, "Buttons.OffsetY.MainMenu", "0", SchemeValueTypes::ProportionalFloat );
|
GAMEPADUI_PANEL_PROPERTY( float, m_flButtonsOffsetYMenu, "Buttons.OffsetY.MainMenu", "0", SchemeValueTypes::ProportionalFloat );
|
||||||
GAMEPADUI_PANEL_PROPERTY( float, m_flButtonsOffsetYInGame, "Buttons.OffsetY.InGame", "0", SchemeValueTypes::ProportionalFloat );
|
GAMEPADUI_PANEL_PROPERTY( float, m_flButtonsOffsetYInGame, "Buttons.OffsetY.InGame", "0", SchemeValueTypes::ProportionalFloat );
|
||||||
|
|
||||||
GAMEPADUI_PANEL_PROPERTY( float, m_flLogoOffsetX, "Logo.OffsetX", "0", SchemeValueTypes::ProportionalFloat );
|
GAMEPADUI_PANEL_PROPERTY( float, m_flLogoOffsetX, "Logo.OffsetX", "0", SchemeValueTypes::ProportionalFloat );
|
||||||
|
|
||||||
GAMEPADUI_PANEL_PROPERTY( float, m_flLogoOffsetYMenu, "Logo.OffsetY.MainMenu", "0", SchemeValueTypes::ProportionalFloat );
|
GAMEPADUI_PANEL_PROPERTY( float, m_flLogoOffsetYMenu, "Logo.OffsetY.MainMenu", "0", SchemeValueTypes::ProportionalFloat );
|
||||||
GAMEPADUI_PANEL_PROPERTY( float, m_flLogoOffsetYInGame, "Logo.OffsetY.InGame", "0", SchemeValueTypes::ProportionalFloat );
|
GAMEPADUI_PANEL_PROPERTY( float, m_flLogoOffsetYInGame, "Logo.OffsetY.InGame", "0", SchemeValueTypes::ProportionalFloat );
|
||||||
|
GAMEPADUI_PANEL_PROPERTY(float, m_flLogoSizeX, "Logo.SizeX", "0", SchemeValueTypes::ProportionalFloat);
|
||||||
|
GAMEPADUI_PANEL_PROPERTY(float, m_flLogoSizeY, "Logo.SizeY", "0", SchemeValueTypes::ProportionalFloat);
|
||||||
|
|
||||||
GAMEPADUI_PANEL_PROPERTY( Color, m_colLogoColor, "Logo", "255 255 255 255", SchemeValueTypes::Color );
|
GAMEPADUI_PANEL_PROPERTY( Color, m_colLogoColor, "Logo", "255 255 255 255", SchemeValueTypes::Color );
|
||||||
|
GAMEPADUI_PANEL_PROPERTY( Color, m_colLogoNewColor, "NewLogo", "255 134 44 255", SchemeValueTypes::Color );
|
||||||
|
|
||||||
vgui::HFont m_hLogoFont;
|
vgui::HFont m_hLogoFont;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
|
|
||||||
const int MAX_OPTIONS_TABS = 8;
|
const int MAX_OPTIONS_TABS = 7;
|
||||||
|
|
||||||
#define GAMEPADUI_OPTIONS_FILE GAMEPADUI_RESOURCE_FOLDER "options.res"
|
#define GAMEPADUI_OPTIONS_FILE GAMEPADUI_RESOURCE_FOLDER "options.res"
|
||||||
|
|
||||||
@ -79,7 +79,6 @@ public:
|
|||||||
void ApplySchemeSettings( vgui::IScheme *pScheme ) OVERRIDE;
|
void ApplySchemeSettings( vgui::IScheme *pScheme ) OVERRIDE;
|
||||||
|
|
||||||
void SetOptionDescription( GamepadUIString *pStr ) { m_strOptionDescription = pStr; }
|
void SetOptionDescription( GamepadUIString *pStr ) { m_strOptionDescription = pStr; }
|
||||||
void SetOptionImage( GamepadUIImage *pImg ) { m_pOptionImage = pImg; }
|
|
||||||
|
|
||||||
void SetActiveTab( int nTab );
|
void SetActiveTab( int nTab );
|
||||||
int GetActiveTab();
|
int GetActiveTab();
|
||||||
@ -125,8 +124,6 @@ private:
|
|||||||
|
|
||||||
GamepadUIString *m_strOptionDescription = NULL;
|
GamepadUIString *m_strOptionDescription = NULL;
|
||||||
vgui::HFont m_hDescFont = vgui::INVALID_FONT;
|
vgui::HFont m_hDescFont = vgui::INVALID_FONT;
|
||||||
|
|
||||||
GamepadUIImage *m_pOptionImage = NULL;
|
|
||||||
|
|
||||||
GamepadUIScrollBar *m_pScrollBar;
|
GamepadUIScrollBar *m_pScrollBar;
|
||||||
|
|
||||||
@ -162,15 +159,6 @@ public:
|
|||||||
Assert( GamepadUIOptionsPanel::GetInstance() != NULL );
|
Assert( GamepadUIOptionsPanel::GetInstance() != NULL );
|
||||||
GamepadUIOptionsPanel::GetInstance()->SetOptionDescription( &m_strButtonDescription );
|
GamepadUIOptionsPanel::GetInstance()->SetOptionDescription( &m_strButtonDescription );
|
||||||
m_bDescriptionHide = true;
|
m_bDescriptionHide = true;
|
||||||
|
|
||||||
if (m_OptionImage.IsValid())
|
|
||||||
{
|
|
||||||
GamepadUIOptionsPanel::GetInstance()->SetOptionImage( &m_OptionImage );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GamepadUIOptionsPanel::GetInstance()->SetOptionImage( NULL );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,26 +172,8 @@ public:
|
|||||||
return m_bHorizontal;
|
return m_bHorizontal;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SetOptionImage( const char *pName )
|
|
||||||
{
|
|
||||||
if (pName == NULL)
|
|
||||||
{
|
|
||||||
m_OptionImage.Cleanup();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_OptionImage.SetImage( pName );
|
|
||||||
}
|
|
||||||
|
|
||||||
inline GamepadUIImage &GetOptionImage()
|
|
||||||
{
|
|
||||||
return m_OptionImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_bHorizontal = false;
|
bool m_bHorizontal = false;
|
||||||
|
|
||||||
GamepadUIImage m_OptionImage;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class GamepadUIHeaderButton : public GamepadUIOptionButton
|
class GamepadUIHeaderButton : public GamepadUIOptionButton
|
||||||
@ -1628,8 +1598,8 @@ void GamepadUIOptionsPanel::Paint()
|
|||||||
if ( m_rightGlyph.SetupGlyph( nGlyphSize, "menu_rb", true ) )
|
if ( m_rightGlyph.SetupGlyph( nGlyphSize, "menu_rb", true ) )
|
||||||
m_rightGlyph.PaintGlyph( nLastTabX + nGlyphOffsetX, m_flTabsOffsetY + nGlyphOffsetY / 2, nGlyphSize, 255 );
|
m_rightGlyph.PaintGlyph( nLastTabX + nGlyphOffsetX, m_flTabsOffsetY + nGlyphOffsetY / 2, nGlyphSize, 255 );
|
||||||
|
|
||||||
// Draw description/image
|
// Draw description
|
||||||
if (m_strOptionDescription != NULL || m_pOptionImage != NULL)
|
if (m_strOptionDescription != NULL)
|
||||||
{
|
{
|
||||||
int nParentW, nParentH;
|
int nParentW, nParentH;
|
||||||
GetParent()->GetSize( nParentW, nParentH );
|
GetParent()->GetSize( nParentW, nParentH );
|
||||||
@ -1637,34 +1607,13 @@ void GamepadUIOptionsPanel::Paint()
|
|||||||
float flX = m_flFooterButtonsOffsetX + m_nFooterButtonWidth + m_flFooterButtonsSpacing;
|
float flX = m_flFooterButtonsOffsetX + m_nFooterButtonWidth + m_flFooterButtonsSpacing;
|
||||||
float flY = nParentH - m_flFooterButtonsOffsetY - m_nFooterButtonHeight;
|
float flY = nParentH - m_flFooterButtonsOffsetY - m_nFooterButtonHeight;
|
||||||
|
|
||||||
|
vgui::surface()->DrawSetTextColor( Color( 255, 255, 255, 255 ) );
|
||||||
|
vgui::surface()->DrawSetTextFont( m_hDescFont );
|
||||||
|
vgui::surface()->DrawSetTextPos( flX, flY );
|
||||||
|
|
||||||
int nMaxWidth = nParentW - flX - (m_flFooterButtonsOffsetX + m_nFooterButtonWidth + m_flFooterButtonsSpacing);
|
int nMaxWidth = nParentW - flX - (m_flFooterButtonsOffsetX + m_nFooterButtonWidth + m_flFooterButtonsSpacing);
|
||||||
|
|
||||||
if (m_pOptionImage != NULL)
|
|
||||||
{
|
|
||||||
int wide, tall;
|
|
||||||
vgui::surface()->DrawGetTextureSize( *m_pOptionImage, wide, tall );
|
|
||||||
|
|
||||||
// TODO: More defined/controllable dimensions?
|
DrawPrintWrappedText( m_hDescFont, flX, flY, m_strOptionDescription->String(), m_strOptionDescription->Length(), nMaxWidth, true );
|
||||||
wide = (wide/tall) * m_nFooterButtonHeight * 3;
|
|
||||||
tall = m_nFooterButtonHeight * 3;
|
|
||||||
nMaxWidth -= wide;
|
|
||||||
|
|
||||||
vgui::surface()->DrawSetTexture( *m_pOptionImage );
|
|
||||||
vgui::surface()->DrawSetColor( Color( 255, 255, 255, 255 ) );
|
|
||||||
vgui::surface()->DrawTexturedRect( flX + nMaxWidth, flY, flX + nMaxWidth + wide, flY + tall );
|
|
||||||
|
|
||||||
// Minor spacing
|
|
||||||
nMaxWidth -= 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_strOptionDescription != NULL)
|
|
||||||
{
|
|
||||||
vgui::surface()->DrawSetTextColor( Color( 255, 255, 255, 255 ) );
|
|
||||||
vgui::surface()->DrawSetTextFont( m_hDescFont );
|
|
||||||
vgui::surface()->DrawSetTextPos( flX, flY );
|
|
||||||
|
|
||||||
DrawPrintWrappedText( m_hDescFont, flX, flY, m_strOptionDescription->String(), m_strOptionDescription->Length(), nMaxWidth, true );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2391,7 +2340,6 @@ void GamepadUIOptionsPanel::LoadOptionTabs( const char *pszOptionsFile )
|
|||||||
pItemData->GetString( "text", "" ), pItemData->GetString( "description", "" ) );
|
pItemData->GetString( "text", "" ), pItemData->GetString( "description", "" ) );
|
||||||
button->SetToDefault();
|
button->SetToDefault();
|
||||||
button->SetMouseStep( pItemData->GetFloat( "mouse_step", flStep ) );
|
button->SetMouseStep( pItemData->GetFloat( "mouse_step", flStep ) );
|
||||||
button->SetOptionImage( pItemData->GetString( "image", NULL ) );
|
|
||||||
m_Tabs[ m_nTabCount ].pButtons.AddToTail( button );
|
m_Tabs[ m_nTabCount ].pButtons.AddToTail( button );
|
||||||
}
|
}
|
||||||
else if ( !V_strcmp( pItemType, "headeryheader" ) )
|
else if ( !V_strcmp( pItemType, "headeryheader" ) )
|
||||||
@ -2498,7 +2446,6 @@ void GamepadUIOptionsPanel::LoadOptionTabs( const char *pszOptionsFile )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
button->SetToDefault();
|
button->SetToDefault();
|
||||||
button->SetOptionImage( pItemData->GetString( "image", NULL ) );
|
|
||||||
|
|
||||||
// Values which require confirmation before changing
|
// Values which require confirmation before changing
|
||||||
KeyValues *pConfirm = pItemData->FindKey( "confirm" );
|
KeyValues *pConfirm = pItemData->FindKey( "confirm" );
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gamepadui_interface.h"
|
#include "gamepadui_interface.h"
|
||||||
#include "vgui_controls/Panel.h"
|
#include "../../public/vgui_controls/Panel.h"
|
||||||
|
|
||||||
// There are a lot of really sucky macros in here
|
// There are a lot of really sucky macros in here
|
||||||
// solely because VGUI base class stuff completely
|
// solely because VGUI base class stuff completely
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
SetText( pszText, nLength );
|
SetText( pszText, nLength );
|
||||||
}
|
}
|
||||||
|
|
||||||
const wchar_t *String() const
|
const wchar_t*String() const
|
||||||
{
|
{
|
||||||
if ( m_ManagedText.Count() )
|
if ( m_ManagedText.Count() )
|
||||||
return m_ManagedText.Base();
|
return m_ManagedText.Base();
|
||||||
@ -42,7 +42,7 @@ public:
|
|||||||
int Length() const
|
int Length() const
|
||||||
{
|
{
|
||||||
if ( m_ManagedText.Count() )
|
if ( m_ManagedText.Count() )
|
||||||
return m_ManagedText.Count() - 1;
|
return m_ManagedText.Count()-1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -103,9 +103,10 @@ public:
|
|||||||
memset( szUnicode, 0, sizeof( wchar_t ) * 4096 );
|
memset( szUnicode, 0, sizeof( wchar_t ) * 4096 );
|
||||||
|
|
||||||
V_UTF8ToUnicode( pszText, szUnicode, sizeof( szUnicode ) );
|
V_UTF8ToUnicode( pszText, szUnicode, sizeof( szUnicode ) );
|
||||||
int nChars = V_strlen(pszText);
|
|
||||||
|
int nChars = V_strlen(pszText);
|
||||||
if ( nChars > 1 )
|
if ( nChars > 1 )
|
||||||
SetText( szUnicode, nChars - 1 );
|
SetText( szUnicode, nChars );
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
CCopyableUtlVector< wchar_t > m_ManagedText;
|
CCopyableUtlVector< wchar_t > m_ManagedText;
|
||||||
|
@ -23,9 +23,8 @@ public:
|
|||||||
virtual void OnLevelShutdown() = 0;
|
virtual void OnLevelShutdown() = 0;
|
||||||
|
|
||||||
virtual void VidInit() = 0;
|
virtual void VidInit() = 0;
|
||||||
|
|
||||||
#ifdef STEAM_INPUT
|
#ifdef STEAM_INPUT
|
||||||
// TODO: Replace with proper singleton interface in the future
|
//// TODO: Replace with proper singleton interface in the future
|
||||||
virtual void SetSteamInput( ISource2013SteamInput *pSteamInput ) = 0;
|
virtual void SetSteamInput( ISource2013SteamInput *pSteamInput ) = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user