Android Port
@ -24,6 +24,7 @@ DetectTargetCPUArchitectures(ISLE_CPUS)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_DISABLE_PRECOMPILE_HEADERS ON)
|
||||
|
||||
if (NOT MINGW)
|
||||
set(NOT_MINGW ON)
|
||||
@ -482,8 +483,13 @@ if (NOT ISLE_MINIWIN)
|
||||
endif()
|
||||
|
||||
if (ISLE_BUILD_APP)
|
||||
add_executable(isle WIN32
|
||||
ISLE/res/isle.rc
|
||||
if(ANDROID)
|
||||
add_library(isle SHARED)
|
||||
else()
|
||||
add_executable(isle WIN32)
|
||||
target_sources(isle PRIVATE ISLE/res/isle.rc)
|
||||
endif()
|
||||
target_sources(isle PRIVATE
|
||||
ISLE/isleapp.cpp
|
||||
ISLE/islefiles.cpp
|
||||
${CMAKE_SOURCE_DIR}/ISLE/res/arrow_bmp.h
|
||||
@ -545,6 +551,9 @@ if (ISLE_BUILD_APP)
|
||||
ISLE/3ds/config.cpp
|
||||
)
|
||||
endif()
|
||||
if(ANDROID)
|
||||
target_sources(isle PRIVATE ISLE/android/config.cpp)
|
||||
endif()
|
||||
if(WINDOWS_STORE)
|
||||
target_sources(isle PRIVATE
|
||||
ISLE/xbox_one_series/config.cpp
|
||||
|
||||
12
ISLE/android/config.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <iniparser.h>
|
||||
|
||||
void Android_SetupDefaultConfigOverrides(dictionary* p_dictionary)
|
||||
{
|
||||
SDL_Log("Overriding default config for Android");
|
||||
|
||||
iniparser_set(p_dictionary, "isle:diskpath", "/data/data/org.legoisland.Isle.dev/files/DATA/disk/LEGO");
|
||||
iniparser_set(p_dictionary, "isle:cdpath", "/data/data/org.legoisland.Isle.dev/files/");
|
||||
}
|
||||
8
ISLE/android/config.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef ANDROID_CONFIG_H
|
||||
#define ANDROID_CONFIG_H
|
||||
|
||||
#include "dictionary.h"
|
||||
|
||||
void Android_SetupDefaultConfigOverrides(dictionary* p_dictionary);
|
||||
|
||||
#endif // ANDROID_CONFIG_H
|
||||
@ -58,6 +58,10 @@
|
||||
#include "3ds/config.h"
|
||||
#endif
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "android/config.h"
|
||||
#endif
|
||||
|
||||
#ifdef WINDOWS_STORE
|
||||
#include "xbox_one_series/config.h"
|
||||
#endif
|
||||
@ -994,6 +998,9 @@ bool IsleApp::LoadConfig()
|
||||
#ifdef __3DS__
|
||||
N3DS_SetupDefaultConfigOverrides(dict);
|
||||
#endif
|
||||
#ifdef __ANDROID__
|
||||
Android_SetupDefaultConfigOverrides(dict);
|
||||
#endif
|
||||
#ifdef WINDOWS_STORE
|
||||
XBONE_SetupDefaultConfigOverrides(dict);
|
||||
#endif
|
||||
|
||||
12
android-project/.gitignore
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
# Intellij
|
||||
.idea/
|
||||
|
||||
# Gradle files
|
||||
/.gradle/
|
||||
build/
|
||||
|
||||
# Android
|
||||
/app/.cxx/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
/local.properties
|
||||
@ -2,30 +2,27 @@ plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
def buildWithCMake = project.hasProperty('BUILD_WITH_CMAKE');
|
||||
|
||||
android {
|
||||
namespace = "org.libsdl.app"
|
||||
ndkVersion '28.0.13004108'
|
||||
compileSdkVersion 35
|
||||
defaultConfig {
|
||||
applicationId "org.legoisland.Isle"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 35
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
versionName "0.1"
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
arguments "APP_PLATFORM=android-21"
|
||||
// abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
abiFilters 'arm64-v8a'
|
||||
}
|
||||
cmake {
|
||||
arguments "-DANDROID_PLATFORM=android-21", "-DANDROID_STL=c++_static"
|
||||
// abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
abiFilters 'arm64-v8a'
|
||||
arguments "-DANDROID_PLATFORM=android-21", "-DANDROID_STL=c++_static", "-DISLE_BUILD_CONFIG=OFF"
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
}
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
debug {
|
||||
applicationIdSuffix ".dev"
|
||||
}
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
@ -40,15 +37,10 @@ android {
|
||||
jniLibs.srcDir 'libs'
|
||||
}
|
||||
externalNativeBuild {
|
||||
if (buildWithCMake) {
|
||||
cmake {
|
||||
path 'jni/CMakeLists.txt'
|
||||
path '../../CMakeLists.txt'
|
||||
version "3.31.6+"
|
||||
}
|
||||
} else {
|
||||
ndkBuild {
|
||||
path 'jni/Android.mk'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -10,23 +10,23 @@
|
||||
<!-- Touchscreen support -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.touchscreen"
|
||||
android:required="false" />
|
||||
android:required="true" />
|
||||
|
||||
<!-- Game controller support -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.bluetooth"
|
||||
android:required="false" />
|
||||
android:required="true" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.gamepad"
|
||||
android:required="false" />
|
||||
android:required="true" />
|
||||
<uses-feature
|
||||
android:name="android.hardware.usb.host"
|
||||
android:required="false" />
|
||||
android:required="true" />
|
||||
|
||||
<!-- External mouse input events -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.type.pc"
|
||||
android:required="false" />
|
||||
android:required="true" />
|
||||
|
||||
<!-- Audio recording support -->
|
||||
<!-- if you want to record audio, uncomment this. -->
|
||||
@ -77,11 +77,12 @@
|
||||
<meta-data android:name="SDL_ENV.SDL_ANDROID_TRAP_BACK_BUTTON" android:value="0"/>
|
||||
-->
|
||||
|
||||
<activity android:name="SDLActivity"
|
||||
<activity android:name="org.legoisland.Isle.IsleSDLActivity"
|
||||
android:label="@string/app_name"
|
||||
android:alwaysRetainTaskState="true"
|
||||
android:launchMode="singleInstance"
|
||||
android:configChanges="layoutDirection|locale|grammaticalGender|fontScale|fontWeightAdjustment|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
|
||||
android:screenOrientation="landscape"
|
||||
android:preferMinimalPostProcessing="true"
|
||||
android:exported="true"
|
||||
>
|
||||
|
||||
BIN
android-project/app/src/main/ic_launcher-playstore.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
@ -0,0 +1,13 @@
|
||||
package org.legoisland.Isle;
|
||||
|
||||
import org.libsdl.app.SDLActivity;
|
||||
|
||||
public class IsleSDLActivity extends SDLActivity {
|
||||
protected String[] getLibraries() {
|
||||
return new String[] {
|
||||
"SDL3",
|
||||
"lego1",
|
||||
"isle"
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,141 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="180"
|
||||
android:viewportHeight="180">
|
||||
<group android:scaleX="0.47"
|
||||
android:scaleY="0.47"
|
||||
android:translateX="47.7"
|
||||
android:translateY="47.7">
|
||||
<path
|
||||
android:pathData="M16.09,16.09m-16.09,0a16.09,16.09 0,1 1,32.18 0a16.09,16.09 0,1 1,-32.18 0"
|
||||
android:strokeWidth="6.09858"
|
||||
android:fillColor="#ffff00"/>
|
||||
<path
|
||||
android:pathData="M9.23,38.09L9.23,65.53"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="9.15"
|
||||
android:fillColor="#ffff00"
|
||||
android:strokeColor="#ffff00"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="m66.61,9.11l-27.44,0"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="9.15"
|
||||
android:fillColor="#ffff00"
|
||||
android:strokeColor="#ffff00"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M21.86,39.44 L29.29,61.95"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="9.15"
|
||||
android:fillColor="#ffff00"
|
||||
android:strokeColor="#ffff00"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="m33.06,32.76 l19.56,13.39"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="9.15"
|
||||
android:fillColor="#ffff00"
|
||||
android:strokeColor="#ffff00"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="m38.74,20.71 l22.48,7.51"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="9.15"
|
||||
android:fillColor="#ffff00"
|
||||
android:strokeColor="#ffff00"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M31.84,157.94l131.47,0l0,18.05l-131.47,0z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="8.01"
|
||||
android:fillColor="#ffff00"
|
||||
android:strokeColor="#ffff00"
|
||||
android:strokeLineCap="butt"/>
|
||||
<path
|
||||
android:pathData="M31.84,79.75l131.47,0l0,18.05l-131.47,0z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="8.01"
|
||||
android:fillColor="#ffff00"
|
||||
android:strokeColor="#ffff00"
|
||||
android:strokeLineCap="butt"/>
|
||||
<path
|
||||
android:pathData="M31.84,131.88l131.47,0l0,18.05l-131.47,0z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="8.01"
|
||||
android:fillColor="#ff0000"
|
||||
android:strokeColor="#ff0000"
|
||||
android:strokeLineCap="butt"/>
|
||||
<path
|
||||
android:pathData="M31.84,105.81l131.47,0l0,18.05l-131.47,0z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="8.01"
|
||||
android:fillColor="#0000ff"
|
||||
android:strokeColor="#0000ff"
|
||||
android:strokeLineCap="butt"/>
|
||||
<path
|
||||
android:pathData="M70.06,80.85l55.04,0l0,68.99l-55.04,0z"
|
||||
android:strokeLineJoin="miter"
|
||||
android:strokeWidth="8.91"
|
||||
android:fillColor="#000000"
|
||||
android:strokeColor="#000000"
|
||||
android:strokeLineCap="butt"/>
|
||||
<path
|
||||
android:pathData="M72.74,85.31l20.36,0l0,24.52l-20.36,0z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="3.04"
|
||||
android:fillColor="#00ffff"
|
||||
android:strokeColor="#00ffff"
|
||||
android:strokeLineCap="butt"/>
|
||||
<path
|
||||
android:pathData="M101.96,85.31l20.36,0l0,24.52l-20.36,0z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="3.04"
|
||||
android:fillColor="#00ffff"
|
||||
android:strokeColor="#00ffff"
|
||||
android:strokeLineCap="butt"/>
|
||||
<path
|
||||
android:pathData="M72.89,116.22l20.06,0l0,30.02l-20.06,0z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="3.34"
|
||||
android:fillColor="#00ffff"
|
||||
android:strokeColor="#00ffff"
|
||||
android:strokeLineCap="butt"/>
|
||||
<path
|
||||
android:pathData="M102.11,116.22l20.06,0l0,30.02l-20.06,0z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="3.34"
|
||||
android:fillColor="#00ffff"
|
||||
android:strokeColor="#00ffff"
|
||||
android:strokeLineCap="butt"/>
|
||||
<path
|
||||
android:pathData="M131.19,7.33L131.19,55.6"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4.57"
|
||||
android:fillColor="#ff0000"
|
||||
android:strokeColor="#000000"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="m111.99,3.21 l38.38,29.26"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4.57"
|
||||
android:fillColor="#ff0000"
|
||||
android:strokeColor="#000000"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="m115.82,19.64 l30.2,23.02"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="4.57"
|
||||
android:fillColor="#ff0000"
|
||||
android:strokeColor="#000000"
|
||||
android:strokeLineCap="round"/>
|
||||
<path
|
||||
android:pathData="M19.99,75.94H173.06L150.4,51.32h-7.63l-5.02,6.19h-7.47l-4.27,-8.06h-7.59l-4.57,8.06h-8l-4.69,-8.06h-7.44l-4.18,8.06h-8.45l-3.9,-8.06h-7.23l-4.36,8.06h-8.61l-5.45,-6.19h-6.08z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="3.04929"
|
||||
android:fillColor="#ff0000"
|
||||
android:strokeColor="#ff0000"
|
||||
android:strokeLineCap="butt"/>
|
||||
</group>
|
||||
</vector>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 2.6 KiB |
BIN
android-project/app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
BIN
android-project/app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
BIN
android-project/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 6.7 KiB |
BIN
android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 14 KiB |
BIN
android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 10 KiB |
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#39A0D9</color>
|
||||
</resources>
|
||||
@ -1,3 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">Game</string>
|
||||
<string name="app_name">LEGO Island</string>
|
||||
</resources>
|
||||
|
||||
@ -6,7 +6,7 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.7.3'
|
||||
classpath 'com.android.tools.build:gradle:8.11.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#Thu Nov 11 18:20:34 PST 2021
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@ -39,18 +39,18 @@ if(OpenGL_FOUND AND NOT WINDOWS_STORE)
|
||||
src/d3drm/backends/opengl1/renderer.cpp
|
||||
)
|
||||
target_compile_definitions(miniwin PRIVATE USE_OPENGL1)
|
||||
target_link_libraries(miniwin PRIVATE OpenGL::GL)
|
||||
target_link_libraries(miniwin PRIVATE ${OPENGL_LIBRARIES})
|
||||
else()
|
||||
message(STATUS "🧩 OpenGL 1.x support not enabled — needs OpenGL")
|
||||
endif()
|
||||
|
||||
find_library(OPENGL_ES2_LIBRARY NAMES GLESv2)
|
||||
if(EMSCRIPTEN OR OPENGL_ES2_LIBRARY AND NOT WINDOWS_STORE)
|
||||
message(STATUS "Found OpenGL: enabling OpenGL ES 2.x renderer")
|
||||
if(EMSCRIPTEN OR (OPENGL_ES2_LIBRARY AND NOT WINDOWS_STORE))
|
||||
message(STATUS "Found OpenGL ES 2.x: enabling OpenGL ES 2.x renderer")
|
||||
target_sources(miniwin PRIVATE src/d3drm/backends/opengles2/renderer.cpp)
|
||||
target_compile_definitions(miniwin PRIVATE USE_OPENGLES2)
|
||||
if(OPENGL_ES2_LIBRARY)
|
||||
target_link_libraries(miniwin PRIVATE OpenGL::GL)
|
||||
target_link_libraries(miniwin PRIVATE ${OPENGL_ES2_LIBRARY})
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "🧩 OpenGL ES 2.x support not enabled")
|
||||
|
||||