Explorar o código

don't automatically set wantedFPS to system FPS, WaitEvent update based on dt, not deltaT

ncannasse %!s(int64=9) %!d(string=hai) anos
pai
achega
193d458377
Modificáronse 2 ficheiros con 3 adicións e 5 borrados
  1. 1 3
      hxd/Timer.hx
  2. 2 2
      hxd/WaitEvent.hx

+ 1 - 3
hxd/Timer.hx

@@ -2,7 +2,7 @@ package hxd;
 
 class Timer {
 
-	public static var wantedFPS = 0.;
+	public static var wantedFPS = 60.;
 	public static var maxDeltaTime = 0.5;
 	public static var oldTime = haxe.Timer.stamp();
 	public static var tmod_factor = 0.95;
@@ -12,8 +12,6 @@ class Timer {
 	static var frameCount = 0;
 
 	public inline static function update() {
-		if( wantedFPS == 0 )
-			wantedFPS = hxd.System.getDefaultFrameRate();
 		frameCount++;
 		var newTime = haxe.Timer.stamp();
 		deltaT = newTime - oldTime;

+ 2 - 2
hxd/WaitEvent.hx

@@ -25,8 +25,8 @@ class WaitEvent {
 	}
 
 	public function wait( time : Float, callb ) {
-		function tmp(_) {
-			time -= hxd.Timer.deltaT;
+		function tmp(dt) {
+			time -= dt / hxd.Timer.wantedFPS;
 			if( time < 0 ) {
 				callb();
 				return true;