From 9cc3539f6d1ae61114b3d7f01a4599996aa1076a Mon Sep 17 00:00:00 2001 From: Er2 Date: Sun, 20 Aug 2023 14:17:00 +0300 Subject: [PATCH] add mobile definitions --- game/client/touch.cpp | 2 +- gameui/OptionsDialog.cpp | 6 +++--- public/tier0/platform.h | 7 +++++++ serverbrowser/BaseGamesPage.cpp | 2 +- wscript | 5 +++++ 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/game/client/touch.cpp b/game/client/touch.cpp index 2d71646b..04410179 100644 --- a/game/client/touch.cpp +++ b/game/client/touch.cpp @@ -23,7 +23,7 @@ extern ConVar default_fov; extern IMatSystemSurface *g_pMatSystemSurface; -#ifdef ANDROID +#ifdef PLATFORM_MOBILE #define TOUCH_DEFAULT "1" #else #define TOUCH_DEFAULT "0" diff --git a/gameui/OptionsDialog.cpp b/gameui/OptionsDialog.cpp index 6ecdbe27..c780751e 100644 --- a/gameui/OptionsDialog.cpp +++ b/gameui/OptionsDialog.cpp @@ -87,9 +87,9 @@ COptionsDialog::COptionsDialog(vgui::Panel *parent) : PropertyDialog(parent, "Op AddPage(new COptionsSubKeyboard(this), "#GameUI_Keyboard"); AddPage(new COptionsSubMouse(this), "#GameUI_Mouse"); -#ifdef ANDROID - AddPage(new COptionsSubTouch(this), "Touch"); -#endif + // Requires additional res file from extras_dir.vpk + if (IsMobile()) + AddPage(new COptionsSubTouch(this), "Touch"); m_pOptionsSubAudio = new COptionsSubAudio(this); AddPage(m_pOptionsSubAudio, "#GameUI_Audio"); diff --git a/public/tier0/platform.h b/public/tier0/platform.h index 1b813fa3..fb996c8c 100644 --- a/public/tier0/platform.h +++ b/public/tier0/platform.h @@ -276,6 +276,13 @@ typedef signed char int8; #else #define IsAndroid() false #endif + +#ifdef PLATFORM_MOBILE + #define IsMobile() true +#else + #define IsMobile() false +#endif + // From steam/steamtypes.h // RTime32 // We use this 32 bit time representing real world time. diff --git a/serverbrowser/BaseGamesPage.cpp b/serverbrowser/BaseGamesPage.cpp index d87900c0..e56b8542 100644 --- a/serverbrowser/BaseGamesPage.cpp +++ b/serverbrowser/BaseGamesPage.cpp @@ -582,7 +582,7 @@ void CBaseGamesPage::LoadFilterSettings() m_bFilterNoEmptyServers = filter->GetInt("NoEmpty"); m_bFilterNoPasswordedServers = filter->GetInt("NoPassword"); m_bFilterReplayServers = filter->GetInt("Replay"); - m_pQuickListCheckButton->SetSelected( filter->GetInt( "QuickList", IsAndroid() ) ); + m_pQuickListCheckButton->SetSelected( filter->GetInt( "QuickList", IsMobile() ) ); int secureFilter = filter->GetInt("Secure"); m_pSecureFilter->ActivateItem(secureFilter); diff --git a/wscript b/wscript index 3eb22d6d..e07e697a 100644 --- a/wscript +++ b/wscript @@ -190,6 +190,11 @@ def define_platform(conf): if conf.options.ALLOW64: conf.define('PLATFORM_64BITS', 1) + if (conf.env.DEST_OS == 'android' or + (conf.env.DEST_OS == 'win32' and conf.env.DEST_CPU in ['arm', 'arm64'])): + conf.env.MOBILE = True + conf.env.append_unique('DEFINES', ['PLATFORM_MOBILE=1']) + if conf.env.DEST_OS == 'linux': conf.define('_GLIBCXX_USE_CXX11_ABI',0) conf.env.append_unique('DEFINES', [