diff --git a/source/funkin/input/PreciseInputManager.hx b/source/funkin/input/PreciseInputManager.hx index 11a3c2007..7e6a6569b 100644 --- a/source/funkin/input/PreciseInputManager.hx +++ b/source/funkin/input/PreciseInputManager.hx @@ -28,10 +28,6 @@ class PreciseInputManager extends FlxKeyManager return instance ?? (instance = new PreciseInputManager()); } - static final MS_TO_US:Int64 = 1000; - static final US_TO_NS:Int64 = 1000; - static final MS_TO_NS:Int64 = MS_TO_US * US_TO_NS; - static final DIRECTIONS:Array = [NoteDirection.LEFT, NoteDirection.DOWN, NoteDirection.UP, NoteDirection.RIGHT]; public var onInputPressed:FlxTypedSignalVoid>; @@ -101,11 +97,11 @@ class PreciseInputManager extends FlxKeyManager // NOTE: This timestamp isn't that precise on standard HTML5 builds. // This is because of browser safeguards against timing attacks. // See https://web.dev/coop-coep to enable headers which allow for more precise timestamps. - return js.Browser.window.performance.now() * MS_TO_NS; + return haxe.Int64.fromFloat(js.Browser.window.performance.now() * Constants.NS_PER_MS); #elseif cpp // NOTE: If the game hard crashes on this line, rebuild Lime! // `lime rebuild windows -clean` - return lime._internal.backend.native.NativeCFFI.lime_sdl_get_ticks() * MS_TO_NS; + return lime._internal.backend.native.NativeCFFI.lime_sdl_get_ticks() * Constants.NS_PER_MS; #else throw "Eric didn't implement precise timestamps on this platform!"; #end @@ -176,7 +172,7 @@ class PreciseInputManager extends FlxKeyManager // TODO: Remove this line with SDL3 when timestamps change meaning. // This is because SDL3's timestamps are measured in nanoseconds, not milliseconds. - timestamp *= MS_TO_NS; + timestamp *= Constants.NS_PER_MS; updateKeyStates(key, true); @@ -198,7 +194,7 @@ class PreciseInputManager extends FlxKeyManager // TODO: Remove this line with SDL3 when timestamps change meaning. // This is because SDL3's timestamps are measured in nanoseconds, not milliseconds. - timestamp *= MS_TO_NS; + timestamp *= Constants.NS_PER_MS; updateKeyStates(key, false);