From 94f3d97ddf28533b40d48847d7a28ac7e6fa1eac Mon Sep 17 00:00:00 2001 From: def Date: Wed, 10 Apr 2019 19:40:50 +0200 Subject: [PATCH] Remove unmaintained Android code (fixes #1575) --- scripts/AndroidAppSettings.cfg | 247 ------------------ scripts/make_android.sh | 27 -- src/base/detect.h | 6 +- src/base/system.c | 12 +- src/engine/client/backend_sdl.cpp | 35 +-- src/engine/client/client.cpp | 2 +- src/engine/client/input.cpp | 9 - src/engine/shared/config_variables.h | 27 -- src/game/client/components/binds.cpp | 16 -- src/game/client/components/chat.cpp | 43 --- src/game/client/components/controls.cpp | 16 -- src/game/client/components/emoticon.cpp | 4 - src/game/client/components/hud.cpp | 47 ---- src/game/client/components/menus.cpp | 129 --------- src/game/client/components/menus_browser.cpp | 15 -- src/game/client/components/menus_demo.cpp | 33 --- src/game/client/components/menus_ingame.cpp | 32 --- src/game/client/components/menus_settings.cpp | 4 - src/game/client/components/spectator.cpp | 10 - src/game/client/gameclient.cpp | 8 +- src/game/client/ui.cpp | 126 --------- src/game/client/ui.h | 5 - src/game/editor/editor.cpp | 24 -- src/game/editor/editor.h | 8 - src/game/variables.h | 5 - 25 files changed, 9 insertions(+), 881 deletions(-) delete mode 100644 scripts/AndroidAppSettings.cfg delete mode 100644 scripts/make_android.sh diff --git a/scripts/AndroidAppSettings.cfg b/scripts/AndroidAppSettings.cfg deleted file mode 100644 index 47ff2de67..000000000 --- a/scripts/AndroidAppSettings.cfg +++ /dev/null @@ -1,247 +0,0 @@ -# The application settings for Android libSDL port - -# Specify application name (e.x. My Application) -AppName="DDraceNetwork Client" - -# Specify reversed site name of application (e.x. com.mysite.myapp) -AppFullName=tw.ddnet - -# Application version code (integer) -AppVersionCode=0730 - -# Application user-visible version name (string) -AppVersionName="7.3" - -# Specify path to download application data in zip archive in the form 'Description|URL|MirrorURL^Description2|URL2|MirrorURL2^...' -# If you'll start Description with '!' symbol it will be enabled by default, other downloads should be selected by user from startup config menu -# If the URL in in the form ':dir/file.dat:http://URL/' it will be downloaded as binary BLOB to the application dir and not unzipped -# If the URL does not contain 'http://' it is treated as file from 'project/jni/application/src/AndroidData' dir - -# these files are put inside .apk package by build system -# Also please avoid 'https://' URLs, many Android devices do not have trust certificates and will fail to connect to SF.net over HTTPS -AppDataDownloadUrl="Game data|data.zip" - -# Reset SDL config when updating application to the new version (y) / (n) -ResetSdlConfigForThisVersion=y - -# Delete application data files when upgrading (specify file/dir paths separated by spaces) -DeleteFilesOnUpgrade="%" - -# Here you may type readme text, which will be shown during startup. Format is: -# Text in English, use \\\\n to separate lines (that's four backslashes)^de:Text in Deutsch^ru:Text in Russian^button:Button that will open some URL:http://url-to-open/ -ReadmeText='Tap left joystick to jump' - -# libSDL version to use (1.2/1.3/2.0) -LibSdlVersion=1.2 - -# Specify screen orientation: (v)ertical/(p)ortrait or (h)orizontal/(l)andscape -ScreenOrientation=h - -# Video color depth - 16 BPP is the fastest and supported for all modes, 24 bpp is supported only -# with SwVideoMode=y, SDL_OPENGL mode supports everything. (16)/(24)/(32) -VideoDepthBpp=24 - -# Enable OpenGL depth buffer (needed only for 3-d applications, small speed decrease) (y) or (n) -NeedDepthBuffer=n - -# Enable OpenGL stencil buffer (needed only for 3-d applications, small speed decrease) (y) or (n) -NeedStencilBuffer=n - -# Try to use GLES 2.x context - will revert to GLES 1.X if unsupported by device -# you need this option only if you're developing 3-d app (y) or (n) -NeedGles2=n - -# Application uses software video buffer - you're calling SDL_SetVideoMode() without SDL_HWSURFACE and without SDL_OPENGL, -# this will allow small speed optimization. Enable this even when you're using SDL_HWSURFACE. (y) or (n) -SwVideoMode=n - -# Application video output will be resized to fit into native device screen (y)/(n) -SdlVideoResize=n - -# Application resizing will keep 4:3 aspect ratio, with black bars at sides (y)/(n) -SdlVideoResizeKeepAspect=n - -# Do not allow device to sleep when the application is in foreground, set this for video players or apps which use accelerometer -InhibitSuspend=y - -# Create Android service, so the app is less likely to be killed while in background -CreateService= - -# Application does not call SDL_Flip() or SDL_UpdateRects() appropriately, or draws from non-main thread - -# enabling the compatibility mode will force screen update every 100 milliseconds, which is laggy and inefficient (y) or (n) -CompatibilityHacks=n - -# Application initializes SDL audio/video inside static constructors (which is bad, you won't be able to run ndk-gdb) (y)/(n) -CompatibilityHacksStaticInit=n - -# On-screen Android soft text input emulates hardware keyboard, this will only work with Hackers Keyboard app (y)/(n) -CompatibilityHacksTextInputEmulatesHwKeyboard=n - -# Hack for broken devices: prevent audio chopping, by sleeping a bit after pushing each audio chunk (y)/(n) -CompatibilityHacksPreventAudioChopping=n - -# Hack for broken apps: application ignores audio buffer size returned by SDL (y)/(n) -CompatibilityHacksAppIgnoresAudioBufferSize=n - -# Hack for VCMI: preload additional shared libraries before application start -CompatibilityHacksAdditionalPreloadedSharedLibraries="" - -# Hack for Free Heroes 2, which redraws the screen inside SDL_PumpEvents(): slow and compatible SDL event queue - -# do not use it with accelerometer/gyroscope, or your app may freeze at random (y)/(n) -CompatibilityHacksSlowCompatibleEventQueue=n - -# Save and restore OpenGL state when drawing on-screen keyboard for apps that use SDL_OPENGL -CompatibilityHacksTouchscreenKeyboardSaveRestoreOpenGLState=n - -# Application uses SDL_UpdateRects() properly, and does not draw in any region outside those rects. -# This improves drawing speed, but I know only one application that does that, and it's written by me (y)/(n) -CompatibilityHacksProperUsageOfSDL_UpdateRects= - -# Application uses mouse (y) or (n), this will show mouse emulation dialog to the user -AppUsesMouse=y - -# Application needs two-button mouse, will also enable advanced point-and-click features (y) or (n) -AppNeedsTwoButtonMouse=n - -# Right mouse button can do long-press/drag&drop action, necessary for some games (y) or (n) -# If you disable it, swiping with two fingers will send mouse wheel events -RightMouseButtonLongPress= - -# Show SDL mouse cursor, for applications that do not draw cursor at all (y) or (n) -ShowMouseCursor=n - -# Generate more touch events, by default SDL generates one event per one video frame, this is useful for drawing apps (y) or (n) -GenerateSubframeTouchEvents= - -# Force relative (laptop) mouse movement mode, useful when both on-screen keyboard and mouse are needed (y) or (n) -ForceRelativeMouseMode=n - -# Application needs arrow keys (y) or (n), will show on-screen dpad/joystick (y) or (n) -AppNeedsArrowKeys=n - -# Application needs text input (y) or (n), enables button for text input on screen -AppNeedsTextInput=y - -# Application uses joystick (y) or (n), the on-screen DPAD will be used as joystick 0 axes 0-1 -AppUsesJoystick=y - -# Application uses second on-screen joystick, as SDL joystick 0 axes 2-3 (y)/(n) -AppUsesSecondJoystick=y - -# Application uses third on-screen joystick, as SDL joystick 0 axes 20-21 (y)/(n) -AppUsesThirdJoystick=n - -# Application uses accelerometer (y) or (n), the accelerometer will be used as joystick 1 axes 0-1 and 5-7 -AppUsesAccelerometer=n - -# Application uses gyroscope (y) or (n), the gyroscope will be used as joystick 1 axes 2-4 -AppUsesGyroscope=n - -# Application uses multitouch (y) or (n), multitouch events are passed as SDL_JOYBALLMOTION events for the joystick 0 -AppUsesMultitouch=n - -# Application records audio (it will use any available source, such a s microphone) -# API is defined in file SDL_android.h: int SDL_ANDROID_OpenAudioRecording(SDL_AudioSpec *spec); void SDL_ANDROID_CloseAudioRecording(void); -# This option will add additional permission to Android manifest (y)/(n) -AppRecordsAudio=n - -# Application needs to access SD card. If your data files are bigger than 5 Mb, enable it. (y) / (n) -AccessSdCard= - -# Application needs Internet access. If you disable it, you'll have to bundle all your data files inside .apk (y) / (n) -AccessInternet= - -# Immersive mode - Android will hide on-screen Home/Back keys. Looks bad if you invoke Android keyboard. (y) / (n) -ImmersiveMode=y - -# Application implements Android-specific routines to put to background, and will not draw anything to screen -# between SDL_ACTIVEEVENT lost / gained notifications - you should check for them -# right after SDL_Flip(), if (n) then SDL_Flip() will block till app in background (y) or (n) -# This option is reported to be buggy, sometimes failing to restore video state -NonBlockingSwapBuffers=n - -# Redefine common hardware keys to SDL keysyms -# BACK hardware key is available on all devices, MENU is available on pre-ICS devices, other keys may be absent -# SEARCH and CALL by default return same keycode as DPAD_CENTER - one of those keys is available on most devices -# Use word NO_REMAP if you want to preserve native functionality for certain key (volume keys are 3-rd and 4-th) -# Keys: TOUCHSCREEN (works only when AppUsesMouse=n), DPAD_CENTER/SEARCH, VOLUMEUP, VOLUMEDOWN, MENU, BACK, CAMERA -RedefinedKeys="SPACE RETURN NO_REMAP NO_REMAP" - -# Number of virtual keyboard keys (currently 6 is maximum) -AppTouchscreenKeyboardKeysAmount=6 - -# Redefine on-screen keyboard keys to SDL keysyms - 6 keyboard keys + 4 multitouch gestures (zoom in/out and rotate left/right) -RedefinedKeysScreenKb="RETURN PAGEDOWN PAGEUP TAB F5 F6" - -# Names for on-screen keyboard keys, such as Fire, Jump, Run etc, separated by spaces, they are used in SDL config menu -RedefinedKeysScreenKbNames="Hook Next_weapon Previous_weapon Show_scores Jump Spectate" - -# On-screen keys theme -# 0 = Ultimate Droid by Sean Stieber (green, with gamepad joystick) -# 1 = Simple Theme by Beholder (white, with gamepad joystick) -# 2 = Sun by Sirea (yellow, with round joystick) -# 3 = Keen by Gerstrong (multicolor, with round joystick) -TouchscreenKeysTheme=2 - -# Redefine gamepad keys to SDL keysyms, button order is: -# A B X Y L1 R1 L2 R2 LThumb RThumb -RedefinedKeysGamepad="RETURN PAGEDOWN TAB T SPACE RCTRL RETURN RCTRL SPACE PAGEDOWN" - -# How long to show startup menu button, in msec, 0 to disable startup menu -StartupMenuButtonTimeout=3000 - -# Menu items to hide from startup menu, available menu items: -# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout -HiddenMenuOptions='SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMouse.DisplaySizeConfig' - -# Menu items to show at startup - this is Java code snippet, leave empty for default -# new SettingsMenuMisc.ShowReadme(), (AppUsesMouse \&\& \! ForceRelativeMouseMode \? new SettingsMenuMouse.DisplaySizeConfig(true) : new SettingsMenu.DummyMenu()), new SettingsMenuMisc.OptionalDownloadConfig(true), new SettingsMenuMisc.GyroscopeCalibration() -# Available menu items: -# SettingsMenu.OkButton SettingsMenu.DummyMenu SettingsMenu.MainMenu SettingsMenuMisc.DownloadConfig SettingsMenuMisc.OptionalDownloadConfig SettingsMenuMisc.AudioConfig SettingsMenuMisc.VideoSettingsConfig SettingsMenuMisc.ShowReadme SettingsMenuMisc.GyroscopeCalibration SettingsMenuMisc.ResetToDefaultsConfig SettingsMenuMouse.MouseConfigMainMenu SettingsMenuMouse.DisplaySizeConfig SettingsMenuMouse.LeftClickConfig SettingsMenuMouse.RightClickConfig SettingsMenuMouse.AdditionalMouseConfig SettingsMenuMouse.JoystickMouseConfig SettingsMenuMouse.TouchPressureMeasurementTool SettingsMenuMouse.CalibrateTouchscreenMenu SettingsMenuKeyboard.KeyboardConfigMainMenu SettingsMenuKeyboard.ScreenKeyboardSizeConfig SettingsMenuKeyboard.ScreenKeyboardDrawSizeConfig SettingsMenuKeyboard.ScreenKeyboardThemeConfig SettingsMenuKeyboard.ScreenKeyboardTransparencyConfig SettingsMenuKeyboard.RemapHwKeysConfig SettingsMenuKeyboard.RemapScreenKbConfig SettingsMenuKeyboard.ScreenGesturesConfig SettingsMenuKeyboard.CustomizeScreenKbLayout -FirstStartMenuOptions='' - -# Enable multi-ABI binary, with hardware FPU support - it will also work on old devices, -# but .apk size is 2x bigger (y) / (n) / (x86) / (all) -MultiABI='all' - -# Minimum amount of RAM application requires, in Mb, SDL will print warning to user if it's lower -AppMinimumRAM=0 - -# Optional shared libraries to compile - removing some of them will save space -# MP3 support by libMAD is encumbered by patents and libMAD is GPL-ed -# Available libraries: mad (GPL-ed!) sdl_mixer sdl_image sdl_ttf sdl_net sdl_blitpool sdl_gfx sdl_sound intl xml2 lua jpeg png ogg flac tremor vorbis freetype xerces curl theora fluidsynth lzma lzo2 mikmod openal timidity zzip bzip2 yaml-cpp python boost_date_time boost_filesystem boost_iostreams boost_program_options boost_regex boost_signals boost_system boost_thread glu avcodec avdevice avfilter avformat avresample avutil swscale swresample bzip2 -CompiledLibraries="sdl_image freetype glu ogg opus opusfile curl" - -# Application uses custom build script AndroidBuild.sh instead of Android.mk (y) or (n) -CustomBuildScript=n - -# Additional CFLAGS for application -AppCflags='-O3' - -# Additional LDFLAGS for application -AppLdflags='-lEGL' - -# If application has headers with the same name as system headers, this option tries to fix compiler flags to make it compilable -AppOverlapsSystemHeaders=n - -# Build only following subdirs (empty will build all dirs, ignored with custom script) -AppSubdirsBuild='src/src src/src/base/confusables.c src/src/base/system.c src/src/engine src/src/engine/client src/src/engine/shared src/src/engine/external/pnglite src/src/engine/external/wavpack src/src/engine/external/md5 src/src/engine/external/json-parser/json.cpp src/src/game src/src/game/client/* src/src/game/editor src/src/game/generated/protocol.cpp src/src/game/generated/client_data.cpp' - -# Exclude these files from build -AppBuildExclude='' - -# Application command line parameters, including app name as 0-th param -AppCmdline='' - -# Screen size is used by Google Play to prevent an app to be installed on devices with smaller screens -# Minimum screen size that application supports: (s)mall / (m)edium / (l)arge -MinimumScreenSize=n - -# Your AdMob Publisher ID, (n) if you don't want advertisements -AdmobPublisherId=n - -# Your AdMob test device ID, to receive a test ad -AdmobTestDeviceId= - -# Your AdMob banner size (BANNER/IAB_BANNER/IAB_LEADERBOARD/IAB_MRECT/IAB_WIDE_SKYSCRAPER/SMART_BANNER) -AdmobBannerSize= - diff --git a/scripts/make_android.sh b/scripts/make_android.sh deleted file mode 100644 index 5da957a32..000000000 --- a/scripts/make_android.sh +++ /dev/null @@ -1,27 +0,0 @@ -# This is how I build DDNet for Android: - -# Cloning the building repo with the SDL port for Android by Pelya -cd /media -git clone https://github.com/pelya/commandergenius.git - -# Get the most recent DDNet source -cd /media/commandergenius/project/jni/application/teeworlds -rm -rf src master.zip* -wget "https://github.com/ddnet/ddnet/archive/master.zip" -unzip ddnet-master.zip -mv ddnet-master src -mkdir src/src/game/generated -# Also the generated files don't get generated, copy them by hand -cp /media/ddrace/src/game/generated/* src/src/game/generated -rm -rf AndroidData -./AndroidPreBuild.sh - -# Actual compilation, needs a key to sign -cd /media/commandergenius -ln -s teeworlds project/jni/application/src -./changeAppSettings.sh -a -android update project -p project -./build.sh -jarsigner -verbose -keystore ~/.android/release.keystore -storepass MYSECRETPASS -sigalg MD5withRSA -digestalg SHA1 project/bin/MainActivity-release-unsigned.apk androidreleasekey -zipalign 4 project/bin/MainActivity-release-unsigned.apk project/bin/MainActivity-release.apk -scp project/bin/MainActivity-release.apk ddnet:/var/www/downloads/DDNet-$VERSION.apk diff --git a/src/base/detect.h b/src/base/detect.h index 460849365..65b69764f 100644 --- a/src/base/detect.h +++ b/src/base/detect.h @@ -50,11 +50,7 @@ #define CONF_FAMILY_UNIX 1 #define CONF_FAMILY_STRING "unix" #define CONF_PLATFORM_LINUX 1 - #if defined(__ANDROID__) - #define CONF_PLATFORM_STRING "android" - #else - #define CONF_PLATFORM_STRING "linux" - #endif + #define CONF_PLATFORM_STRING "linux" #endif #if defined(__GNU__) || defined(__gnu__) diff --git a/src/base/system.c b/src/base/system.c index 5d51399d8..140db6421 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -43,10 +43,6 @@ #include #endif - #if defined(__ANDROID__) - #include - #endif - #elif defined(CONF_FAMILY_WINDOWS) #define WIN32_LEAN_AND_MEAN #undef _WIN32_WINNT @@ -145,16 +141,12 @@ void dbg_msg(const char *sys, const char *fmt, ...) loggers[i].logger(str, loggers[i].user); } -#if defined(CONF_FAMILY_WINDOWS) || defined(__ANDROID__) +#if defined(CONF_FAMILY_WINDOWS) static void logger_debugger(const char *line, void *user) { (void)user; -#if defined(CONF_FAMILY_WINDOWS) OutputDebugString(line); OutputDebugString("\n"); -#elif defined(__ANDROID__) - __android_log_print(ANDROID_LOG_INFO, "DDNet", "%s", line); -#endif } #endif @@ -250,7 +242,7 @@ void dbg_logger_stdout() void dbg_logger_debugger() { -#if defined(CONF_FAMILY_WINDOWS) || defined(__ANDROID__) +#if defined(CONF_FAMILY_WINDOWS) dbg_logger(logger_debugger, 0, 0); #endif } diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp index c453490f6..12081a4c4 100644 --- a/src/engine/client/backend_sdl.cpp +++ b/src/engine/client/backend_sdl.cpp @@ -15,20 +15,11 @@ #include #include "SDL.h" #include "SDL_syswm.h" -#if defined(__ANDROID__) - #define GL_GLEXT_PROTOTYPES - #include - #include - #include - #define glOrtho glOrthof +#if defined(CONF_PLATFORM_MACOSX) +#include "OpenGL/glu.h" #else - - #if defined(CONF_PLATFORM_MACOSX) - #include "OpenGL/glu.h" - #else - #include "SDL_opengl.h" - #include "GL/glu.h" - #endif +#include "SDL_opengl.h" +#include "GL/glu.h" #endif #if defined(SDL_VIDEO_DRIVER_X11) @@ -329,9 +320,6 @@ void CCommandProcessorFragment_OpenGL::Cmd_Texture_Create(const CCommandBuffer:: int Oglformat = TexFormatToOpenGLFormat(pCommand->m_Format); int StoreOglformat = TexFormatToOpenGLFormat(pCommand->m_StoreFormat); -#if defined(__ANDROID__) - StoreOglformat = Oglformat; -#else if(pCommand->m_Flags&CCommandBuffer::TEXFLAG_COMPRESSED) { switch(StoreOglformat) @@ -342,7 +330,6 @@ void CCommandProcessorFragment_OpenGL::Cmd_Texture_Create(const CCommandBuffer:: default: StoreOglformat = GL_COMPRESSED_RGBA_ARB; } } -#endif glGenTextures(1, &m_aTextures[pCommand->m_Slot].m_Tex); glBindTexture(GL_TEXTURE_2D, m_aTextures[pCommand->m_Slot].m_Tex); @@ -392,12 +379,7 @@ void CCommandProcessorFragment_OpenGL::Cmd_Render(const CCommandBuffer::SCommand switch(pCommand->m_PrimType) { case CCommandBuffer::PRIMTYPE_QUADS: -#if defined(__ANDROID__) - for( unsigned i = 0, j = pCommand->m_PrimCount; i < j; i++ ) - glDrawArrays(GL_TRIANGLE_FAN, i*4, 4); -#else glDrawArrays(GL_QUADS, 0, pCommand->m_PrimCount*4); -#endif break; case CCommandBuffer::PRIMTYPE_LINES: glDrawArrays(GL_LINES, 0, pCommand->m_PrimCount*2); @@ -1123,9 +1105,6 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_Texture_Create(const CCommandBuffe int Oglformat = TexFormatToOpenGLFormat(pCommand->m_Format); int StoreOglformat = TexFormatToOpenGLFormat(pCommand->m_StoreFormat); -#if defined(__ANDROID__) - StoreOglformat = Oglformat; -#else if(pCommand->m_Flags&CCommandBuffer::TEXFLAG_COMPRESSED) { switch(StoreOglformat) @@ -1137,7 +1116,6 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_Texture_Create(const CCommandBuffe default: StoreOglformat = GL_COMPRESSED_RGBA; } } -#endif int Slot = 0; if(m_UseMultipleTextureUnits) { @@ -2315,16 +2293,11 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt *pDesktopHeight = DisplayMode.h; // use desktop resolution as default resolution -#ifdef __ANDROID__ - *pWidth = *pDesktopWidth; - *pHeight = *pDesktopHeight; -#else if(*pWidth == 0 || *pHeight == 0) { *pWidth = *pDesktopWidth; *pHeight = *pDesktopHeight; } -#endif // set flags int SdlFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN | SDL_WINDOW_ALLOW_HIGHDPI; diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index c2397e2b2..4ea003b23 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -3653,7 +3653,7 @@ void CClient::HandleDemoPath(const char *pPath) Upstream latency */ -#if defined(CONF_PLATFORM_MACOSX) || defined(__ANDROID__) +#if defined(CONF_PLATFORM_MACOSX) extern "C" int SDL_main(int argc, char **argv_) // ignore_convention { const char **argv = const_cast(argv_); diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp index 09c92724d..310c6e852 100644 --- a/src/engine/client/input.cpp +++ b/src/engine/client/input.cpp @@ -64,12 +64,6 @@ void CInput::MouseRelative(float *x, float *y) if(!m_MouseFocus || !m_InputGrabbed) return; -#if defined(__ANDROID__) // No relative mouse on Android - int nx = 0, ny = 0; - SDL_GetMouseState(&nx, &ny); - *x = nx; - *y = ny; -#else int nx = 0, ny = 0; float Sens = g_Config.m_InpMousesens / 100.0f; @@ -77,7 +71,6 @@ void CInput::MouseRelative(float *x, float *y) *x = nx*Sens; *y = ny*Sens; -#endif } void CInput::MouseModeAbsolute() @@ -290,8 +283,6 @@ int CInput::Update() case SDL_WINDOWEVENT_RESIZED: #if defined(SDL_VIDEO_DRIVER_X11) Graphics()->Resize(Event.window.data1, Event.window.data2); -#elif defined(__ANDROID__) - m_VideoRestartNeeded = 1; #endif break; case SDL_WINDOWEVENT_FOCUS_GAINED: diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index 00446a380..223fc7b14 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -69,11 +69,7 @@ MACRO_CONFIG_INT(BrDemoSortOrder, br_demo_sort_order, 0, 0, 1, CFGFLAG_SAVE|CFGF MACRO_CONFIG_INT(BrDemoFetchInfo, br_demo_fetch_info, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Whether to auto fetch demo infos on refresh") MACRO_CONFIG_INT(SndBufferSize, snd_buffer_size, 512, 128, 32768, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Sound buffer size") -#if defined(__ANDROID__) -MACRO_CONFIG_INT(SndRate, snd_rate, 44100, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Sound mixing rate") -#else MACRO_CONFIG_INT(SndRate, snd_rate, 48000, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Sound mixing rate") -#endif MACRO_CONFIG_INT(SndEnable, snd_enable, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Sound enable") MACRO_CONFIG_INT(SndMusic, snd_enable_music, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Play background music") MACRO_CONFIG_INT(SndVolume, snd_volume, 100, 0, 100, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Sound volume") @@ -92,44 +88,25 @@ MACRO_CONFIG_INT(SndHighlight, snd_highlight, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIE MACRO_CONFIG_INT(GfxScreen, gfx_screen, 0, 0, 15, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen index") MACRO_CONFIG_INT(GfxScreenWidth, gfx_screen_width, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen resolution width") MACRO_CONFIG_INT(GfxScreenHeight, gfx_screen_height, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen resolution height") -#if defined(__ANDROID__) -MACRO_CONFIG_INT(GfxBorderless, gfx_borderless, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Borderless window (not to be used with fullscreen)") -MACRO_CONFIG_INT(GfxFullscreen, gfx_fullscreen, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Fullscreen") -MACRO_CONFIG_INT(GfxAlphabits, gfx_alphabits, 1, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Alpha bits for framebuffer (fullscreen only)") -#else MACRO_CONFIG_INT(GfxBorderless, gfx_borderless, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Borderless window (not to be used with fullscreen)") MACRO_CONFIG_INT(GfxFullscreen, gfx_fullscreen, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Fullscreen") MACRO_CONFIG_INT(GfxAlphabits, gfx_alphabits, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Alpha bits for framebuffer (fullscreen only)") -#endif MACRO_CONFIG_INT(GfxColorDepth, gfx_color_depth, 24, 16, 24, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Colors bits for framebuffer (fullscreen only)") //MACRO_CONFIG_INT(GfxClear, gfx_clear, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Clear screen before rendering") MACRO_CONFIG_INT(GfxVsync, gfx_vsync, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Vertical sync (may cause delay)") MACRO_CONFIG_INT(GfxResizable, gfx_resizable, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Enables window resizing") MACRO_CONFIG_INT(GfxDisplayAllModes, gfx_display_all_modes, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") MACRO_CONFIG_INT(GfxTextureCompression, gfx_texture_compression, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use texture compression") -#if defined(__ANDROID__) -MACRO_CONFIG_INT(GfxHighDetail, gfx_high_detail, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "High detail") -MACRO_CONFIG_INT(GfxTextureQuality, gfx_texture_quality, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") -#else MACRO_CONFIG_INT(GfxHighDetail, gfx_high_detail, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "High detail") MACRO_CONFIG_INT(GfxTextureQuality, gfx_texture_quality, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") -#endif MACRO_CONFIG_INT(GfxFsaaSamples, gfx_fsaa_samples, 0, 0, 16, CFGFLAG_SAVE|CFGFLAG_CLIENT, "FSAA Samples") MACRO_CONFIG_INT(GfxRefreshRate, gfx_refresh_rate, 0, 0, 10000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen refresh rate") MACRO_CONFIG_INT(GfxFinish, gfx_finish, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "") MACRO_CONFIG_INT(GfxBackgroundRender, gfx_backgroundrender, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Render graphics when window is in background") MACRO_CONFIG_INT(GfxTextOverlay, gfx_text_overlay, 10, 1, 100, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Stop rendering textoverlay in editor or with entities: high value = less details = more speed") -#if defined(__ANDROID__) -MACRO_CONFIG_INT(GfxAsyncRenderOld, gfx_asyncrender_old, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Do rendering async from the the update") -#else MACRO_CONFIG_INT(GfxAsyncRenderOld, gfx_asyncrender_old, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Do rendering async from the the update") -#endif MACRO_CONFIG_INT(GfxTuneOverlay, gfx_tune_overlay, 20, 1, 100, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Stop rendering text overlay in tuning zone in editor: high value = less details = more speed") -#if defined(__ANDROID__) -MACRO_CONFIG_INT(GfxQuadAsTriangle, gfx_quad_as_triangle, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Render quads as triangles (fixes quad coloring on some GPUs)") -#else MACRO_CONFIG_INT(GfxQuadAsTriangle, gfx_quad_as_triangle, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Render quads as triangles (fixes quad coloring on some GPUs)") -#endif MACRO_CONFIG_INT(InpMousesens, inp_mousesens, 200, 1, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Mouse sensitivity") MACRO_CONFIG_INT(InpMouseOld, inp_mouseold, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use old mouse mode (warp mouse instead of raw input)") @@ -394,11 +371,7 @@ MACRO_CONFIG_STR(ClDummyTimeoutCode, cl_dummy_timeout_code, 64, "", CFGFLAG_SAVE MACRO_CONFIG_STR(ClTimeoutSeed, cl_timeout_seed, 64, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Timeout seed") MACRO_CONFIG_STR(ClInputFifo, cl_input_fifo, 128, "", CFGFLAG_SAVE|CFGFLAG_CLIENT, "Fifo file to use as input for client console") MACRO_CONFIG_INT(ClShowConsole, cl_show_console, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Show console window (Windows only)") -#if defined(__ANDROID__) -MACRO_CONFIG_INT(InpJoystick, inp_joystick, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Try to use a joystick as input") -#else MACRO_CONFIG_INT(InpJoystick, inp_joystick, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Try to use a joystick as input") -#endif MACRO_CONFIG_INT(ClConfigVersion, cl_config_version, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SAVE, "The config version. Helps newer clients fix bugs with older configs.") // demo editor diff --git a/src/game/client/components/binds.cpp b/src/game/client/components/binds.cpp index 723ace9a6..23834bc8a 100644 --- a/src/game/client/components/binds.cpp +++ b/src/game/client/components/binds.cpp @@ -124,24 +124,10 @@ void CBinds::SetDefaults() Bind(KEY_MOUSE_1, "+fire"); Bind(KEY_MOUSE_2, "+hook"); Bind(KEY_LSHIFT, "+emote"); -#if defined(__ANDROID__) - Bind(KEY_RCTRL, "+fire"); - Bind(KEY_RETURN, "+hook"); - Bind(KEY_RIGHT, "+right"); - Bind(KEY_LEFT, "+left"); - Bind(KEY_UP, "+jump"); - Bind(KEY_DOWN, "+hook"); - Bind(KEY_PAGEUP, "+prevweapon"); - Bind(KEY_PAGEDOWN, "+nextweapon"); - Bind(KEY_F5, "spectate_previous"); - Bind(KEY_F6, "spectate_next"); -#else Bind(KEY_RETURN, "+show_chat; chat all"); Bind(KEY_RIGHT, "spectate_next"); Bind(KEY_LEFT, "spectate_previous"); Bind(KEY_RSHIFT, "+spectate"); -#endif - Bind(KEY_1, "+weapon1"); Bind(KEY_2, "+weapon2"); @@ -326,10 +312,8 @@ void CBinds::SetDDRaceBinds(bool FreeOnly) Bind(KEY_M, "emote 5", FreeOnly); Bind(KEY_S, "+showhookcoll", FreeOnly); Bind(KEY_X, "toggle cl_dummy 0 1", FreeOnly); -#if !defined(__ANDROID__) Bind(KEY_PAGEDOWN, "toggle cl_show_quads 0 1", FreeOnly); Bind(KEY_PAGEUP, "toggle cl_overlay_entities 0 100", FreeOnly); -#endif Bind(KEY_KP_0, "say /emote normal 999999", FreeOnly); Bind(KEY_KP_1, "say /emote happy 999999", FreeOnly); Bind(KEY_KP_2, "say /emote angry 999999", FreeOnly); diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index 5bb2881ea..3f6029dae 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -514,7 +514,6 @@ void CChat::EnableMode(int Team) Input()->SetIMEState(true); Input()->Clear(); m_CompletionChosen = -1; - UI()->AndroidShowTextInput("", Team ? Localize("Team chat") : Localize("Chat")); } } @@ -737,15 +736,7 @@ void CChat::OnPrepareLines() { float x = 5.0f; float y = 300.0f - 28.0f; -#if defined(__ANDROID__) - x += 120.0f; -#endif - -#if defined(__ANDROID__) - float FontSize = 10.0f; -#else float FontSize = 6.0f; -#endif bool ForceRecreate = m_pClient->m_pScoreboard->Active() != m_PrevScoreBoardShowed; ForceRecreate |= m_Show != m_PrevShowChat; @@ -977,9 +968,6 @@ void CChat::OnRender() return; y -= 8.0f; -#if defined(__ANDROID__) - x += 120.0f; -#endif OnPrepareLines(); @@ -1007,37 +995,6 @@ void CChat::OnRender() TextRender()->RenderTextContainer(m_aLines[r].m_TextContainerIndex, &Text, &TextOutline, 0, y - m_aLines[r].m_TextYOffset); } } - -#if defined(__ANDROID__) - static int deferEvent = 0; - if( UI()->AndroidTextInputShown() ) - { - if(m_Mode == MODE_NONE) - { - deferEvent++; - if( deferEvent > 2 ) - EnableMode(0); - } - else - deferEvent = 0; - } - else - { - if(m_Mode != MODE_NONE) - { - deferEvent++; - if( deferEvent > 2 ) - { - IInput::CEvent Event; - Event.m_Flags = IInput::FLAG_PRESS; - Event.m_Key = KEY_RETURN; - OnInput(Event); - } - } - else - deferEvent = 0; - } -#endif } void CChat::Say(int Team, const char *pLine) diff --git a/src/game/client/components/controls.cpp b/src/game/client/components/controls.cpp index 9ca0c6ffe..620c7d095 100644 --- a/src/game/client/components/controls.cpp +++ b/src/game/client/components/controls.cpp @@ -29,9 +29,7 @@ CControls::CControls() m_LastDummy = 0; m_OtherFire = 0; -#if !defined(__ANDROID__) if (g_Config.m_InpJoystick) -#endif { SDL_Init(SDL_INIT_JOYSTICK); m_Joystick = SDL_JoystickOpen(0); @@ -51,14 +49,12 @@ CControls::CControls() m_UsingGamepad = true; #endif } -#if !defined(__ANDROID__) else { m_Joystick = NULL; m_Gamepad = NULL; m_UsingGamepad = false; } -#endif } void CControls::OnReset() @@ -456,7 +452,6 @@ void CControls::OnRender() if( !m_UsingGamepad && (abs(AimX) > GAMEPAD_DEAD_ZONE || abs(AimY) > GAMEPAD_DEAD_ZONE || abs(RunX) > GAMEPAD_DEAD_ZONE || abs(RunY) > GAMEPAD_DEAD_ZONE) ) { - UI()->AndroidShowScreenKeys(false); m_UsingGamepad = true; } } @@ -501,16 +496,6 @@ bool CControls::OnMouseMove(float x, float y) if((m_pClient->m_Snap.m_pGameInfoObj && m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_PAUSED)) return false; -#if defined(__ANDROID__) // No relative mouse on Android - // We're using joystick on Android, mouse is disabled - if( m_OldMouseX != x || m_OldMouseY != y ) - { - m_OldMouseX = x; - m_OldMouseY = y; - m_MousePos[g_Config.m_ClDummy] = vec2((x - Graphics()->Width()/2), (y - Graphics()->Height()/2)); - ClampMousePos(); - } -#else if(g_Config.m_ClDyncam && g_Config.m_ClDyncamMousesens) { x = x * g_Config.m_ClDyncamMousesens / g_Config.m_InpMousesens; @@ -518,7 +503,6 @@ bool CControls::OnMouseMove(float x, float y) } m_MousePos[g_Config.m_ClDummy] += vec2(x, y); // TODO: ugly ClampMousePos(); -#endif return true; } diff --git a/src/game/client/components/emoticon.cpp b/src/game/client/components/emoticon.cpp index 9cab1e802..16d64a8d1 100644 --- a/src/game/client/components/emoticon.cpp +++ b/src/game/client/components/emoticon.cpp @@ -54,12 +54,8 @@ bool CEmoticon::OnMouseMove(float x, float y) if(!m_Active) return false; -#if defined(__ANDROID__) // No relative mouse on Android - m_SelectorMouse = vec2(x,y); -#else UI()->ConvertMouseMove(&x, &y); m_SelectorMouse += vec2(x,y); -#endif return true; } diff --git a/src/game/client/components/hud.cpp b/src/game/client/components/hud.cpp index 713f2bd6c..9e3db70ef 100644 --- a/src/game/client/components/hud.cpp +++ b/src/game/client/components/hud.cpp @@ -614,17 +614,7 @@ void CHud::RenderVoting() Graphics()->QuadsBegin(); Graphics()->SetColor(0,0,0,0.40f); -#if defined(__ANDROID__) - static const float TextX = 265; - static const float TextY = 1; - static const float TextW = 200; - static const float TextH = 42; - RenderTools()->DrawRoundRect(TextX-5, TextY, TextW+15, TextH, 5.0f); - RenderTools()->DrawRoundRect(TextX-5, TextY+TextH+2, TextW/2-10, 20, 5.0f); - RenderTools()->DrawRoundRect(TextX+TextW/2+20, TextY+TextH+2, TextW/2-10, 20, 5.0f); -#else RenderTools()->DrawRoundRect(-10, 60-2, 100+10+4+5, 46, 5.0f); -#endif Graphics()->QuadsEnd(); TextRender()->TextColor(1,1,1,1); @@ -632,60 +622,24 @@ void CHud::RenderVoting() CTextCursor Cursor; char aBuf[512]; str_format(aBuf, sizeof(aBuf), Localize("%ds left"), m_pClient->m_pVoting->SecondsLeft()); -#if defined(__ANDROID__) - float tw = TextRender()->TextWidth(0x0, 10, aBuf, -1); - TextRender()->SetCursor(&Cursor, TextX+TextW-tw, 0.0f, 10.0f, TEXTFLAG_RENDER); -#else float tw = TextRender()->TextWidth(0x0, 6, aBuf, -1); TextRender()->SetCursor(&Cursor, 5.0f+100.0f-tw, 60.0f, 6.0f, TEXTFLAG_RENDER); -#endif TextRender()->TextEx(&Cursor, aBuf, -1); -#if defined(__ANDROID__) - TextRender()->SetCursor(&Cursor, TextX, 0.0f, 10.0f, TEXTFLAG_RENDER); - Cursor.m_LineWidth = TextW-tw; -#else TextRender()->SetCursor(&Cursor, 5.0f, 60.0f, 6.0f, TEXTFLAG_RENDER); Cursor.m_LineWidth = 100.0f-tw; -#endif Cursor.m_MaxLines = 3; TextRender()->TextEx(&Cursor, m_pClient->m_pVoting->VoteDescription(), -1); // reason str_format(aBuf, sizeof(aBuf), "%s %s", Localize("Reason:"), m_pClient->m_pVoting->VoteReason()); -#if defined(__ANDROID__) - TextRender()->SetCursor(&Cursor, TextX, 23.0f, 10.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); -#else TextRender()->SetCursor(&Cursor, 5.0f, 79.0f, 6.0f, TEXTFLAG_RENDER|TEXTFLAG_STOP_AT_END); -#endif Cursor.m_LineWidth = 100.0f; TextRender()->TextEx(&Cursor, aBuf, -1); -#if defined(__ANDROID__) - CUIRect Base = {TextX, TextH - 8, TextW, 4}; -#else CUIRect Base = {5, 88, 100, 4}; -#endif m_pClient->m_pVoting->RenderBars(Base, false); -#if defined(__ANDROID__) - Base.y += Base.h+6; - UI()->DoLabel(&Base, Localize("Vote yes"), 16.0f, -1); - UI()->DoLabel(&Base, Localize("Vote no"), 16.0f, 1); - if( Input()->KeyPress(KEY_MOUSE_1) ) - { - float mx, my; - Input()->MouseRelative(&mx, &my); - mx *= m_Width / Graphics()->ScreenWidth(); - my *= m_Height / Graphics()->ScreenHeight(); - if( my > TextY+TextH-40 && my < TextY+TextH+20 ) { - if( mx > TextX-5 && mx < TextX-5+TextW/2-10 ) - m_pClient->m_pVoting->Vote(1); - if( mx > TextX+TextW/2+20 && mx < TextX+TextW/2+20+TextW/2-10 ) - m_pClient->m_pVoting->Vote(-1); - } - } -#else const char *pYesKey = m_pClient->m_pBinds->GetKey("vote yes"); const char *pNoKey = m_pClient->m_pBinds->GetKey("vote no"); str_format(aBuf, sizeof(aBuf), "%s - %s", pYesKey, Localize("Vote yes")); @@ -695,7 +649,6 @@ void CHud::RenderVoting() str_format(aBuf, sizeof(aBuf), "%s - %s", Localize("Vote no"), pNoKey); UI()->DoLabel(&Base, aBuf, 6.0f, 1); -#endif } void CHud::RenderCursor() diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 5ea367bd1..995453bc8 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -45,14 +45,8 @@ vec4 CMenus::ms_ColorTabbarActive = vec4(0,0,0,0.5f); vec4 CMenus::ms_ColorTabbarInactiveIngame; vec4 CMenus::ms_ColorTabbarActiveIngame; -#if defined(__ANDROID__) -float CMenus::ms_ButtonHeight = 50.0f; -float CMenus::ms_ListheaderHeight = 17.0f; -float CMenus::ms_ListitemAdditionalHeight = 33.0f; -#else float CMenus::ms_ButtonHeight = 25.0f; float CMenus::ms_ListheaderHeight = 17.0f; -#endif float CMenus::ms_FontmodHeight = 0.8f; IInput::CEvent CMenus::m_aInputEvents[MAX_INPUTEVENTS]; @@ -154,13 +148,7 @@ int CMenus::DoButton_Menu(const void *pID, const char *pText, int Checked, const RenderTools()->DrawUIRect(pRect, vec4(1,1,1,0.5f)*ButtonColorMul(pID), CUI::CORNER_ALL, 5.0f); CUIRect Temp; pRect->HMargin(pRect->h>=20.0f?2.0f:1.0f, &Temp); -#if defined(__ANDROID__) - float TextH = min(22.0f, Temp.h); - Temp.y += (Temp.h - TextH) / 2; - UI()->DoLabel(&Temp, pText, TextH*ms_FontmodHeight, 0); -#else UI()->DoLabel(&Temp, pText, Temp.h*ms_FontmodHeight, 0); -#endif return UI()->DoButtonLogic(pID, pText, Checked, pRect); } @@ -180,13 +168,7 @@ int CMenus::DoButton_MenuTab(const void *pID, const char *pText, int Checked, co RenderTools()->DrawUIRect(pRect, ms_ColorTabbarInactive, Corners, 10.0f); CUIRect Temp; pRect->HMargin(2.0f, &Temp); -#if defined(__ANDROID__) - float TextH = min(22.0f, Temp.h); - Temp.y += (Temp.h - TextH) / 2; - UI()->DoLabel(&Temp, pText, TextH*ms_FontmodHeight, 0); -#else UI()->DoLabel(&Temp, pText, Temp.h*ms_FontmodHeight, 0); -#endif return UI()->DoButtonLogic(pID, pText, Checked, pRect); } @@ -197,12 +179,7 @@ int CMenus::DoButton_GridHeader(const void *pID, const char *pText, int Checked, RenderTools()->DrawUIRect(pRect, vec4(1,1,1,0.5f), CUI::CORNER_T, 5.0f); CUIRect t; pRect->VSplitLeft(5.0f, 0, &t); -#if defined(__ANDROID__) - float TextH = min(20.0f, pRect->h); - UI()->DoLabel(&t, pText, TextH*ms_FontmodHeight, -1); -#else UI()->DoLabel(&t, pText, pRect->h*ms_FontmodHeight, -1); -#endif return UI()->DoButtonLogic(pID, pText, Checked, pRect); } @@ -356,13 +333,6 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS if(Inside) { UI()->SetHotItem(pID); -#if defined(__ANDROID__) - if(UI()->ActiveItem() == pID && UI()->MouseButtonClicked(0)) - { - s_AtIndex = 0; - UI()->AndroidBlockAndGetTextInput(pStr, StrSize, ""); - } -#endif } CUIRect Textbox = *pRect; @@ -497,11 +467,7 @@ float CMenus::DoScrollbarV(const void *pID, const CUIRect *pRect, float Current) { CUIRect Handle; static float OffsetY; -#if defined(__ANDROID__) - pRect->HSplitTop(50, &Handle, 0); -#else pRect->HSplitTop(33, &Handle, 0); -#endif Handle.y += (pRect->h-Handle.h)*Current; @@ -1027,11 +993,7 @@ int CMenus::Render() if(m_Popup == POPUP_NONE) { -#if defined(__ANDROID__) - Screen.HSplitTop(100.0f, &TabBar, &MainView); -#else Screen.HSplitTop(24.0f, &TabBar, &MainView); -#endif // render news if(g_Config.m_UiPage < PAGE_NEWS || g_Config.m_UiPage > PAGE_SETTINGS || (Client()->State() == IClient::STATE_OFFLINE && g_Config.m_UiPage >= PAGE_GAME && g_Config.m_UiPage <= PAGE_CALLVOTE)) @@ -1189,11 +1151,7 @@ int CMenus::Render() CUIRect Box, Part; Box = Screen; Box.VMargin(150.0f/UI()->Scale(), &Box); -#if defined(__ANDROID__) - Box.HMargin(100.0f/UI()->Scale(), &Box); -#else Box.HMargin(150.0f/UI()->Scale(), &Box); -#endif // render the box RenderTools()->DrawUIRect(&Box, vec4(0,0,0,0.5f), CUI::CORNER_ALL, 15.0f); @@ -1223,11 +1181,7 @@ int CMenus::Render() { CUIRect Yes, No; Box.HSplitBottom(20.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif // additional info Box.VMargin(20.f/UI()->Scale(), &Box); @@ -1256,11 +1210,7 @@ int CMenus::Render() { CUIRect Yes, No; Box.HSplitBottom(20.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif // buttons Part.VMargin(80.0f, &Part); @@ -1280,11 +1230,7 @@ int CMenus::Render() { CUIRect Yes, No; Box.HSplitBottom(20.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif // buttons Part.VMargin(80.0f, &Part); @@ -1308,11 +1254,7 @@ int CMenus::Render() CUIRect Label, TextBox, TryAgain, Abort; Box.HSplitBottom(20.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif Part.VMargin(80.0f, &Part); Part.VSplitMid(&Abort, &TryAgain); @@ -1331,11 +1273,7 @@ int CMenus::Render() } Box.HSplitBottom(60.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif Part.VSplitLeft(60.0f, 0, &Label); Label.VSplitLeft(100.0f, 0, &TextBox); @@ -1351,11 +1289,7 @@ int CMenus::Render() Box.VMargin(150.0f, &Box); Box.HMargin(150.0f, &Box); Box.HSplitBottom(20.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif Part.VMargin(120.0f, &Part); static int s_Button = 0; @@ -1420,18 +1354,10 @@ int CMenus::Render() { Box = Screen; Box.VMargin(150.0f, &Box); -#if defined(__ANDROID__) - Box.HMargin(20.0f, &Box); -#else Box.HMargin(150.0f, &Box); -#endif Box.HSplitTop(20.f, &Part, &Box); Box.HSplitBottom(20.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif Box.HSplitBottom(20.f, &Box, 0); Box.VMargin(20.0f, &Box); RenderLanguageSelection(Box); @@ -1445,18 +1371,10 @@ int CMenus::Render() { Box = Screen; Box.VMargin(150.0f, &Box); -#if defined(__ANDROID__) - Box.HMargin(20.0f, &Box); -#else Box.HMargin(150.0f, &Box); -#endif Box.HSplitTop(20.f, &Part, &Box); Box.HSplitBottom(20.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif Box.HSplitBottom(20.f, &Box, 0); Box.VMargin(20.0f, &Box); @@ -1512,11 +1430,7 @@ int CMenus::Render() { CUIRect Yes, No; Box.HSplitBottom(20.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif Part.VMargin(80.0f, &Part); Part.VSplitMid(&No, &Yes); @@ -1552,11 +1466,7 @@ int CMenus::Render() CUIRect Label, TextBox, Ok, Abort; Box.HSplitBottom(20.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif Part.VMargin(80.0f, &Part); Part.VSplitMid(&Abort, &Ok); @@ -1594,11 +1504,7 @@ int CMenus::Render() } Box.HSplitBottom(60.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif Part.VSplitLeft(60.0f, 0, &Label); Label.VSplitLeft(120.0f, 0, &TextBox); @@ -1612,11 +1518,7 @@ int CMenus::Render() { CUIRect Yes, No; Box.HSplitBottom(20.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif Part.VMargin(80.0f, &Part); Part.VSplitMid(&No, &Yes); @@ -1647,11 +1549,7 @@ int CMenus::Render() CUIRect Label, TextBox; Box.HSplitBottom(20.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif Part.VMargin(80.0f, &Part); static int s_EnterButton = 0; @@ -1662,21 +1560,13 @@ int CMenus::Render() } Box.HSplitBottom(20.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif Part.VSplitLeft(60.0f, 0, &Part); if(DoButton_CheckBox(&g_Config.m_BrIndicateFinished, Localize("Show DDNet map finishes in server browser\n(transmits your player name to info.ddnet.tw)"), g_Config.m_BrIndicateFinished, &Part)) g_Config.m_BrIndicateFinished ^= 1; -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif Part.VSplitLeft(60.0f, 0, &Label); Label.VSplitLeft(100.0f, 0, &TextBox); @@ -1689,11 +1579,7 @@ int CMenus::Render() else { Box.HSplitBottom(20.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif Part.VMargin(120.0f, &Part); static int s_Button = 0; @@ -1717,9 +1603,6 @@ void CMenus::SetActive(bool Active) if(Active != m_MenuActive) Input()->SetIMEState(Active); m_MenuActive = Active; -#if defined(__ANDROID__) - UI()->AndroidShowScreenKeys(!m_MenuActive && !m_pClient->m_pControls->m_UsingGamepad); -#endif if(!m_MenuActive) { if(m_NeedSendinfo) @@ -1756,10 +1639,6 @@ bool CMenus::OnMouseMove(float x, float y) if(!m_MenuActive) return false; -#if defined(__ANDROID__) // No relative mouse on Android - m_MousePos.x = x; - m_MousePos.y = y; -#else UI()->ConvertMouseMove(&x, &y); if(m_MouseSlow) { @@ -1771,7 +1650,6 @@ bool CMenus::OnMouseMove(float x, float y) m_MousePos.x += x; m_MousePos.y += y; } -#endif m_MousePos.x = clamp(m_MousePos.x, 0.f, (float)Graphics()->ScreenWidth()); m_MousePos.y = clamp(m_MousePos.y, 0.f, (float)Graphics()->ScreenHeight()); @@ -1914,14 +1792,7 @@ void CMenus::OnRender() if(Input()->KeyIsPressed(KEY_MOUSE_3)) Buttons |= 4; } -#if defined(__ANDROID__) - static int ButtonsOneFrameDelay = 0; // For Android touch input - - UI()->Update(mx,my,mx*3.0f,my*3.0f,ButtonsOneFrameDelay); - ButtonsOneFrameDelay = Buttons; -#else UI()->Update(mx,my,mx*3.0f,my*3.0f,Buttons); -#endif // render if(Client()->State() != IClient::STATE_DEMOPLAYBACK) diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 7dfb745d2..c1b459c07 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -73,9 +73,6 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) {COL_PLAYERS, IServerBrowser::SORT_NUMPLAYERS, "Players", 1, 60.0f, 0, {0}, {0}}, {-1, -1, " ", 1, 10.0f, 0, {0}, {0}}, {COL_PING, IServerBrowser::SORT_PING, "Ping", 1, 40.0f, FIXED, {0}, {0}}, -#if defined(__ANDROID__) - {-1, -1, " ", 1, 50.0f, 0, {0}, {0}}, // Scrollbar -#endif }; // This is just for scripts/update_localization.py to work correctly (all other strings are already Localize()'d somewhere else). Don't remove! // Localize("Type"); @@ -131,11 +128,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) RenderTools()->DrawUIRect(&View, vec4(0,0,0,0.15f), 0, 0); CUIRect Scroll; -#if defined(__ANDROID__) - View.VSplitRight(50, &View, &Scroll); -#else View.VSplitRight(15, &View, &Scroll); -#endif int NumServers = ServerBrowser()->NumSortedServers(); @@ -481,11 +474,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) // select the new server const CServerInfo *pItem = ServerBrowser()->SortedGet(NewSelected); str_copy(g_Config.m_UiServerAddress, pItem->m_aAddress, sizeof(g_Config.m_UiServerAddress)); -#if defined(__ANDROID__) - if(DoubleClicked) -#else if(Input()->MouseDoubleClick() && DoubleClicked) -#endif Client()->Connect(g_Config.m_UiServerAddress); } @@ -1124,11 +1113,7 @@ void CMenus::RenderServerbrowserFriends(CUIRect View) static float s_ScrollValue = 0; if(m_FriendlistSelectedIndex >= m_lFriends.size()) m_FriendlistSelectedIndex = m_lFriends.size()-1; -#if defined(__ANDROID__) - UiDoListboxStart(&m_lFriends, &List, 50.0f, "", "", m_lFriends.size(), 1, m_FriendlistSelectedIndex, s_ScrollValue); -#else UiDoListboxStart(&m_lFriends, &List, 30.0f, "", "", m_lFriends.size(), 1, m_FriendlistSelectedIndex, s_ScrollValue); -#endif m_lFriends.sort_range(); for(int i = 0; i < m_lFriends.size(); ++i) diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index 6c466aa56..1eb1dd001 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -80,11 +80,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) CUIRect Box, Part, Part2; Box = Screen; Box.VMargin(150.0f/UI()->Scale(), &Box); -#if defined(__ANDROID__) - Box.HMargin(100.0f/UI()->Scale(), &Box); -#else Box.HMargin(150.0f/UI()->Scale(), &Box); -#endif // render the box RenderTools()->DrawUIRect(&Box, vec4(0,0,0,0.5f), CUI::CORNER_ALL, 15.0f); @@ -101,11 +97,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) CUIRect Label, TextBox, Ok, Abort; Box.HSplitBottom(20.f, &Box, &Part); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part); -#endif Part.VMargin(80.0f, &Part); Part.VSplitMid(&Abort, &Ok); @@ -149,13 +141,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) Box.HSplitBottom(60.f, &Box, &Part); Box.HSplitBottom(60.f, &Box, &Part2); -#if defined(__ANDROID__) - Box.HSplitBottom(60.f, &Box, &Part2); - Box.HSplitBottom(60.f, &Box, &Part); -#else Box.HSplitBottom(24.f, &Box, &Part2); Box.HSplitBottom(24.f, &Box, &Part); -#endif Part2.VSplitLeft(60.0f, 0, &Label); if(DoButton_CheckBox(&s_RemoveChat, Localize("Remove chat"), s_RemoveChat, &Label)) @@ -479,11 +466,7 @@ void CMenus::UiDoListboxStart(const void *pID, const CUIRect *pRect, float RowHe RenderTools()->DrawUIRect(&View, vec4(0,0,0,0.15f), 0, 0); // prepare the scroll -#if defined(__ANDROID__) - View.VSplitRight(50, &View, &Scroll); -#else View.VSplitRight(15, &View, &Scroll); -#endif // setup the variables gs_ListBoxOriginalView = View; @@ -982,11 +965,7 @@ void CMenus::RenderDemoList(CUIRect MainView) // scrollbar CUIRect Scroll; -#if defined(__ANDROID__) - ListBox.VSplitRight(50, &ListBox, &Scroll); -#else ListBox.VSplitRight(15, &ListBox, &Scroll); -#endif int Num = (int)(ListBox.h/s_aCols[0].m_Rect.h) + 1; static int s_ScrollBar = 0; @@ -1062,9 +1041,6 @@ void CMenus::RenderDemoList(CUIRect MainView) ListBox.y -= s_ScrollValue*ScrollNum*s_aCols[0].m_Rect.h; int NewSelected = -1; -#if defined(__ANDROID__) - int DoubleClicked = 0; -#endif int ItemIndex = -1; for(sorted_array::range r = m_lDemos.all(); !r.empty(); r.pop_front()) @@ -1103,11 +1079,6 @@ void CMenus::RenderDemoList(CUIRect MainView) NewSelected = ItemIndex; str_copy(g_Config.m_UiDemoSelected, r.front().m_aName, sizeof(g_Config.m_UiDemoSelected)); DemolistOnUpdate(false); -#if defined(__ANDROID__) - if(NewSelected == m_DoubleClickIndex) - DoubleClicked = 1; -#endif - m_DoubleClickIndex = NewSelected; } } @@ -1170,11 +1141,7 @@ void CMenus::RenderDemoList(CUIRect MainView) bool Activated = false; -#if defined(__ANDROID__) - if(m_EnterPressed || (DoubleClicked && UI()->HotItem() == m_lDemos[m_DemolistSelectedIndex].m_aName)) -#else if(m_EnterPressed || (Input()->MouseDoubleClick() && UI()->HotItem() == m_lDemos[m_DemolistSelectedIndex].m_aName)) -#endif { UI()->SetActiveItem(0); Activated = true; diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp index 0f07876dd..5fa5836de 100644 --- a/src/game/client/components/menus_ingame.cpp +++ b/src/game/client/components/menus_ingame.cpp @@ -33,20 +33,12 @@ void CMenus::RenderGame(CUIRect MainView) { CUIRect Button, ButtonBar; -#if defined(__ANDROID__) - MainView.HSplitTop(100.0f, &ButtonBar, &MainView); -#else MainView.HSplitTop(45.0f, &ButtonBar, &MainView); -#endif RenderTools()->DrawUIRect(&ButtonBar, ms_ColorTabbarActive, CUI::CORNER_B, 10.0f); // button bar ButtonBar.HSplitTop(10.0f, 0, &ButtonBar); -#if defined(__ANDROID__) - ButtonBar.HSplitTop(80.0f, &ButtonBar, 0); -#else ButtonBar.HSplitTop(25.0f, &ButtonBar, 0); -#endif ButtonBar.VMargin(10.0f, &ButtonBar); ButtonBar.VSplitRight(120.0f, &ButtonBar, &Button); @@ -219,11 +211,7 @@ void CMenus::RenderPlayers(CUIRect MainView) static float s_ScrollValue = 0; CUIRect List = Options; //List.HSplitTop(28.0f, 0, &List); -#if defined(__ANDROID__) - UiDoListboxStart(&s_VoteList, &List, 50.0f, "", "", TotalPlayers, 1, -1, s_ScrollValue); -#else UiDoListboxStart(&s_VoteList, &List, 24.0f, "", "", TotalPlayers, 1, -1, s_ScrollValue); -#endif // options static int s_aPlayerIDs[MAX_CLIENTS][2] = {{0}}; @@ -481,11 +469,7 @@ bool CMenus::RenderServerControlServer(CUIRect MainView) TotalShown++; } -#if defined(__ANDROID__) - UiDoListboxStart(&s_VoteList, &List, 50.0f, "", "", TotalShown, 1, s_CurVoteOption, s_ScrollValue); -#else UiDoListboxStart(&s_VoteList, &List, 24.0f, "", "", TotalShown, 1, s_CurVoteOption, s_ScrollValue); -#endif int i = -1; for(CVoteOptionClient *pOption = m_pClient->m_pVoting->m_pFirst; pOption; pOption = pOption->m_pNext) @@ -536,11 +520,7 @@ bool CMenus::RenderServerControlKick(CUIRect MainView, bool FilterSpectators) static int s_VoteList = 0; static float s_ScrollValue = 0; CUIRect List = MainView; -#if defined(__ANDROID__) - UiDoListboxStart(&s_VoteList, &List, 50.0f, "", "", NumOptions, 1, Selected, s_ScrollValue); -#else UiDoListboxStart(&s_VoteList, &List, 24.0f, "", "", NumOptions, 1, Selected, s_ScrollValue); -#endif for(int i = 0; i < NumOptions; i++) { @@ -569,24 +549,12 @@ void CMenus::RenderServerControl(CUIRect MainView) // render background CUIRect Bottom, Extended, TabBar, Button; -#if defined(__ANDROID__) - MainView.HSplitTop(50.0f, &Bottom, &MainView); -#else MainView.HSplitTop(20.0f, &Bottom, &MainView); -#endif RenderTools()->DrawUIRect(&Bottom, ms_ColorTabbarActive, 0, 10.0f); -#if defined(__ANDROID__) - MainView.HSplitTop(50.0f, &TabBar, &MainView); -#else MainView.HSplitTop(20.0f, &TabBar, &MainView); -#endif RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_B, 10.0f); MainView.Margin(10.0f, &MainView); -#if defined(__ANDROID__) - MainView.HSplitBottom(10.0f, &MainView, &Extended); -#else MainView.HSplitBottom(90.0f, &MainView, &Extended); -#endif // tab bar { diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index 181fca7ff..30bc99581 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -1317,11 +1317,7 @@ void CMenus::RenderLanguageSelection(CUIRect MainView) int OldSelected = s_SelectedLanguage; -#if defined(__ANDROID__) - UiDoListboxStart(&s_LanguageList , &MainView, 50.0f, Localize("Language"), "", s_Languages.size(), 1, s_SelectedLanguage, s_ScrollValue); -#else UiDoListboxStart(&s_LanguageList , &MainView, 24.0f, Localize("Language"), "", s_Languages.size(), 1, s_SelectedLanguage, s_ScrollValue); -#endif for(sorted_array::range r = s_Languages.all(); !r.empty(); r.pop_front()) { diff --git a/src/game/client/components/spectator.cpp b/src/game/client/components/spectator.cpp index 2fdf6bf4a..6e34ca045 100644 --- a/src/game/client/components/spectator.cpp +++ b/src/game/client/components/spectator.cpp @@ -152,18 +152,8 @@ bool CSpectator::OnMouseMove(float x, float y) if(!m_Active) return false; -#if defined(__ANDROID__) // No relative mouse on Android - m_SelectorMouse = vec2(x,y); - if( m_OldMouseX != x || m_OldMouseY != y ) - { - m_OldMouseX = x; - m_OldMouseY = y; - m_SelectorMouse = vec2((x - Graphics()->ScreenWidth()/2), (y - Graphics()->ScreenHeight()/2)); - } -#else UI()->ConvertMouseMove(&x, &y); m_SelectorMouse += vec2(x,y); -#endif return true; } diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 66edf1834..9499725d0 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -128,7 +128,7 @@ void CGameClient::OnConsoleInit() m_pEditor = Kernel()->RequestInterface(); m_pFriends = Kernel()->RequestInterface(); m_pFoes = Client()->Foes(); -#if defined(CONF_FAMILY_WINDOWS) || (defined(CONF_PLATFORM_LINUX) && !defined(__ANDROID__)) +#if defined(CONF_FAMILY_WINDOWS) || defined(CONF_PLATFORM_LINUX) m_pUpdater = Kernel()->RequestInterface(); #endif @@ -306,10 +306,6 @@ void CGameClient::OnInit() g_GameClient.m_pMenus->RenderLoading(); } -#if defined(__ANDROID__) - m_pMapimages->OnMapLoad(); // Reload map textures on Android -#endif - for(int i = 0; i < m_All.m_Num; i++) m_All.m_paComponents[i]->OnReset(); @@ -356,9 +352,7 @@ void CGameClient::OnUpdate() // handle mouse movement float x = 0.0f, y = 0.0f; Input()->MouseRelative(&x, &y); -#if !defined(__ANDROID__) // No relative mouse on Android if(x != 0.0f || y != 0.0f) -#endif { for(int h = 0; h < m_Input.m_Num; h++) { diff --git a/src/game/client/ui.cpp b/src/game/client/ui.cpp index cd0a0b3d2..22c467a50 100644 --- a/src/game/client/ui.cpp +++ b/src/game/client/ui.cpp @@ -8,10 +8,6 @@ #include #include "ui.h" -#if defined(__ANDROID__) -#include -#endif - /******************************************************** UI *********************************************************/ @@ -60,131 +56,9 @@ int CUI::MouseInside(const CUIRect *r) void CUI::ConvertMouseMove(float *x, float *y) { -#if defined(__ANDROID__) - //*x = *x * 500 / g_Config.m_GfxScreenWidth; - //*y = *y * 500 / g_Config.m_GfxScreenHeight; -#else float Fac = (float)(g_Config.m_UiMousesens)/g_Config.m_InpMousesens; *x = *x*Fac; *y = *y*Fac; -#endif -} - -void CUI::AndroidShowScreenKeys(bool shown) -{ -#if defined(__ANDROID__) - static bool ScreenKeyboardInitialized = false; - static bool ScreenKeyboardShown = true; - static SDL_Rect Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM]; - static SDL_Rect ButtonHidden = { 0, 0, 0, 0 }; - if( !ScreenKeyboardInitialized ) - { - ScreenKeyboardInitialized = true; - - for( int i = 0; i < SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM; i++ ) - SDL_ANDROID_GetScreenKeyboardButtonPos( i, &Buttons[i] ); - - if( !SDL_ANDROID_GetScreenKeyboardRedefinedByUser() ) - { - int ScreenW = Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2].x + - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2].w; - int ScreenH = Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2].y + - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2].h; - // Hide Hook button(it was above Weapnext) - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_0].x = - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_1].x; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_0].y = - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_1].y - - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_0].h; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_0].w = 0; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_0].h = 0; - // Hide Weapprev button - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_2].x = - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_0].x; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_2].y = - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_1].y - - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_2].h; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_2].w = 0; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_2].h = 0; - // Scores button above left joystick - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_3].x = 0; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_3].y = - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD].y - - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_3].h * 2.0f; - // Text input button above scores - //Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT].w = - // Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_3].w; - //Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT].h = - // Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_3].h; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT].x = 0; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT].y = - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_3].y - - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_TEXT].h; - // Spec next button - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_5].x = - ScreenW - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_4].w; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_5].y = - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2].y - - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_5].h; - // Spec prev button - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_4].x = - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_5].x - - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_4].w; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_4].y = - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_5].y; - // Weap next button - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_1].x = - ScreenW - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_1].w; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_1].y = - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_5].y - - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_1].h; - // Bigger joysticks - /* - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD].w *= 1.25; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD].h *= 1.25; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD].y = - ScreenH - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD].h; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2].w *= 1.25; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2].h *= 1.25; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2].x = - ScreenW - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2].w; - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2].y = - ScreenH - Buttons[SDL_ANDROID_SCREENKEYBOARD_BUTTON_DPAD2].h; - */ - } - } - - if( ScreenKeyboardShown == shown ) - return; - ScreenKeyboardShown = shown; - for( int i = 0; i < SDL_ANDROID_SCREENKEYBOARD_BUTTON_NUM; i++ ) - SDL_ANDROID_SetScreenKeyboardButtonPos( i, shown ? &Buttons[i] : &ButtonHidden ); -#endif -} - -void CUI::AndroidShowTextInput(const char *text, const char *hintText) -{ -#if defined(__ANDROID__) - SDL_ANDROID_SetScreenKeyboardHintMesage(hintText); - SDL_ANDROID_ToggleScreenKeyboardTextInput(text); -#endif -} - -void CUI::AndroidBlockAndGetTextInput(char *text, int textLength, const char *hintText) -{ -#if defined(__ANDROID__) - SDL_ANDROID_SetScreenKeyboardHintMesage(hintText); - SDL_ANDROID_GetScreenKeyboardTextInput(text, textLength); -#endif -} - -bool CUI::AndroidTextInputShown() -{ -#if defined(__ANDROID__) - return SDL_IsScreenKeyboardShown(NULL); -#else - return false; -#endif } CUIRect *CUI::Screen() diff --git a/src/game/client/ui.h b/src/game/client/ui.h index 8720a3519..16df7c5d0 100644 --- a/src/game/client/ui.h +++ b/src/game/client/ui.h @@ -96,11 +96,6 @@ public: // TODO: Refactor: Remove this? void DoLabel(const CUIRect *pRect, const char *pText, float Size, int Align, int MaxWidth = -1); void DoLabelScaled(const CUIRect *pRect, const char *pText, float Size, int Align, int MaxWidth = -1); - - void AndroidShowScreenKeys(bool shown); - void AndroidShowTextInput(const char *text, const char *hintText); - void AndroidBlockAndGetTextInput(char *text, int textLength, const char *hintText); - bool AndroidTextInputShown(); }; diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index ecc4466c5..654ccb9fa 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -6141,22 +6141,6 @@ void CEditor::UpdateAndRender() float rx, ry; { Input()->MouseRelative(&rx, &ry); -#if defined(__ANDROID__) - float tx, ty; - tx = s_MouseX; - ty = s_MouseY; - - s_MouseX = (rx / (float)Graphics()->ScreenWidth()) * UI()->Screen()->w; - s_MouseY = (ry / (float)Graphics()->ScreenHeight()) * UI()->Screen()->h; - - s_MouseX = clamp(s_MouseX, 0.0f, UI()->Screen()->w); - s_MouseY = clamp(s_MouseY, 0.0f, UI()->Screen()->h); - - m_MouseDeltaX = s_MouseX - m_OldMouseX; - m_MouseDeltaY = s_MouseY - m_OldMouseY; - m_OldMouseX = tx; - m_OldMouseY = ty; -#else UI()->ConvertMouseMove(&rx, &ry); // TODO: Why do we have to halve this? @@ -6171,7 +6155,6 @@ void CEditor::UpdateAndRender() s_MouseX = clamp(s_MouseX + rx, 0.0f, UI()->Screen()->w); s_MouseY = clamp(s_MouseY + ry, 0.0f, UI()->Screen()->h); } -#endif // update the ui mx = s_MouseX; @@ -6200,14 +6183,7 @@ void CEditor::UpdateAndRender() if(Input()->KeyIsPressed(KEY_MOUSE_2)) Buttons |= 2; if(Input()->KeyIsPressed(KEY_MOUSE_3)) Buttons |= 4; -#if defined(__ANDROID__) - static int ButtonsOneFrameDelay = 0; // For Android touch input - - UI()->Update(mx,my,Mwx,Mwy,ButtonsOneFrameDelay); - ButtonsOneFrameDelay = Buttons; -#else UI()->Update(mx,my,Mwx,Mwy,Buttons); -#endif } // toggle gui diff --git a/src/game/editor/editor.h b/src/game/editor/editor.h index bc1e51150..c70eefb0d 100644 --- a/src/game/editor/editor.h +++ b/src/game/editor/editor.h @@ -693,10 +693,6 @@ public: m_MouseDeltaY = 0; m_MouseDeltaWx = 0; m_MouseDeltaWy = 0; -#if defined(__ANDROID__) - m_OldMouseX = 0; - m_OldMouseY = 0; -#endif m_GuiActive = true; m_ProofBorders = false; @@ -898,10 +894,6 @@ public: float m_MouseDeltaY; float m_MouseDeltaWx; float m_MouseDeltaWy; -#if defined(__ANDROID__) - float m_OldMouseX; - float m_OldMouseY; -#endif bool m_ShowTileInfo; bool m_ShowDetail; diff --git a/src/game/variables.h b/src/game/variables.h index 2c3266c5f..85c65df83 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -22,13 +22,8 @@ MACRO_CONFIG_INT(ClTextEntities, cl_text_entities, 1, 0, 1, CFGFLAG_CLIENT|CFGFL MACRO_CONFIG_INT(ClAuthedPlayerColor, cl_authed_player_color, 5898183, 0, 0xFFFFFF, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Color of name of authenticated player in scoreboard") MACRO_CONFIG_INT(ClSameClanColor, cl_same_clan_color, 5898183, 0, 0xFFFFFF, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Clan color of players with the same clan as you in scoreboard.") MACRO_CONFIG_INT(ClEnablePingColor, cl_enable_ping_color, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Whether ping is colored in scoreboard.") -#if defined(__ANDROID__) -MACRO_CONFIG_INT(ClAutoswitchWeapons, cl_autoswitch_weapons, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Auto switch weapon on pickup") -MACRO_CONFIG_INT(ClAutoswitchWeaponsOutOfAmmo, cl_autoswitch_weapons_out_of_ammo, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Auto switch weapon when out of ammo") -#else MACRO_CONFIG_INT(ClAutoswitchWeapons, cl_autoswitch_weapons, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Auto switch weapon on pickup") MACRO_CONFIG_INT(ClAutoswitchWeaponsOutOfAmmo, cl_autoswitch_weapons_out_of_ammo, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Auto switch weapon when out of ammo") -#endif MACRO_CONFIG_INT(ClShowhud, cl_showhud, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame HUD") MACRO_CONFIG_INT(ClShowhudHealthAmmo, cl_showhud_healthammo, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame HUD (Health + Ammo)")