Made it possible to compile for html5 (WIP))

This commit is contained in:
NeeEoo
2023-08-19 17:56:22 +02:00
parent 8224293439
commit b184a4825d
10 changed files with 22 additions and 14 deletions
+3 -3
View File
@@ -11,10 +11,10 @@ float uBrightness = 0.6;
vec4 getColor(vec2 pos) {
vec2 ps = (pos);
if (ps.x < 0) ps.x = 0;
if (ps.x < 0.0) ps.x = 0.0;
//else if (ps.x > 1.0 - (1.0 / iResolution.x)) ps.x = 1.0 - (1.0 / iResolution.x);
else if (ps.x > 1.0) return vec4(0.0);
if (ps.y < 0) ps.y = 0;
if (ps.y < 0.0) ps.y = 0.0;
//else if (ps.y > 1.0 - (1.0 / iResolution.y)) return ps.y = 1.0 - (1.0 / iResolution.y);
else if (ps.y > 1.0) return vec4(0.0);
return flixel_texture2D(bitmap, (ps));
@@ -42,7 +42,7 @@ vec2 random(vec2 p) {
void main() {
vec2 camPos = (openfl_TextureCoordv);
//vec2 camPos = openfl_TextureCoordv;
if (camPos.x < 0 || camPos.x > 1 || camPos.y < 0 || camPos.y > 1)
if (camPos.x < 0.0 || camPos.x > 1.0 || camPos.y < 0.0 || camPos.y > 1.0)
return;
//vec4 color = getColor(camPos);
+4 -3
View File
@@ -111,8 +111,9 @@
<!-- Comment this out to disable updates !-->
<!-- <define name="UPDATE_CHECKING" unless="web || hl || neko"/> -->
<!-- Fixes thing with hl -->
<!-- Fixes thing with macros -->
<define name="HL" if="hl"/>
<define name="SYS" if="desktop"/>
<!-- Comment this out to disable Discord RPC !-->
<define name="DISCORD_RPC" unless="web || hl || neko"/>
@@ -144,10 +145,10 @@
<haxedef name="SOFTCODED_STATES" />
<!-- Comment this out to use the default OpenFL assets system for the assets/ folder. !-->
<haxedef name="USE_ADAPTED_ASSETS" />
<haxedef name="USE_ADAPTED_ASSETS" unless="web" />
<!-- Comment this out to disable support for custom ndlls. !-->
<haxedef name="NDLLS_SUPPORTED" />
<haxedef name="NDLLS_SUPPORTED" unless="web" />
<!-- Comment this out to disable support for custom extended classes (data/classes). !-->
<define name="SOFTCODED_CLASSES" />
@@ -2,6 +2,7 @@ package funkin.backend.assets;
import lime.utils.AssetLibrary;
#if sys
/**
* Used to prevent crashes
*/
@@ -36,4 +37,5 @@ class ModdableAssetsFolder extends ModsFolderLibrary {
_parsedAsset = asset.substr(prefix.length);
return true;
}
}
}
#end
@@ -1,7 +1,7 @@
package funkin.backend.system;
import sys.FileSystem;
#if sys
import sys.FileSystem;
class CommandLineHandler {
public static function parseCommandLine(cmd:Array<String>) {
var i:Int = 0;
+1 -1
View File
@@ -67,7 +67,7 @@ class Conductor
/**
* Offset of the song
*/
public static var songOffset:Float = 0;
public static var songOffset:Float = 0;
/**
* Current step
+1 -1
View File
@@ -71,7 +71,7 @@ class Main extends Sprite
addChild(game = new FunkinGame(gameWidth, gameHeight, MainState, Options.framerate, Options.framerate, skipSplash, startFullscreen));
#if !mobile
#if (!mobile && !web)
addChild(framerateSprite = new funkin.backend.system.framerate.Framerate());
framerateSprite.scaleX = framerateSprite.scaleY = stage.window.scale;
SystemInfo.init();
@@ -20,7 +20,6 @@ class ScriptsMacro {
"flixel.addons.plugin", "flixel.addons.text", "flixel.addons.tile", "flixel.addons.transition",
"flixel.addons.util",
// OTHER LIBRARIES & STUFF
"funkin",
"away3d", "flx3d",
#if VIDEO_CUTSCENES "hxcodec.flixel", "hxcodec.openfl", "hxcodec.lime", #end
// BASE HAXE
@@ -28,7 +27,7 @@ class ScriptsMacro {
])
Compiler.include(inc);
for(inc in [#if sys "sys", #end "openfl.net", "funkin.backend.system.net"]) {
for(inc in [#if SYS "sys", "openfl.net", "funkin.backend.system.net" #end]) {
#if !HL
Compiler.include(inc);
#else
@@ -37,6 +36,8 @@ class ScriptsMacro {
#end
}
Compiler.include("funkin", #if !UPDATE_CHECKING ['funkin.backend.system.updating'] #end);
// FOR ABSTRACTS
Compiler.addGlobalMetadata('haxe.xml', '@:build(hscript.UsingHandler.build())');
Compiler.addGlobalMetadata('haxe.CallStack', '@:build(hscript.UsingHandler.build())');
+2
View File
@@ -62,12 +62,14 @@ class NativeAPI {
var bg = cast(backgroundColor, Int);
Windows.setConsoleColors((bg * 16) + fg);
#else
#if sys
Sys.print("\x1b[0m");
if(foregroundColor != NONE)
Sys.print("\x1b[" + Std.int(consoleColorToANSI(foregroundColor)) + "m");
if(backgroundColor != NONE)
Sys.print("\x1b[" + Std.int(consoleColorToANSI(backgroundColor) + 10) + "m");
#end
#end
}
public static function consoleColorToANSI(color:ConsoleColor) {
@@ -8,7 +8,6 @@ import funkin.backend.chart.Chart;
import funkin.options.type.TextOption;
import funkin.options.type.IconOption;
import funkin.options.OptionsScreen;
import sys.FileSystem;
class CharacterSelection extends EditorTreeMenu
{
+4 -1
View File
@@ -34,7 +34,10 @@ class Options
public static var hitWindow:Float = 250;
public static var songOffset:Float = 0;
public static var framerate:Int = 120;
public static var gpuOnlyBitmaps:Bool = #if mac false #else true #end; // causes issues on mac
public static var gpuOnlyBitmaps:Bool =
#if mac false
#elseif !web false
#else true #end; // causes issues on mac
public static var lastLoadedMod:String = null;