Fix GitHub display of README-android.md

This commit is contained in:
Cacodemon345 2021-03-21 01:15:14 +06:00 committed by GitHub
parent cf7eef37b0
commit 1899844952
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,8 +10,7 @@ If you are using the older ant build process, it is no longer officially
supported, but you can use the "android-project-ant" directory as a template. supported, but you can use the "android-project-ant" directory as a template.
================================================================================ Requirements
Requirements
================================================================================ ================================================================================
Android SDK (version 26 or later) Android SDK (version 26 or later)
@ -23,8 +22,7 @@ https://developer.android.com/tools/sdk/ndk/index.html
Minimum API level supported by SDL: 16 (Android 4.1) Minimum API level supported by SDL: 16 (Android 4.1)
================================================================================ How the port works
How the port works
================================================================================ ================================================================================
- Android applications are Java-based, optionally with parts written in C - Android applications are Java-based, optionally with parts written in C
@ -42,8 +40,7 @@ dispatches to native functions implemented in the SDL library:
src/core/android/SDL_android.c src/core/android/SDL_android.c
================================================================================ Building an app
Building an app
================================================================================ ================================================================================
For simple projects you can use the script located at build-scripts/androidbuild.sh For simple projects you can use the script located at build-scripts/androidbuild.sh
@ -120,8 +117,7 @@ Here's an explanation of the files in the Android project, so you can customize
src/main/java/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding to SDL. Be very careful changing this, as the SDL library relies on this implementation. You should instead subclass this for your application. src/main/java/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding to SDL. Be very careful changing this, as the SDL library relies on this implementation. You should instead subclass this for your application.
================================================================================ Customizing your application name
Customizing your application name
================================================================================ ================================================================================
To customize your application name, edit AndroidManifest.xml and replace To customize your application name, edit AndroidManifest.xml and replace
@ -151,8 +147,7 @@ Then replace "SDLActivity" in AndroidManifest.xml with the name of your
class, .e.g. "MyGame" class, .e.g. "MyGame"
================================================================================ Customizing your application icon
Customizing your application icon
================================================================================ ================================================================================
Conceptually changing your icon is just replacing the "ic_launcher.png" files in Conceptually changing your icon is just replacing the "ic_launcher.png" files in
@ -160,8 +155,7 @@ the drawable directories under the res directory. There are several directories
for different screen sizes. for different screen sizes.
================================================================================ Loading assets
Loading assets
================================================================================ ================================================================================
Any files you put in the "app/src/main/assets" directory of your project Any files you put in the "app/src/main/assets" directory of your project
@ -189,8 +183,7 @@ disable this behaviour, see for example:
http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/ http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/
================================================================================ Pause / Resume behaviour
Pause / Resume behaviour
================================================================================ ================================================================================
If SDL_HINT_ANDROID_BLOCK_ON_PAUSE hint is set (the default), If SDL_HINT_ANDROID_BLOCK_ON_PAUSE hint is set (the default),
@ -217,8 +210,7 @@ You should not use the SDL renderer API while the app going in background:
GL context is restored, and the SDL renderer API is available (unless you GL context is restored, and the SDL renderer API is available (unless you
receive SDL_RENDER_DEVICE_RESET). receive SDL_RENDER_DEVICE_RESET).
================================================================================ Mouse / Touch events
Mouse / Touch events
================================================================================ ================================================================================
In some case, SDL generates synthetic mouse (resp. touch) events for touch In some case, SDL generates synthetic mouse (resp. touch) events for touch
@ -227,8 +219,7 @@ To enable/disable this behavior, see SDL_hints.h:
- SDL_HINT_TOUCH_MOUSE_EVENTS - SDL_HINT_TOUCH_MOUSE_EVENTS
- SDL_HINT_MOUSE_TOUCH_EVENTS - SDL_HINT_MOUSE_TOUCH_EVENTS
================================================================================ Misc
Misc
================================================================================ ================================================================================
For some device, it appears to works better setting explicitly GL attributes For some device, it appears to works better setting explicitly GL attributes
@ -237,8 +228,7 @@ before creating a window:
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
================================================================================ Threads and the Java VM
Threads and the Java VM
================================================================================ ================================================================================
For a quick tour on how Linux native threads interoperate with the Java VM, take For a quick tour on how Linux native threads interoperate with the Java VM, take
@ -253,8 +243,7 @@ your thread automatically anyway (when you make an SDL call), but it'll never
detach it. detach it.
================================================================================ Using STL
Using STL
================================================================================ ================================================================================
You can use STL in your project by creating an Application.mk file in the jni You can use STL in your project by creating an Application.mk file in the jni
@ -266,8 +255,7 @@ For more information go here:
https://developer.android.com/ndk/guides/cpp-support https://developer.android.com/ndk/guides/cpp-support
================================================================================ Using the emulator
Using the emulator
================================================================================ ================================================================================
There are some good tips and tricks for getting the most out of the There are some good tips and tricks for getting the most out of the
@ -279,8 +267,7 @@ Notice that this software emulator is incredibly slow and needs a lot of disk sp
Using a real device works better. Using a real device works better.
================================================================================ Troubleshooting
Troubleshooting
================================================================================ ================================================================================
You can see if adb can see any devices with the following command: You can see if adb can see any devices with the following command:
@ -359,8 +346,7 @@ If you need to build without optimization turned on, you can create a file calle
APP_OPTIM := debug APP_OPTIM := debug
================================================================================ Memory debugging
Memory debugging
================================================================================ ================================================================================
The best (and slowest) way to debug memory issues on Android is valgrind. The best (and slowest) way to debug memory issues on Android is valgrind.
@ -411,8 +397,7 @@ When you're done instrumenting with valgrind, you can disable the wrapper:
adb shell setprop wrap.org.libsdl.app "" adb shell setprop wrap.org.libsdl.app ""
================================================================================ Graphics debugging
Graphics debugging
================================================================================ ================================================================================
If you are developing on a compatible Tegra-based tablet, NVidia provides If you are developing on a compatible Tegra-based tablet, NVidia provides
@ -425,8 +410,7 @@ The Tegra Graphics Debugger is available from NVidia here:
https://developer.nvidia.com/tegra-graphics-debugger https://developer.nvidia.com/tegra-graphics-debugger
================================================================================ Why is API level 16 the minimum required?
Why is API level 16 the minimum required?
================================================================================ ================================================================================
The latest NDK toolchain doesn't support targeting earlier than API level 16. The latest NDK toolchain doesn't support targeting earlier than API level 16.
@ -435,8 +419,7 @@ about 99% of the Android devices accessing Google Play support API level 16 or
higher (January 2018). higher (January 2018).
================================================================================ A note regarding the use of the "dirty rectangles" rendering technique
A note regarding the use of the "dirty rectangles" rendering technique
================================================================================ ================================================================================
If your app uses a variation of the "dirty rectangles" rendering technique, If your app uses a variation of the "dirty rectangles" rendering technique,
@ -454,8 +437,7 @@ screen each frame.
Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html
================================================================================ Ending your application
Ending your application
================================================================================ ================================================================================
Two legitimate ways: Two legitimate ways:
@ -472,8 +454,7 @@ Don't call exit() as it stops the activity badly.
NB: "Back button" can be handled as a SDL_KEYDOWN/UP events, with Keycode NB: "Back button" can be handled as a SDL_KEYDOWN/UP events, with Keycode
SDLK_AC_BACK, for any purpose. SDLK_AC_BACK, for any purpose.
================================================================================ Known issues
Known issues
================================================================================ ================================================================================
- The number of buttons reported for each joystick is hardcoded to be 36, which - The number of buttons reported for each joystick is hardcoded to be 36, which