mirror of
https://github.com/nillerusr/source-engine.git
synced 2024-12-22 06:06:50 +00:00
GameUI: fix propotional scale
This commit is contained in:
parent
23a370d9bb
commit
0772ca1063
@ -696,10 +696,9 @@ void CEngineVGui::Init()
|
||||
COM_TimestampedLog( "Building Panels (staticGameUIPanel)" );
|
||||
|
||||
staticGameUIPanel = new CEnginePanel( staticPanel, "GameUI Panel" );
|
||||
if (IsAndroid() || CommandLine()->CheckParm("-gameuiproportionality"))
|
||||
{
|
||||
|
||||
if(NeedProportional())
|
||||
staticGameUIPanel->SetProportional(true);
|
||||
}
|
||||
|
||||
staticGameUIPanel->SetBounds( 0, 0, videomode->GetModeUIWidth(), videomode->GetModeUIHeight() );
|
||||
staticGameUIPanel->SetPaintBorderEnabled(false);
|
||||
|
@ -242,8 +242,12 @@ public:
|
||||
{
|
||||
BaseClass::ApplySchemeSettings(pScheme);
|
||||
|
||||
int height = atoi(pScheme->GetResourceString("MainMenu.MenuItemHeight"));
|
||||
if( IsProportional() )
|
||||
height = scheme()->GetProportionalScaledValue( height );
|
||||
|
||||
// make fully transparent
|
||||
SetMenuItemHeight(atoi(pScheme->GetResourceString("MainMenu.MenuItemHeight")));
|
||||
SetMenuItemHeight(height);
|
||||
SetBgColor(Color(0, 0, 0, 0));
|
||||
SetBorder(NULL);
|
||||
}
|
||||
@ -292,7 +296,6 @@ public:
|
||||
MenuItem *item = new CGameMenuItem(this, itemName);
|
||||
item->AddActionSignalTarget(target);
|
||||
item->SetCommand(command);
|
||||
item->SetProportional(true);
|
||||
item->SetText(itemText);
|
||||
item->SetUserData(userData);
|
||||
return BaseClass::AddMenuItem(item);
|
||||
@ -303,7 +306,6 @@ public:
|
||||
MenuItem *item = new CGameMenuItem(this, itemName);
|
||||
item->AddActionSignalTarget(target);
|
||||
item->SetCommand(command);
|
||||
item->SetProportional(true);
|
||||
item->SetText(itemText);
|
||||
item->SetUserData(userData);
|
||||
return BaseClass::AddMenuItem(item);
|
||||
@ -659,7 +661,6 @@ void CGameMenu::OnCursorEnteredMenuItem(int VPanel)
|
||||
static CBackgroundMenuButton* CreateMenuButton( CBasePanel *parent, const char *panelName, const wchar_t *panelText )
|
||||
{
|
||||
CBackgroundMenuButton *pButton = new CBackgroundMenuButton( parent, panelName );
|
||||
pButton->SetProportional(true);
|
||||
pButton->SetCommand("OpenGameMenu");
|
||||
pButton->SetText(panelText);
|
||||
|
||||
@ -673,6 +674,9 @@ bool g_bIsCreatingNewGameMenuForPreFetching = false;
|
||||
//-----------------------------------------------------------------------------
|
||||
CBasePanel::CBasePanel() : Panel(NULL, "BaseGameUIPanel")
|
||||
{
|
||||
if( NeedProportional() )
|
||||
SetProportional( true );
|
||||
|
||||
g_pBasePanel = this;
|
||||
m_bLevelLoading = false;
|
||||
m_eBackgroundState = BACKGROUND_INITIAL;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "vgui/KeyCode.h"
|
||||
#include "LoadingDialog.h"
|
||||
#include "IGameUIFuncs.h"
|
||||
#include "tier0/icommandline.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
@ -24,6 +25,7 @@ using namespace vgui;
|
||||
//-----------------------------------------------------------------------------
|
||||
CGameConsoleDialog::CGameConsoleDialog() : BaseClass( NULL, "GameConsole", false )
|
||||
{
|
||||
if( NeedProportional() ) SetProportional(true);
|
||||
AddActionSignalTarget( this );
|
||||
}
|
||||
|
||||
|
@ -203,6 +203,8 @@ void CGameUI::Initialize( CreateInterfaceFn factory )
|
||||
Error( "CGameUI::Initialize() failed to get necessary interfaces\n" );
|
||||
}
|
||||
|
||||
vgui::VPANEL rootpanel = enginevguifuncs->GetPanel( PANEL_GAMEUIDLL );
|
||||
|
||||
// setup base panel
|
||||
staticPanel = new CBasePanel();
|
||||
staticPanel->SetBounds(0, 0, 400, 300 );
|
||||
@ -212,9 +214,7 @@ void CGameUI::Initialize( CreateInterfaceFn factory )
|
||||
staticPanel->SetVisible( true );
|
||||
staticPanel->SetMouseInputEnabled( false );
|
||||
staticPanel->SetKeyBoardInputEnabled( false );
|
||||
|
||||
vgui::VPANEL rootpanel = enginevguifuncs->GetPanel( PANEL_GAMEUIDLL );
|
||||
staticPanel->SetParent( rootpanel );
|
||||
staticPanel->SetParent(rootpanel);
|
||||
}
|
||||
|
||||
void CGameUI::PostInit()
|
||||
@ -1282,4 +1282,4 @@ void CGameUI::SendMainMenuCommand( const char *pszCommand )
|
||||
{
|
||||
pBasePanel->RunMenuCommand( pszCommand );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -362,10 +362,6 @@ void COptionsSubAudio::OnCommand( const char *command )
|
||||
RunTestSpeakers();
|
||||
}
|
||||
}
|
||||
else if ( !stricmp( command, "ShowThirdPartyAudioCredits" ) )
|
||||
{
|
||||
OpenThirdPartySoundCreditsDialog();
|
||||
}
|
||||
|
||||
BaseClass::OnCommand( command );
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <vstdlib/IKeyValuesSystem.h>
|
||||
#include "tier2/tier2.h"
|
||||
#include "inputsystem/iinputsystem.h"
|
||||
#include "tier0/icommandline.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
@ -760,8 +761,15 @@ public:
|
||||
{
|
||||
// parent is ignored, since we want look like we're steal focus from the parent (we'll become modal below)
|
||||
|
||||
if( NeedProportional() )
|
||||
SetProportional(true);
|
||||
|
||||
SetTitle("#GameUI_KeyboardAdvanced_Title", true);
|
||||
SetSize( 280, 140 );
|
||||
if( IsProportional() )
|
||||
SetSize( scheme()->GetProportionalScaledValue( 280 ), scheme()->GetProportionalScaledValue( 140 ) );
|
||||
else
|
||||
SetSize( 280, 140 );
|
||||
|
||||
LoadControlSettings( "resource/OptionsSubKeyboardAdvancedDlg.res" );
|
||||
MoveToCenterOfScreen();
|
||||
SetSizeable( false );
|
||||
|
@ -1030,7 +1030,8 @@ COptionsSubVideo::COptionsSubVideo(vgui::Panel *parent) : PropertyPage(parent, N
|
||||
m_pBenchmark = new Button( this, "BenchmarkButton", "#GameUI_LaunchBenchmark" );
|
||||
m_pBenchmark->SetCommand(new KeyValues("LaunchBenchmark"));
|
||||
m_pThirdPartyCredits = new URLButton(this, "ThirdPartyVideoCredits", "#GameUI_ThirdPartyTechCredits");
|
||||
m_pThirdPartyCredits->SetCommand(new KeyValues("OpenThirdPartyVideoCreditsDialog"));
|
||||
// m_pThirdPartyCredits->SetCommand(new KeyValues("OpenThirdPartyVideoCreditsDialog"));
|
||||
m_pThirdPartyCredits->SetVisible(false);
|
||||
m_pHDContent = new CheckButton( this, "HDContentButton", "#GameUI_HDContent" );
|
||||
|
||||
char pszAspectName[3][64];
|
||||
|
@ -366,7 +366,12 @@ void CAchievementsDialog_XBox::OnClose()
|
||||
CAchievementsDialog::CAchievementsDialog(vgui::Panel *parent) : BaseClass(parent, "AchievementsDialog")
|
||||
{
|
||||
SetDeleteSelfOnClose(true);
|
||||
SetBounds(0, 0, 512, 384);
|
||||
|
||||
if( IsProportional() )
|
||||
SetBounds(0, 0, scheme()->GetProportionalScaledValue(512), scheme()->GetProportionalScaledValue(384));
|
||||
else
|
||||
SetBounds(0, 0, 512, 384);
|
||||
|
||||
SetMinimumSize( 256, 300 );
|
||||
SetSizeable( true );
|
||||
|
||||
@ -506,7 +511,8 @@ void CAchievementsDialog::CreateNewAchievementGroup( int iMinRange, int iMaxRang
|
||||
//----------------------------------------------------------
|
||||
void CAchievementsDialog::ApplySettings( KeyValues *pResourceData )
|
||||
{
|
||||
m_iFixedWidth = pResourceData->GetInt( "wide", 512 );
|
||||
int width = pResourceData->GetInt( "wide", 512 );
|
||||
m_iFixedWidth = IsProportional() ? scheme()->GetProportionalScaledValue(width) : width;
|
||||
|
||||
BaseClass::ApplySettings( pResourceData );
|
||||
}
|
||||
@ -1073,3 +1079,4 @@ void CAchievementDialogItemPanel::OnCheckButtonChecked(Panel *panel)
|
||||
m_pSourceAchievement->SetShowOnHUD( m_pShowOnHUDCheck->IsSelected() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
#define null 0L
|
||||
|
||||
#define NeedProportional() (IsAndroid() || CommandLine()->CheckParm("-gameuiproportionality"))
|
||||
|
||||
#ifndef NULL
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0
|
||||
|
@ -226,7 +226,6 @@ KeyBindingMap_t::~KeyBindingMap_t()
|
||||
class CKeyBindingsMgr
|
||||
{
|
||||
public:
|
||||
|
||||
CKeyBindingsMgr() :
|
||||
m_Bindings( 0, 0, KeyBindingContextHandleLessFunc ),
|
||||
m_nKeyBindingContexts( 0 )
|
||||
@ -1450,8 +1449,10 @@ void Panel::SetParent(Panel *newParent)
|
||||
//-----------------------------------------------------------------------------
|
||||
void Panel::SetParent(VPANEL newParent)
|
||||
{
|
||||
|
||||
if (newParent)
|
||||
{
|
||||
|
||||
ipanel()->SetParent(GetVPanel(), newParent);
|
||||
}
|
||||
else
|
||||
@ -1459,19 +1460,19 @@ void Panel::SetParent(VPANEL newParent)
|
||||
ipanel()->SetParent(GetVPanel(), NULL);
|
||||
}
|
||||
|
||||
if (GetVParent() && !IsPopup())
|
||||
if (GetVParent() )
|
||||
{
|
||||
SetProportional(ipanel()->IsProportional(GetVParent()));
|
||||
if( ipanel()->IsProportional(GetVParent()) )
|
||||
SetProportional(true);
|
||||
|
||||
// most of the time KBInput == parents kbinput
|
||||
if (ipanel()->IsKeyBoardInputEnabled(GetVParent()) != IsKeyBoardInputEnabled())
|
||||
if( IsPopup() )
|
||||
{
|
||||
SetKeyBoardInputEnabled(ipanel()->IsKeyBoardInputEnabled(GetVParent()));
|
||||
}
|
||||
// most of the time KBInput == parents kbinput
|
||||
if (ipanel()->IsKeyBoardInputEnabled(GetVParent()) != IsKeyBoardInputEnabled())
|
||||
SetKeyBoardInputEnabled(ipanel()->IsKeyBoardInputEnabled(GetVParent()));
|
||||
|
||||
if (ipanel()->IsMouseInputEnabled(GetVParent()) != IsMouseInputEnabled())
|
||||
{
|
||||
SetMouseInputEnabled(ipanel()->IsMouseInputEnabled(GetVParent()));
|
||||
if (ipanel()->IsMouseInputEnabled(GetVParent()) != IsMouseInputEnabled())
|
||||
SetMouseInputEnabled(ipanel()->IsMouseInputEnabled(GetVParent()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,6 +149,8 @@ ScrollBar::ScrollBar(Panel *parent, const char *panelName, bool vertical) : Pane
|
||||
m_pOverriddenButtons[0] = NULL;
|
||||
m_pOverriddenButtons[1] = NULL;
|
||||
|
||||
int width = IsProportional() ? scheme()->GetProportionalScaledValue(SCROLLBAR_DEFAULT_WIDTH) : SCROLLBAR_DEFAULT_WIDTH;
|
||||
|
||||
if (vertical)
|
||||
{
|
||||
// FIXME: proportional changes needed???
|
||||
@ -158,7 +160,7 @@ ScrollBar::ScrollBar(Panel *parent, const char *panelName, bool vertical) : Pane
|
||||
_button[0]->SetTextInset(0, 1);
|
||||
_button[1]->SetTextInset(0, -1);
|
||||
|
||||
SetSize(SCROLLBAR_DEFAULT_WIDTH, 64);
|
||||
SetSize(width, 64);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -168,7 +170,7 @@ ScrollBar::ScrollBar(Panel *parent, const char *panelName, bool vertical) : Pane
|
||||
_button[0]->SetTextInset(0, 0);
|
||||
_button[1]->SetTextInset(0, 0);
|
||||
|
||||
SetSize(64, SCROLLBAR_DEFAULT_WIDTH);
|
||||
SetSize(64, width);
|
||||
}
|
||||
|
||||
Panel::SetPaintBorderEnabled(true);
|
||||
|
@ -230,7 +230,6 @@ void Slider::SetInverted( bool bInverted )
|
||||
m_bInverted = bInverted;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Send a message to interested parties when the slider moves
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -386,9 +385,9 @@ void Slider::GetTrackRect( int& x, int& y, int& w, int& h )
|
||||
GetPaintSize( wide, tall );
|
||||
|
||||
x = 0;
|
||||
y = 8;
|
||||
y = IsProportional() ? scheme()->GetProportionalScaledValue( 8.f ) : 8;;
|
||||
w = wide - (int)_nobSize;
|
||||
h = 4;
|
||||
h = IsProportional() ? scheme()->GetProportionalScaledValue( 4.f ) : 4;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -524,7 +523,7 @@ void Slider::DrawNob()
|
||||
#endif
|
||||
surface()->DrawSetColor(col);
|
||||
|
||||
int nobheight = 16;
|
||||
int nobheight = IsProportional() ? scheme()->GetProportionalScaledValue( 16.f ) : 16.f;
|
||||
|
||||
surface()->DrawFilledRect(
|
||||
_nobPos[0],
|
||||
@ -941,7 +940,7 @@ void Slider::SetButtonOffset(int buttonOffset)
|
||||
|
||||
void Slider::SetThumbWidth( int width )
|
||||
{
|
||||
_nobSize = (float)width;
|
||||
_nobSize = IsProportional() ? scheme()->GetProportionalScaledValue( (float)width) : (float)width;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user