Skip to content

Commit e817cf1

Browse files
committed
Implement back in Main.preInit and Dark Mode Window
1 parent 1e62129 commit e817cf1

File tree

19 files changed

+36
-10796
lines changed

19 files changed

+36
-10796
lines changed

source/funkin/backend/system/Main.hx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ class Main extends Sprite
5858
// You can pretty much ignore everything from here on - your code should go in your states.
5959

6060
public static function preInit() {
61+
#if sys
6162
funkin.backend.utils.NativeAPI.registerAsDPICompatible();
6263
funkin.backend.system.CommandLineHandler.parseCommandLine(Sys.args());
6364
funkin.backend.system.Main.fixWorkingDirectory();
65+
#end
6466
}
6567

6668
public function new()

source/funkin/backend/system/macros/Macros.hx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class Macros {
5858

5959
final macroPath = 'funkin.backend.system.macros.Macros';
6060
Compiler.addMetadata('@:build($macroPath.buildLimeAssetLibrary())', 'lime.utils.AssetLibrary');
61+
Compiler.addMetadata('@:build($macroPath.buildLimeApplication())', 'lime.app.Application');
62+
Compiler.addMetadata('@:build($macroPath.buildLimeWindow())', 'lime.ui.Window');
6163

6264
//Adds Compat for #if hscript blocks when you have hscript improved
6365
if (Context.defined("hscript_improved") && !Context.defined("hscript")) {
@@ -72,5 +74,37 @@ class Macros {
7274

7375
return fields;
7476
}
77+
78+
public static function buildLimeApplication():Array<Field> {
79+
final fields:Array<Field> = Context.getBuildFields(), pos:Position = Context.currentPos();
80+
for (f in fields) switch (f.kind) {
81+
case FFun(func): switch (f.name) {
82+
case "exec": switch (func.expr.expr) {
83+
case EBlock(exprs): exprs.push(macro funkin.backend.system.Main.preInit());
84+
default:
85+
}
86+
}
87+
default:
88+
}
89+
90+
return fields;
91+
}
92+
93+
public static function buildLimeWindow():Array<Field> {
94+
final fields:Array<Field> = Context.getBuildFields(), pos:Position = Context.currentPos();
95+
if (!Context.defined("DARK_MODE_WINDOW")) return fields;
96+
97+
for (f in fields) switch (f.kind) {
98+
case FFun(func): switch (f.name) {
99+
case "new": switch (func.expr.expr) {
100+
case EBlock(exprs): exprs.push(macro funkin.backend.utils.NativeAPI.setDarkMode(title, true));
101+
default:
102+
}
103+
}
104+
default:
105+
}
106+
107+
return fields;
108+
}
75109
}
76110
#end

source/haxe/Timer.hx

Lines changed: 0 additions & 297 deletions
This file was deleted.

0 commit comments

Comments
 (0)