Working on Android build
This commit is contained in:
parent
e773b51985
commit
e5e3d7bb28
@ -1 +1 @@
|
|||||||
### Перед запуском в папке ```app/jni/```(рядом с src) нужно создать три папки с исходниками библиотек ```libpng```, ```SDL```, ```zlib```
|
### Android version
|
||||||
|
|||||||
@ -9,7 +9,7 @@ else {
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
if (buildAsApplication) {
|
if (buildAsApplication) {
|
||||||
namespace "org.libsdl.app"
|
namespace "fishrungames.shadowoverbishkek"
|
||||||
}
|
}
|
||||||
compileSdkVersion 37
|
compileSdkVersion 37
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
@ -62,7 +62,7 @@ android {
|
|||||||
libraryVariants.all { variant ->
|
libraryVariants.all { variant ->
|
||||||
variant.outputs.all { output ->
|
variant.outputs.all { output ->
|
||||||
if (output.outputFileName != null && output.outputFileName.endsWith(".aar")) {
|
if (output.outputFileName != null && output.outputFileName.endsWith(".aar")) {
|
||||||
output.outputFileName = "org.libsdl.app.aar"
|
output.outputFileName = "fishrungames.shadowoverbishkek.aar"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,5 +70,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
implementation 'androidx.core:core-splashscreen:1.0.1'
|
||||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
}
|
}
|
||||||
|
|||||||
12
proj-android/app/proguard-rules.pro
vendored
12
proj-android/app/proguard-rules.pro
vendored
@ -16,18 +16,18 @@
|
|||||||
# public *;
|
# public *;
|
||||||
#}
|
#}
|
||||||
|
|
||||||
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLInputConnection {
|
-keep,includedescriptorclasses,allowoptimization class fishrungames.shadowoverbishkek.SDLInputConnection {
|
||||||
void nativeCommitText(java.lang.String, int);
|
void nativeCommitText(java.lang.String, int);
|
||||||
void nativeGenerateScancodeForUnichar(char);
|
void nativeGenerateScancodeForUnichar(char);
|
||||||
}
|
}
|
||||||
|
|
||||||
-keep,includedescriptorclasses class org.libsdl.app.SDLActivity {
|
-keep,includedescriptorclasses class fishrungames.shadowoverbishkek.SDLActivity {
|
||||||
# for some reason these aren't compatible with allowoptimization modifier
|
# for some reason these aren't compatible with allowoptimization modifier
|
||||||
boolean supportsRelativeMouse();
|
boolean supportsRelativeMouse();
|
||||||
void setWindowStyle(boolean);
|
void setWindowStyle(boolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLActivity {
|
-keep,includedescriptorclasses,allowoptimization class fishrungames.shadowoverbishkek.SDLActivity {
|
||||||
java.lang.String nativeGetHint(java.lang.String); # Java-side doesn't use this, so it gets minified, but C-side still tries to register it
|
java.lang.String nativeGetHint(java.lang.String); # Java-side doesn't use this, so it gets minified, but C-side still tries to register it
|
||||||
boolean onNativeSoftReturnKey();
|
boolean onNativeSoftReturnKey();
|
||||||
void onNativeKeyboardFocusLost();
|
void onNativeKeyboardFocusLost();
|
||||||
@ -62,7 +62,7 @@
|
|||||||
boolean showTextInput(int, int, int, int);
|
boolean showTextInput(int, int, int, int);
|
||||||
}
|
}
|
||||||
|
|
||||||
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.HIDDeviceManager {
|
-keep,includedescriptorclasses,allowoptimization class fishrungames.shadowoverbishkek.HIDDeviceManager {
|
||||||
boolean initialize(boolean, boolean);
|
boolean initialize(boolean, boolean);
|
||||||
boolean openDevice(int);
|
boolean openDevice(int);
|
||||||
int sendOutputReport(int, byte[]);
|
int sendOutputReport(int, byte[]);
|
||||||
@ -71,7 +71,7 @@
|
|||||||
void closeDevice(int);
|
void closeDevice(int);
|
||||||
}
|
}
|
||||||
|
|
||||||
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLAudioManager {
|
-keep,includedescriptorclasses,allowoptimization class fishrungames.shadowoverbishkek.SDLAudioManager {
|
||||||
int[] getAudioOutputDevices();
|
int[] getAudioOutputDevices();
|
||||||
int[] getAudioInputDevices();
|
int[] getAudioInputDevices();
|
||||||
int[] audioOpen(int, int, int, int, int);
|
int[] audioOpen(int, int, int, int, int);
|
||||||
@ -90,7 +90,7 @@
|
|||||||
native void addAudioDevice(boolean, int);
|
native void addAudioDevice(boolean, int);
|
||||||
}
|
}
|
||||||
|
|
||||||
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLControllerManager {
|
-keep,includedescriptorclasses,allowoptimization class fishrungames.shadowoverbishkek.SDLControllerManager {
|
||||||
void pollInputDevices();
|
void pollInputDevices();
|
||||||
void pollHapticDevices();
|
void pollHapticDevices();
|
||||||
void hapticRun(int, float, int);
|
void hapticRun(int, float, int);
|
||||||
|
|||||||
@ -52,7 +52,7 @@
|
|||||||
<!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->
|
<!-- <uses-permission android:name="android.permission.RECORD_AUDIO" /> -->
|
||||||
|
|
||||||
<!-- Create a Java class extending SDLActivity and place it in a
|
<!-- Create a Java class extending SDLActivity and place it in a
|
||||||
directory under app/src/main/java matching the package, e.g. app/src/main/java/com/gamemaker/game/MyGame.java
|
directory under shadowoverbishkek/main/java matching the package, e.g. shadowoverbishkek/main/java/com/gamemaker/game/MyGame.java
|
||||||
|
|
||||||
then replace "SDLActivity" with the name of your class (e.g. "MyGame")
|
then replace "SDLActivity" with the name of your class (e.g. "MyGame")
|
||||||
in the XML below.
|
in the XML below.
|
||||||
@ -62,14 +62,14 @@
|
|||||||
<application android:label="@string/app_name"
|
<application android:label="@string/app_name"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/Theme.App.Starting"
|
||||||
android:hardwareAccelerated="true" >
|
android:hardwareAccelerated="true" >
|
||||||
|
|
||||||
<!-- Example of setting SDL hints from AndroidManifest.xml:
|
<!-- Example of setting SDL hints from AndroidManifest.xml:
|
||||||
<meta-data android:name="SDL_ENV.SDL_ACCELEROMETER_AS_JOYSTICK" android:value="0"/>
|
<meta-data android:name="SDL_ENV.SDL_ACCELEROMETER_AS_JOYSTICK" android:value="0"/>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<activity android:name="SDLActivity"
|
<activity android:name=".ShadowOverBishkekActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:alwaysRetainTaskState="true"
|
android:alwaysRetainTaskState="true"
|
||||||
android:launchMode="singleInstance"
|
android:launchMode="singleInstance"
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
package fishrungames.shadowoverbishkek;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import androidx.core.splashscreen.SplashScreen;
|
||||||
|
import org.libsdl.app.SDLActivity;
|
||||||
|
|
||||||
|
public class ShadowOverBishkekActivity extends SDLActivity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
SplashScreen.installSplashScreen(this);
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
proj-android/app/src/main/res/drawable/splash_icon.png
(Stored with Git LFS)
Normal file
BIN
proj-android/app/src/main/res/drawable/splash_icon.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
proj-android/app/src/main/res/mipmap-hdpi/ic_launcher.png
(Stored with Git LFS)
BIN
proj-android/app/src/main/res/mipmap-hdpi/ic_launcher.png
(Stored with Git LFS)
Binary file not shown.
BIN
proj-android/app/src/main/res/mipmap-mdpi/ic_launcher.png
(Stored with Git LFS)
BIN
proj-android/app/src/main/res/mipmap-mdpi/ic_launcher.png
(Stored with Git LFS)
Binary file not shown.
BIN
proj-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
(Stored with Git LFS)
BIN
proj-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
(Stored with Git LFS)
Binary file not shown.
BIN
proj-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
(Stored with Git LFS)
BIN
proj-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
(Stored with Git LFS)
Binary file not shown.
BIN
proj-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
(Stored with Git LFS)
BIN
proj-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
(Stored with Git LFS)
Binary file not shown.
3
proj-android/app/src/main/res/values-ru/strings.xml
Normal file
3
proj-android/app/src/main/res/values-ru/strings.xml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">Тень над Бишкеком</string>
|
||||||
|
</resources>
|
||||||
@ -1,3 +1,3 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Game</string>
|
<string name="app_name">Shadow Over Bishkek</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@ -4,4 +4,13 @@
|
|||||||
<style name="AppTheme" parent="android:Theme.NoTitleBar.Fullscreen">
|
<style name="AppTheme" parent="android:Theme.NoTitleBar.Fullscreen">
|
||||||
<!-- Customize your theme here. -->
|
<!-- Customize your theme here. -->
|
||||||
</style>
|
</style>
|
||||||
|
<!-- Тема для Splash Screen -->
|
||||||
|
<style name="Theme.App.Starting" parent="Theme.SplashScreen">
|
||||||
|
<!-- Черный фон -->
|
||||||
|
<item name="windowSplashScreenBackground">#000000</item>
|
||||||
|
<!-- Ваша картинка 512x512 -->
|
||||||
|
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
||||||
|
<!-- Ссылка на основную тему, которая применится после загрузки -->
|
||||||
|
<item name="postSplashScreenTheme">@style/AppTheme</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@ -18,9 +18,9 @@ android.r8.optimizedResourceShrinking=false
|
|||||||
android.r8.strictFullModeForKeepRules=false
|
android.r8.strictFullModeForKeepRules=false
|
||||||
android.sdk.defaultTargetSdkToCompileSdkIfUnset=false
|
android.sdk.defaultTargetSdkToCompileSdkIfUnset=false
|
||||||
android.uniquePackageNames=false
|
android.uniquePackageNames=false
|
||||||
android.useAndroidX=false
|
|
||||||
android.usesSdkInManifest.disallowed=false
|
android.usesSdkInManifest.disallowed=false
|
||||||
org.gradle.jvmargs=-Xmx1536m
|
org.gradle.jvmargs=-Xmx1536m
|
||||||
|
android.useAndroidX=true
|
||||||
|
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
# When configured, Gradle will run in incubating parallel mode.
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
|
|||||||
12
proj-android/gradle/gradle-daemon-jvm.properties
Normal file
12
proj-android/gradle/gradle-daemon-jvm.properties
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#This file is generated by updateDaemonJvm
|
||||||
|
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ec7520a1e057cd116f9544c42142a16b/redirect
|
||||||
|
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/4c4f879899012ff0a8b2e2117df03b0e/redirect
|
||||||
|
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ec7520a1e057cd116f9544c42142a16b/redirect
|
||||||
|
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/4c4f879899012ff0a8b2e2117df03b0e/redirect
|
||||||
|
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/73bcfb608d1fde9fb62e462f834a3299/redirect
|
||||||
|
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/846ee0d876d26a26f37aa1ce8de73224/redirect
|
||||||
|
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ec7520a1e057cd116f9544c42142a16b/redirect
|
||||||
|
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/4c4f879899012ff0a8b2e2117df03b0e/redirect
|
||||||
|
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9482ddec596298c84656d31d16652665/redirect
|
||||||
|
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/39701d92e1756bb2f141eb67cd4c660e/redirect
|
||||||
|
toolchainVersion=21
|
||||||
@ -388,6 +388,33 @@ namespace FRG
|
|||||||
// --- Глобальные переменные логгера ---
|
// --- Глобальные переменные логгера ---
|
||||||
namespace {
|
namespace {
|
||||||
std::ofstream g_logFile;
|
std::ofstream g_logFile;
|
||||||
|
#ifdef __ANDROID__
|
||||||
|
class AndroidLogBuffer : public std::streambuf {
|
||||||
|
private:
|
||||||
|
std::string buffer;
|
||||||
|
protected:
|
||||||
|
int overflow(int c) override {
|
||||||
|
if (c == '\n') {
|
||||||
|
__android_log_print(ANDROID_LOG_INFO, "ShadowOverBishkek", "%s", buffer.c_str());
|
||||||
|
buffer.clear();
|
||||||
|
}
|
||||||
|
else if (c != EOF) {
|
||||||
|
buffer += static_cast<char>(c);
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
int sync() override {
|
||||||
|
if (!buffer.empty()) {
|
||||||
|
__android_log_print(ANDROID_LOG_INFO, "ShadowOverBishkek", "%s", buffer.c_str());
|
||||||
|
buffer.clear();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
AndroidLogBuffer g_androidLogBuffer;
|
||||||
|
std::ostream g_androidStream(&g_androidLogBuffer);
|
||||||
|
#endif
|
||||||
|
|
||||||
std::unique_ptr<TeeBuffer> g_teeBuffer;
|
std::unique_ptr<TeeBuffer> g_teeBuffer;
|
||||||
std::unique_ptr<std::ostream> g_teeStream;
|
std::unique_ptr<std::ostream> g_teeStream;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user