android fixes

This commit is contained in:
RandomityGuy 2023-06-01 01:59:31 +05:30
parent a0e70e8ffc
commit 27975d99bc
25 changed files with 45 additions and 6 deletions

View file

@ -5,7 +5,7 @@
package="com.randomityguy.mbhaxe.mbg"
android:installLocation="auto"
android:versionCode="1"
android:versionName="1.0">
android:versionName="1.1.8">
<!-- Tell the system this app requires OpenGL ES 3.0. -->
<uses-feature android:glEsVersion="0x00030000" android:required="true" />
@ -13,12 +13,15 @@
<application android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:hardwareAccelerated="true">
android:hardwareAccelerated="true"
android:debuggable="true">
<activity android:name="org.haxe.HashLinkActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:exported="true"
android:orientation="horizontal"
android:screenOrientation="sensorLandscape"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View file

@ -162,6 +162,23 @@ class Settings {
public static var settingsDir = ".";
#end
#end
#if android
@:hlNative("Java_org_haxe_HashLinkActivity")
static function saveAndroid(name:String, data:String) {}
#end
#if android
@:hlNative("Java_org_haxe_HashLinkActivity")
static function loadAndroid(name:String):hl.Bytes {
var i = 4;
return hl.Bytes.fromValue("null", i);
}
@:hlNative static function get_storage_path():hl.Bytes {
return null;
}
#end
public static function applySettings() {
#if hl
Window.getInstance().resize(optionsSettings.screenWidth, optionsSettings.screenHeight);
@ -225,6 +242,9 @@ class Settings {
}
File.saveContent(Path.join([settingsDir, "settings.json"]), json);
#end
#if android
saveAndroid('settings', json);
#end
#if js
var localStorage = js.Browser.getLocalStorage();
if (localStorage != null) {
@ -235,20 +255,32 @@ class Settings {
public static function load() {
var settingsExists = false;
#if hl
#if (hl && !android)
settingsExists = FileSystem.exists(Path.join([settingsDir, "settings.json"]));
#end
#if android
settingsDir = @:privateAccess String.fromUTF8(get_storage_path());
#end
#if js
var localStorage = js.Browser.getLocalStorage();
if (localStorage != null) {
settingsExists = localStorage.getItem("MBHaxeSettings") != null;
}
#end
#if android
settingsExists = true;
var rawJson = @:privateAccess String.fromUTF8(loadAndroid('settings'));
if (rawJson == null || rawJson == "")
settingsExists = false;
#end
if (settingsExists) {
#if hl
#if (hl && !android)
var json = Json.parse(File.getContent(Path.join([settingsDir, "settings.json"])));
#end
#if android
var json = Json.parse(rawJson);
#end
#if js
var json = Json.parse(localStorage.getItem("MBHaxeSettings"));
#end

View file

@ -450,6 +450,7 @@ class HelpCreditsGui extends GuiImage {
dtsObj.init(null, () -> {}); // The lambda is not gonna run async anyway
for (mat in dtsObj.materials) {
mat.mainPass.enableLights = false;
mat.mainPass.culling = Front;
if (mat.blendMode != Alpha && mat.blendMode != Add)
mat.mainPass.addShader(new AlphaChannel());
}

View file

@ -129,6 +129,7 @@ class PlayMissionGui extends GuiImage {
var filt = new ColorMatrix(Matrix.I());
pmPreview.bmp.filter = filt;
#if (!android)
var replayPlayButton = new GuiImage(ResourceLoader.getResource("data/ui/play/playback.png", ResourceLoader.getImage, this.imageResources).toTile());
replayPlayButton.position = new Vector(38, 315);
replayPlayButton.extent = new Vector(18, 18);
@ -172,6 +173,7 @@ class PlayMissionGui extends GuiImage {
cast(this.parent, Canvas).pushDialog(new MessageBoxOkDlg("The next mission you play will be recorded."));
};
pmBox.addChild(replayRecordButton);
#end
var levelWnd = new GuiImage(ResourceLoader.getResource("data/ui/play/level_window.png", ResourceLoader.getImage, this.imageResources).toTile());
levelWnd.position = new Vector();