From 35ba5663a1ff9b9d95bf2c10e843156c17be4801 Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Mon, 15 Jul 2024 23:10:08 -0400 Subject: [PATCH 1/5] uncapped framerate on web --- source/Main.hx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/Main.hx b/source/Main.hx index add5bbc67..0e5ed0c31 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -66,6 +66,18 @@ class Main extends Sprite function init(?event:Event):Void { + #if web + untyped js.Syntax.code(" + window.requestAnimationFrame = function(callback, element) { + var currTime = new Date().getTime(); + var timeToCall = 0; + var id = window.setTimeout(function() { callback(currTime + timeToCall); }, + timeToCall); + lastTime = currTime + timeToCall; + return id; + }"); + #end + if (hasEventListener(Event.ADDED_TO_STAGE)) { removeEventListener(Event.ADDED_TO_STAGE, init); From 34e93fa95a464656b5e7742a74d9f76fd5a7e4d1 Mon Sep 17 00:00:00 2001 From: FabsTheFabs <flamingkitty24@gmail.com> Date: Tue, 10 Sep 2024 07:25:11 +0100 Subject: [PATCH 2/5] color util (with just one function lol) --- source/funkin/util/FlxColorUtil.hx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 source/funkin/util/FlxColorUtil.hx diff --git a/source/funkin/util/FlxColorUtil.hx b/source/funkin/util/FlxColorUtil.hx new file mode 100644 index 000000000..429d536d8 --- /dev/null +++ b/source/funkin/util/FlxColorUtil.hx @@ -0,0 +1,22 @@ +package funkin.util; + +import flixel.util.FlxColor; + +/** + * Non inline FlxColor functions for use in hscript files + */ +class FlxColorUtil +{ + /** + * Get an interpolated color based on two different colors. + * + * @param Color1 The first color + * @param Color2 The second color + * @param Factor Value from 0 to 1 representing how much to shift Color1 toward Color2 + * @return The interpolated color + */ + public static function interpolate(Color1:FlxColor, Color2:FlxColor, Factor:Float = 0.5):FlxColor + { + return FlxColor.interpolate(Color1, Color2, Factor); + } +} From 03d9416ab16ab07f6a3552dd3938555a5f8edd34 Mon Sep 17 00:00:00 2001 From: FabsTheFabs <flamingkitty24@gmail.com> Date: Tue, 10 Sep 2024 07:26:15 +0100 Subject: [PATCH 3/5] texture swap shader --- source/funkin/graphics/shaders/TextureSwap.hx | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 source/funkin/graphics/shaders/TextureSwap.hx diff --git a/source/funkin/graphics/shaders/TextureSwap.hx b/source/funkin/graphics/shaders/TextureSwap.hx new file mode 100644 index 000000000..65de87ea3 --- /dev/null +++ b/source/funkin/graphics/shaders/TextureSwap.hx @@ -0,0 +1,48 @@ +package funkin.graphics.shaders; + +import flixel.system.FlxAssets.FlxShader; +import flixel.util.FlxColor; +import openfl.display.BitmapData; + +class TextureSwap extends FlxShader +{ + public var swappedImage(default, set):BitmapData; + public var amount(default, set):Float; + + function set_swappedImage(_bitmapData:BitmapData):BitmapData + { + image.input = _bitmapData; + + return _bitmapData; + } + + function set_amount(val:Float):Float + { + fadeAmount.value = [val]; + + return val; + } + + @:glFragmentSource(' + #pragma header + + uniform sampler2D image; + uniform float fadeAmount; + + void main() + { + vec4 tex = flixel_texture2D(bitmap, openfl_TextureCoordv); + vec4 tex2 = flixel_texture2D(image, openfl_TextureCoordv); + + vec4 finalColor = mix(tex, vec4(tex2.rgb, tex.a), fadeAmount); + + gl_FragColor = finalColor; + } + ') + public function new() + { + super(); + + this.amount = 1; + } +} From ee78178b20bb90b04f83504b26f533f9be03d6ee Mon Sep 17 00:00:00 2001 From: FabsTheFabs <flamingkitty24@gmail.com> Date: Tue, 10 Sep 2024 07:30:24 +0100 Subject: [PATCH 4/5] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 5a4dea425..aaa449a55 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 5a4dea425190d192f4f242a189a8daf5779efb8b +Subproject commit aaa449a55f9ab46463328074b9e3afc322aeb1ed From e5a788de7ddae5e533147c0c17bd54a9bc5d6987 Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Tue, 10 Sep 2024 20:22:44 -0400 Subject: [PATCH 5/5] change xargs input --- .github/actions/setup-haxe/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-haxe/action.yml b/.github/actions/setup-haxe/action.yml index 438f330a2..a6c21f6a9 100644 --- a/.github/actions/setup-haxe/action.yml +++ b/.github/actions/setup-haxe/action.yml @@ -82,7 +82,8 @@ runs: with: run: | git config --global --name-only --get-regexp 'url\.https\:\/\/x-access-token:.+@github\.com\/\.insteadOf' \ - | xargs git config --global --unset + | xargs -I {} git config --global --unset {} + git config -l --show-scope --show-origin git config --global 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' https://github.com/ post: git config --global --unset 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf'