Skip to content

Android build - #1804

Merged
Flamefire merged 12 commits into
Return-To-The-Roots:masterfrom
Farmer-Markus:android
Jan 21, 2026
Merged

Android build#1804
Flamefire merged 12 commits into
Return-To-The-Roots:masterfrom
Farmer-Markus:android

Conversation

@Farmer-Markus

@Farmer-Markus Farmer-Markus commented Oct 6, 2025

Copy link
Copy Markdown
Contributor

I'm working on recreating my android port of rttr.
Currently the game starts but failes to find any drivers.

I would need an option to set a custom output path for the translation/data copying.
Also an enviroment variable to set the path to the drivers or the game data (or both)

Also another problem is openGl.
On android only openGl-Es is available and I've used a translation library (gl4es) that works pretty well. But the SDL videodriver would need: 1. to link against gl4es and 2. the SDL_gl_getprocaddress to be replaced by the gl4es equivalent.
This could also be used to support devices like the raspberry pi.

Also I would implement basic touch controls which should also work on touchscreen laptops (thanks to sdl)

I know these would be some pretty big changes...

@Farmer-Markus

Farmer-Markus commented Oct 23, 2025

Copy link
Copy Markdown
Contributor Author

Changes:

  • Added 'natural' mouse mode & changed invert mouse setting to mouseMode (0:default, 1:inverted, 2:natural)
  • Changed invert mouse GUI setting (translations would need to be added/changed)
  • Added 'GL4ES' to RTTR_OPENGL cmake options & VideoSDL2 driver to support OpenGL-ES
  • Added 'RTTR_BUILD_LIB' cmake variable to build main executable as shared library (Needed to run on android)
  • Added Touch controls to VideoSDL2 driver (moving map with one finger, two finger zooming, double tap to close window)
  • Added allowing to control config paths using enviroment variables
  • Some minor changes to fix compiling with newer versions of gcc and clang

@Farmer-Markus
Farmer-Markus marked this pull request as ready for review October 23, 2025 12:49
@Flow86

Flow86 commented Oct 24, 2025

Copy link
Copy Markdown
Member

Git History should be cleaned up (Some things should be squashed, so that some distinguish commits are there)

Comment thread CMakeLists.txt
Comment thread copyDepsToBuildDir.cmake Outdated
Comment thread extras/videoDrivers/CMakeLists.txt Outdated
Comment thread extras/videoDrivers/SDL2/CMakeLists.txt Outdated
Comment thread extras/videoDrivers/SDL2/VideoSDL2.cpp Outdated
Comment thread libs/s25main/WindowManager.cpp Outdated
Comment thread libs/s25main/desktops/dskGameInterface.cpp Outdated
Comment thread libs/s25main/desktops/dskGameInterface.cpp Outdated
Comment thread libs/s25main/desktops/dskGameInterface.cpp Outdated
Comment thread libs/s25main/desktops/dskGameInterface.cpp Outdated
Comment thread libs/s25main/Settings.h Outdated
Comment thread libs/s25main/TerrainRenderer.cpp Outdated
Comment thread libs/s25main/WindowManager.cpp Outdated
Comment thread extras/videoDrivers/SDL2/VideoSDL2.cpp Outdated
Comment thread libs/driver/include/driver/VideoDriver.h Outdated
Comment thread libs/rttrConfig/src/RttrConfig.cpp Outdated
Comment thread libs/s25main/Settings.h Outdated
Comment thread libs/s25main/TerrainRenderer.cpp Outdated
Comment thread libs/s25main/TerrainRenderer.cpp Outdated
Comment thread libs/s25main/ingameWindows/IngameWindow.cpp Outdated
Comment thread libs/s25main/WindowManager.cpp Outdated
Comment thread libs/s25main/WindowManager.cpp Outdated
Comment thread libs/s25main/WindowManager.cpp Outdated
Comment thread libs/s25main/desktops/dskGameInterface.cpp Outdated
Comment thread libs/s25main/desktops/dskGameInterface.h Outdated
Comment thread extras/videoDrivers/SDL2/VideoSDL2.cpp Outdated
Comment thread libs/s25main/Settings.cpp Outdated
Comment thread libs/s25main/TerrainRenderer.cpp
Comment thread libs/s25main/WindowManager.cpp Outdated
Comment thread extras/videoDrivers/SDL2/VideoSDL2.cpp Outdated
Comment thread libs/driver/include/driver/MouseCoords.h Outdated
Comment thread libs/s25main/WindowManager.cpp Outdated
@Farmer-Markus
Farmer-Markus force-pushed the android branch 3 times, most recently from fa9b143 to e81e7d7 Compare December 29, 2025 20:51
Comment thread external/glad/openglCfg.hpp.cmake Outdated
@Farmer-Markus
Farmer-Markus force-pushed the android branch 2 times, most recently from 511ffbf to 18406ad Compare December 30, 2025 22:50
Comment thread libs/s25main/ingameWindows/IngameWindow.cpp Outdated
@Flamefire

Copy link
Copy Markdown
Member

#1850 will be merged after its CI finishes.

I think the last open issue here was the handling of a double-touch as double-click to close the window. So you can incorporate that (merge or rebase) and check the suggestion I just made. If it works in your tests with those then I'd say this is ready :-)

@Flow86

Flow86 commented Dec 31, 2025

Copy link
Copy Markdown
Member

If it works in your tests with those then I'd say this is ready :-)

maybe a proper rebase & squashing some of the commits to proper commits would be nice ;-)

@Farmer-Markus

Copy link
Copy Markdown
Contributor Author

maybe a proper rebase & squashing some of the commits to proper commits would be nice ;-)

Is this ok?

@Flamefire
Flamefire dismissed stale reviews from Flow86 and themself via 1eed84b January 20, 2026 16:50
@Flamefire

Copy link
Copy Markdown
Member

@Farmer-Markus I made a rebase of your branch on current master formatting each commit. 2 other changes:

  • Move methods in dskGameInterface to make the diff smaller
  • Return true when double-tap closes ingame window

Also each commit now builds so I could remove the comments from the last 2 commit titles.

Can you verify that this works for you too? You have to pull and reset your local branch due to the force-push.
I did check the diffs at each step but just want to make sure nothing slipped through, I'd really like to get this in :)

@Farmer-Markus

Farmer-Markus commented Jan 20, 2026

Copy link
Copy Markdown
Contributor Author
* Return `true` when double-tap closes ingame window

Everything works fine but now windows are closed by dbl clicking on the top bar instead of being minimized.
But I don't know if this was intentional

@Flamefire

Copy link
Copy Markdown
Member

Everything works fine but now windows are closed by dbl clicking on the top bar instead of being minimized.
But I don't know if this was intentional

It was not and I think this wasn't caused by my changes

Currently minimizing happens only when window-pinning is enabled and double-clicking the title bar: if(SETTINGS.interface.enableWindowPinning && mc.dbl_click)

Your commit 629bc2c removed the check if any button was pressed.

Where was/should be the code that minimizes the window on double-tapping the title bar?

Maybe we should:

  • always return true when any button is hit (if(IsPointInRect(mc.pos, GetButtonBounds(btn))))
  • in the Title case check if((SETTINGS.interface.enableWindowPinning || VIDEODRIVER.IsTouch()) && mc.dbl_click) to enable it for touch

Or (possibly better) use subconditions in the bottom if(VIDEODRIVER.IsTouch() && mc.dbl_click to check if inside titlebar and handle either as close or minimize there.
It might make sense to pull the conditions for modal windows to where they matter instead of continuing or the double-tap check might need to check for the 2 buttons too as they might be clicked but inactive and then we don't want to close, do we?

@Farmer-Markus

Copy link
Copy Markdown
Contributor Author

Your commit 629bc2c removed the check if any button was pressed.

Ok now I see why.

Where was/should be the code that minimizes the window on double-tapping the title bar?

I think I'm just messing up my memories. It should close when dblclick on titlebar and window pinning isn't enabled.

Maybe we should:

* always `return true` when any button is hit (`if(IsPointInRect(mc.pos, GetButtonBounds(btn)))`)

* in the `Title` case check `if((SETTINGS.interface.enableWindowPinning || VIDEODRIVER.IsTouch()) && mc.dbl_click)` to enable it for touch

Or (possibly better) use subconditions in the bottom if(VIDEODRIVER.IsTouch() && mc.dbl_click to check if inside titlebar and handle either as close or minimize there. It might make sense to pull the conditions for modal windows to where they matter instead of continuing or the double-tap check might need to check for the 2 buttons too as they might be clicked but inactive and then we don't want to close, do we?

I don't think we need to do additional changes. It works how it's intended :D

* always `return true` when any button is hit (`if(IsPointInRect(mc.pos, GetButtonBounds(btn)))`)

We could change this just to keep the window open and not accidentally close the window when trying to drag but I think this shouldn't be a serious problem.

@Flamefire

Copy link
Copy Markdown
Member

I think I'm just messing up my memories. It should close when dblclick on titlebar and window pinning isn't enabled.

We could change this just to keep the window open and not accidentally close the window when trying to drag but I think this shouldn't be a serious problem.

Just to be sure: Double-tap anywhere should close the window except for non-modal windows in these cases:

  • When window pinning is enabled double-tap on title will minimize
  • double-tap on minimize/pin will minimize/pin (effectively nothing as done twice and hence reverts to previous)

Correct?

@Farmer-Markus

Farmer-Markus commented Jan 20, 2026

Copy link
Copy Markdown
Contributor Author

I think I'm just messing up my memories. It should close when dblclick on titlebar and window pinning isn't enabled.

We could change this just to keep the window open and not accidentally close the window when trying to drag but I think this shouldn't be a serious problem.

Just to be sure: Double-tap anywhere should close the window except for non-modal windows in these cases:

  • When window pinning is enabled double-tap on title will minimize
  • double-tap on minimize/pin will minimize/pin (effectively nothing as done twice and hence reverts to previous)

Correct?

Yes Correct

@Farmer-Markus

Farmer-Markus commented Jan 20, 2026

Copy link
Copy Markdown
Contributor Author

@Flamefire I've fixed another very annoying bug with disable_mouse when using touch controls.
I hope this didn't broke your rebase or other stuff :/

You would always need to click twice to open a IgWindow if misclicked and opened the wrong one.
Just added the following to WindowManager::DoShow(

+ if(!VIDEODRIVER.IsTouch())
       disable_mouse = true;

Sorry for the many force-pushes my editor is playing games with me and not showing files how the actually are...

@Farmer-Markus
Farmer-Markus force-pushed the android branch 3 times, most recently from e08ef3b to 3a55f80 Compare January 20, 2026 22:15
@Flamefire

Copy link
Copy Markdown
Member

Sorry for the many force-pushes my editor is playing games with me and not showing files how the actually are...

But why force-push at all? That new change is unrelated to the previous commit so shouldn't be in it.

I extracted it to a separate commit and queueing this for merge :)

@Flamefire
Flamefire enabled auto-merge January 21, 2026 09:04
@Flamefire
Flamefire merged commit b87e768 into Return-To-The-Roots:master Jan 21, 2026
18 checks passed
@Farmer-Markus

Copy link
Copy Markdown
Contributor Author

I extracted it to a separate commit and queueing this for merge :)

Thank you! I've learned so much during this PR :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants