1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-15 11:22:55 +00:00

Merge branch 'rewrite/master' into bugfix/web-fixes

This commit is contained in:
Cameron Taylor 2024-09-10 23:43:26 -04:00
commit 9891dc7309
5 changed files with 85 additions and 2 deletions

View file

@ -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'

2
assets

@ -1 +1 @@
Subproject commit ebbe6a0d9a4f47786f858c2505ca27bf0760dd2e
Subproject commit cf5f2e03d6075ce078777a6338d319d0a19f7f7d

View file

@ -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);

View file

@ -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;
}
}

View file

@ -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);
}
}