android: immersive mode and tweaks to build system

This commit is contained in:
Sebastian Krzyszkowiak 2017-08-14 02:02:37 +02:00
parent f3ba496438
commit 777a6c06c7
3 changed files with 24 additions and 42 deletions

View file

@ -1,29 +0,0 @@
package net.dosowisko.${LIBSUPERDERPY_GAMENAME};
import org.liballeg.android.AllegroActivity;
public class SuperDerpyActivity extends AllegroActivity {
/* Load Allegro and other shared libraries in the lib directory of the apk
* bundle. You must load libraries which are required by later libraries
* first.
*/
static {
System.loadLibrary("allegro-debug");
System.loadLibrary("allegro_primitives-debug");
System.loadLibrary("allegro_image-debug");
System.loadLibrary("allegro_font-debug");
System.loadLibrary("allegro_ttf-debug");
System.loadLibrary("allegro_audio-debug");
System.loadLibrary("allegro_acodec-debug");
System.loadLibrary("allegro_video-debug");
}
/* By default, AllegroActivity.onCreate will cause Allegro to load the
* shared object `libapp.so'. You can specify another library name by
* overriding the constructor.
*/
public SuperDerpyActivity() {
super("libgame.so");
}
}

View file

@ -1,6 +1,8 @@
package net.dosowisko.${LIBSUPERDERPY_GAMENAME};
import org.liballeg.android.AllegroActivity;
import android.view.View;
import android.os.Bundle;
public class SuperDerpyActivity extends AllegroActivity {
@ -9,14 +11,15 @@ public class SuperDerpyActivity extends AllegroActivity {
* first.
*/
static {
System.loadLibrary("allegro");
System.loadLibrary("allegro_primitives");
System.loadLibrary("allegro_image");
System.loadLibrary("allegro_font");
System.loadLibrary("allegro_ttf");
System.loadLibrary("allegro_audio");
System.loadLibrary("allegro_acodec");
System.loadLibrary("allegro_video");
System.loadLibrary("allegro${ALLEGRO_DEBUG_SUFFIX}");
System.loadLibrary("allegro_primitives${ALLEGRO_DEBUG_SUFFIX}");
System.loadLibrary("allegro_image${ALLEGRO_DEBUG_SUFFIX}");
System.loadLibrary("allegro_color${ALLEGRO_DEBUG_SUFFIX}");
System.loadLibrary("allegro_font${ALLEGRO_DEBUG_SUFFIX}");
System.loadLibrary("allegro_ttf${ALLEGRO_DEBUG_SUFFIX}");
System.loadLibrary("allegro_audio${ALLEGRO_DEBUG_SUFFIX}");
System.loadLibrary("allegro_acodec${ALLEGRO_DEBUG_SUFFIX}");
System.loadLibrary("allegro_video${ALLEGRO_DEBUG_SUFFIX}");
}
/* By default, AllegroActivity.onCreate will cause Allegro to load the
@ -26,4 +29,14 @@ public class SuperDerpyActivity extends AllegroActivity {
public SuperDerpyActivity() {
super("libgame.so");
}
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
if (android.os.Build.VERSION.SDK_INT >= 19) {
this.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
}
}
}

View file

@ -128,7 +128,7 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED)
ENDMACRO()
if(ANDROID)
set(ANDROID_TARGET "android-16" CACHE STRING "What Android target to compile for.")
set(ANDROID_TARGET "android-23" CACHE STRING "What Android target to compile for.")
# The android tool on Windows is a batch file wrapper, which cannot be
# started by MSYS shell directly. We invoke it via cmd.exe instead.
@ -169,12 +169,10 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED)
configure_android_file("res/values/strings.xml")
configure_android_file("jni/localgen.mk")
if (ALLEGRO5_LIBRARIES MATCHES "^.*-debug.*$")
configure_file("${CMAKE_BINARY_DIR}/android/src/net/dosowisko/libsuperderpy/SuperDerpyActivity.java.debug.in" "${CMAKE_BINARY_DIR}/android/src/net/dosowisko/libsuperderpy/SuperDerpyActivity.java")
else()
configure_file("${CMAKE_BINARY_DIR}/android/src/net/dosowisko/libsuperderpy/SuperDerpyActivity.java.in" "${CMAKE_BINARY_DIR}/android/src/net/dosowisko/libsuperderpy/SuperDerpyActivity.java")
set(ALLEGRO_DEBUG_SUFFIX "-debug")
endif()
configure_file("${CMAKE_BINARY_DIR}/android/src/net/dosowisko/libsuperderpy/SuperDerpyActivity.java.in" "${CMAKE_BINARY_DIR}/android/src/net/dosowisko/libsuperderpy/SuperDerpyActivity.java")
file(REMOVE "${CMAKE_BINARY_DIR}/android/src/net/dosowisko/libsuperderpy/SuperDerpyActivity.java.in")
file(REMOVE "${CMAKE_BINARY_DIR}/android/src/net/dosowisko/libsuperderpy/SuperDerpyActivity.java.debug.in")
file(RENAME "${CMAKE_BINARY_DIR}/android/src/net/dosowisko/libsuperderpy" "${CMAKE_BINARY_DIR}/android/src/net/dosowisko/${LIBSUPERDERPY_GAMENAME}")