mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +00:00
Add proportionality support for GameUI panels (#35)
* Add proportionality support for GameUI panels * Add Android platform define * Fix button wrong state on fast clicking Co-authored-by: JusicP <slender87844@gmail.com>
This commit is contained in:
+41
-33
@@ -383,39 +383,47 @@ void COptionsSubAudio::RunTestSpeakers()
|
||||
//-----------------------------------------------------------------------------
|
||||
class COptionsSubAudioThirdPartyCreditsDlg : public vgui::Frame
|
||||
{
|
||||
DECLARE_CLASS_SIMPLE( COptionsSubAudioThirdPartyCreditsDlg, vgui::Frame );
|
||||
DECLARE_CLASS_SIMPLE(COptionsSubAudioThirdPartyCreditsDlg, vgui::Frame);
|
||||
public:
|
||||
COptionsSubAudioThirdPartyCreditsDlg( vgui::VPANEL hParent ) : BaseClass( NULL, NULL )
|
||||
{
|
||||
// parent is ignored, since we want look like we're steal focus from the parent (we'll become modal below)
|
||||
COptionsSubAudioThirdPartyCreditsDlg(vgui::VPANEL hParent) : BaseClass(NULL, NULL)
|
||||
{
|
||||
// parent is ignored, since we want look like we're steal focus from the parent (we'll become modal below)
|
||||
int w = 500;
|
||||
int h = 200;
|
||||
if (ipanel()->IsProportional(hParent))
|
||||
{
|
||||
SetProportional(true);
|
||||
w = scheme()->GetProportionalScaledValueEx(GetScheme(), w);
|
||||
h = scheme()->GetProportionalScaledValueEx(GetScheme(), h);
|
||||
}
|
||||
|
||||
SetTitle("#GameUI_ThirdPartyAudio_Title", true);
|
||||
SetSize( 500, 200 );
|
||||
LoadControlSettings( "resource/OptionsSubAudioThirdPartyDlg.res" );
|
||||
MoveToCenterOfScreen();
|
||||
SetSizeable( false );
|
||||
SetDeleteSelfOnClose( true );
|
||||
}
|
||||
SetTitle("#GameUI_ThirdPartyAudio_Title", true);
|
||||
SetSize(w, h);
|
||||
LoadControlSettings("resource/OptionsSubAudioThirdPartyDlg.res");
|
||||
MoveToCenterOfScreen();
|
||||
SetSizeable(false);
|
||||
SetDeleteSelfOnClose(true);
|
||||
}
|
||||
|
||||
virtual void Activate()
|
||||
{
|
||||
BaseClass::Activate();
|
||||
virtual void Activate()
|
||||
{
|
||||
BaseClass::Activate();
|
||||
|
||||
input()->SetAppModalSurface(GetVPanel());
|
||||
}
|
||||
input()->SetAppModalSurface(GetVPanel());
|
||||
}
|
||||
|
||||
void OnKeyCodeTyped(KeyCode code)
|
||||
{
|
||||
// force ourselves to be closed if the escape key it pressed
|
||||
if (code == KEY_ESCAPE)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseClass::OnKeyCodeTyped(code);
|
||||
}
|
||||
}
|
||||
void OnKeyCodeTyped(KeyCode code)
|
||||
{
|
||||
// force ourselves to be closed if the escape key it pressed
|
||||
if (code == KEY_ESCAPE)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseClass::OnKeyCodeTyped(code);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -424,9 +432,9 @@ public:
|
||||
//-----------------------------------------------------------------------------
|
||||
void COptionsSubAudio::OpenThirdPartySoundCreditsDialog()
|
||||
{
|
||||
if (!m_OptionsSubAudioThirdPartyCreditsDlg.Get())
|
||||
{
|
||||
m_OptionsSubAudioThirdPartyCreditsDlg = new COptionsSubAudioThirdPartyCreditsDlg(GetVParent());
|
||||
}
|
||||
m_OptionsSubAudioThirdPartyCreditsDlg->Activate();
|
||||
if (!m_OptionsSubAudioThirdPartyCreditsDlg.Get())
|
||||
{
|
||||
m_OptionsSubAudioThirdPartyCreditsDlg = new COptionsSubAudioThirdPartyCreditsDlg(GetVParent());
|
||||
}
|
||||
m_OptionsSubAudioThirdPartyCreditsDlg->Activate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user