1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-23 13:48:23 +00:00

Merge branch 'html5-fps' into rewrite/master

This commit is contained in:
Cameron Taylor 2024-09-10 15:40:30 -04:00
commit 9c8142b769

View file

@ -66,6 +66,18 @@ class Main extends Sprite
function init(?event:Event):Void 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)) if (hasEventListener(Event.ADDED_TO_STAGE))
{ {
removeEventListener(Event.ADDED_TO_STAGE, init); removeEventListener(Event.ADDED_TO_STAGE, init);