android fixes

This commit is contained in:
RandomityGuy 2023-06-01 14:45:32 +05:30
parent 27975d99bc
commit a39d3137fc
5 changed files with 10 additions and 4 deletions

View file

@ -57,11 +57,16 @@ class Main extends hxd.App {
});
#end
trace("ResourceLoader::init");
ResourceLoader.init(s2d, () -> {
trace("Settings::init");
Settings.init();
trace("Gamepad::init");
Gamepad.init();
trace("AudioManager::init");
AudioManager.init();
AudioManager.playShell();
trace("MarbleGame::new");
marbleGame = new MarbleGame(s2d, s3d);
MarbleGame.canvas.setContent(new MainMenuGui());

View file

@ -44,7 +44,7 @@ class ResourceLoader {
// static var threadPool:FixedThreadPool = new FixedThreadPool(4);
public static function init(scene2d:h2d.Scene, onLoadedFunc:Void->Void) {
#if hl
#if (hl && !android)
@:privateAccess @:privateAccess cast(fileSystem, LocalFileSystem).convert.tmpDir = "data/tmp/";
#end
hxd.res.Resource.LIVE_UPDATE = false; // Disable live update to save frames

View file

@ -180,7 +180,7 @@ class Settings {
#end
public static function applySettings() {
#if hl
#if (hl && !android)
Window.getInstance().resize(optionsSettings.screenWidth, optionsSettings.screenHeight);
Window.getInstance().displayMode = optionsSettings.isFullScreen ? FullscreenResize : Windowed;
#end
@ -336,7 +336,7 @@ class Settings {
public static function init() {
load();
#if hl
Window.getInstance().resize(optionsSettings.screenWidth, optionsSettings.screenHeight);
Window.getInstance().resize(Window.getInstance().width, Window.getInstance().height);
Window.getInstance().displayMode = optionsSettings.isFullScreen ? FullscreenResize : Windowed;
uiScale = 1 / Window.getInstance().windowToPixelRatio;
#end

View file

@ -80,6 +80,7 @@ class ManifestEntry extends FileEntry {
#if (sys && !android)
return sys.io.File.getBytes(file);
#elseif android
trace('Trying to get bytes for ${name}');
bytes = AssetsTools.getBytes(file);
return bytes;
#else

View file

@ -450,7 +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;
mat.mainPass.culling = Back;
if (mat.blendMode != Alpha && mat.blendMode != Add)
mat.mainPass.addShader(new AlphaChannel());
}