Open
Conversation
This moves the state out of Options (except for initial setup) and does the scale calculation in one place; I lumped this in with other density-related code. As a side effect, this commit tweaks the timing of when game_scale is initially applied: it will take effect after the initial loading screen is displayed. This heads off a bunch of opengl errors that (I think) were caused by game_scale being applied before device_density is fully initialized. Also, improve some opengl error messaging for debug builds, constexpr-ify HiDPIState.
ddc6452 to
47659fa
Compare
Tested with DCSS 0.26.1, SDK for Android 11 (API level 30) and NDK version r22b. Build changes - Added a gradle build setup for the android app. - Removed previous build.xml. - SAVEDIR static storage path repaced with SDL_AndroidGetExternalStoragePath. - Disable FORTIFY in lua to avoid runtime errors. - Updated various #ifdefs for __ANDROID__ and TOUCH_UI to handle current android builds. - TOUCH_UI build is no more. Most of the code has been removed because it's not working as expected. The rest has been merged in the Android build. - Some __ANDROID__ directives are no longer required for the build. They have been removed. New features - Show keyboard icon now can also be used to hide the virtual keyboard. Renamed to: Toggle keyboard. - Android's back button no longer hides the keyboard when the Activity is focused, now it behaves like an alias for the escape key. - The volume keys can be used for zooming the dungeon and the map. - Two finger scroll can be used on menus. - Custom font configurations to improve readability in small screens. The game auto scales in high resolution displays. - Added summary of Android controls to the help screen. - New option: tile_window_minimum. When set to false, disables the window size restrictions for testing purposes. - The small layout has been fixed and improved. Now it shows the same information as the default layout and the tab menus scale better to modern smartphone displays. - Small layout can be enabled with configuration option: tile_use_small_layout. This is now the default on Android. - Custom keyboard inspired by the ascii port. It is no longer needed to install 3rd party apps por better gameplay. - Support for physical keyboards. Fixes - The game is saved when the Activity is paused. It was very easy to lose progress (on purpose or by mistake) before. - If the virtual keyboard is visible when the Activity is paused, it will be visible again when the Activity is resumed. - The main menu no longer hides behind the virtual keyboard on startup. - Lots of fixes for the small layout. It no longer crashes on vertical displays. - Controls fixed on Android 10 and newer. - Fix game crash when wielding a launcher while quivering something different than the ammo. - Replace various fopen with fopen_u when opening the bones files and some wizard, test and debug functions. - Set the external storage path as the working directory to fix several write permission errors. - Don't show the keyboard on portrait mode to avoid crashes on some devices because of the lack of vertical space.
The game crashes when the skills are being selected for a silent spectre wanderer.
- Fix #1702. Cache not rebuilding on upgrade. - Fix title when show_game_time option is set. - Fix small layout crashing with limited vertical space. - Restore virtual keyboard on landscape mode. - Move toggle keyboard button from commands to system.
This bug is specific to the small layout
Also adjust Android permissions
- Less redundant and closer to the standard US layout. - Function keys added, so they can be used for macros. - New colors to highlight important keys. - Keys used for movement have been labeled with arrows.
- Tooltips disabled by default on Android - Keep tabs open when an element is selected - Keep tabs open on resize - Adjust tabs to cover only the map area - Increase transparency in inventory and monster tabs - Stop the inventory tab from showing when another tab is hidden
The icons are shown/hidden when clicking on the status area. We can increase the viewport scale as a result.
A long press can be used as a right click on the Android port.
Newer Samsung devices use the emoji variant of some characters by default. This fix explicits the text variant and reduces the font size for better fitting in the smallest devices.
This is a user request for searching stairs in map mode. They replace - and + which are available in the main keyboard.
The local tiles interface is now able to change between the normal and small layouts as a response to a resize event. Android devices continue using the small layout by default. Some tablets and laptops may be big enough for the normal layout, but more testing is required. Other devices use the small layout only when the available size is too small for the normal layout.
I think the old name was a bit confusing.
This function is unlikely to be useful in other platforms and may confuse users swapping between layouts.
- Fix some graphical errors when rotating and/or resuming the app. - Move staircase keys in numeric keyboard to match the upper keyboard. - Update gradle.
There's an error when building the game with NDK 26 for armeabi-v7a. This passed unnoticed on previous tests because the other architectures supported by Android are not affected. It can be fixed with another function casting on sdl2-mixer.
I got this message from an Android user: > can't enable full screen mode by setting "tile_full_screen = true", > still shows a black bar on top with device status. I agree a full screen option for Android can improve the user experience. Mostly when playing on landscape mode with modern devices. You can read this in the docs: > Where you set the UI flags makes a difference. If you hide the system > bars in your activity's onCreate() method and the user presses Home, > the system bars will reappear. When the user reopens the activity, > onCreate() won't get called, so the system bars will remain visible. > If you want system UI changes to persist as the user navigates in and > out of your activity, set UI flags in onResume() or > onWindowFocusChanged(). Tried both options and the behaviour when using onWindowsFocusChanged is more consistent. When using onResume, full screen is lost whenever you open the top menu.
I had the chance to play the game on a tablet and tried to use touch events only. It was a painful experience, but this will help.
The code used to detect mouse scroll events in the SDLActivity doesn't work in modern devices because the event's source is different from SOURCE_MOUSE. Reference: https://developer.android.com/games/playgames/ input-mouse#handle_mousewheel_scrolling
Chromebooks use buttonless ACTION_MOVE events to represent touchpad scrolling. Normal cursor movement uses a different action: ACTION_HOVER_MOVE.
The code inherited from SDL compares Event.getSource with InputDevice.SOURCE_MOUSE. This doesn't work on modern devices. The right way to identify a mouse event is: - Event.isFromSource(InputDevice.SOURCE_MOUSE) This also improves commit e7e1c0f, because SOURCE_CLASS_POINTER is too generic. I'm also removing some unused variables.
Categories are used to cluster multiple apps together into meaningful groups, such as when summarizing battery, network, or disk usage.
This value error makes the game crash on some devices when starting the game in landscape mode. Thank you to the player from Indonesia who reported the bug.
Pausing the app seems to leave the mTextEdit in a bad state, because it crashes the game when requesting focus. Recreating the object every time the keyboard toggle button is pressed showed a reliable behaviour in my tests, so I'm keeping it simple. Closes #4093
cf00b9c to
deae93d
Compare
Starting August 31 2025, new apps and app updates must target Android 15 (API level 35) or higher to be submitted to Google Play. There are two changes related to window insets in Android 15: edge-to-edge is enforced by default, and there are also configuration changes, such as the default configuration of system bars. I'm also reworking the code to control the virtual keyboard visibility because it's a mess.
This is required to publish the app on Google Play after November. https://android-developers.googleblog.com/2025/07/ transition-to-16-kb-page-sizes-android-apps-games-android-studio.html
ff45d2e to
bff4d98
Compare
- Automatic full layout on Android if the screen is big enough. - Maximize popups in small layout. - Fine tune map scale to match default LOS in reference resolutions. (cherry picked from commit be1bb89a5ee328656a7d6a2decc057be1065bb26)
The Android navigation bar may alter the screen height. This is a problem in landscape mode, where height restricts the scale and fonts size. This fix obtains the real screen dimensions via JNI. (cherry picked from commit 08d3286d276ed9cc752d063ab1cf203a8482338b)
(cherry picked from commit 5b29d696637d95539e1e59666cf77350eec7e08e)
Implements a simple file manager to make the SAVEDIR/dat accessible on Android. This is useful to install fonts and override the game data files. I have also improved the launcher's error handling and updated some deprecated code.
Here I'm trying to meet the requirements for the game to be distributed as a TV app. Most of the code is to make the launcher usable with a TV remote. The game is not playable without an external keyboard or pointer device, but the user is warned about it. I hope it will be enough. Other changes: - Improved virtual D-Pad. Now it can be used to navegate menus. - Keys in the transparent keyboard are highlighted when pressed. - Virtual keyboard disabled by default in TV and PC devices.
Android TV devices remap the enter key in hardware keyboards as the D-Pad center (OK) button. That event is ignored by Crawl, so we are doing the opposite remap here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Same as: crawl/crawl#1892