Переглянути джерело

fixed isPressed/isReleased with new frame counter

ncannasse 7 роки тому
батько
коміт
87684d9a00
1 змінених файлів з 3 додано та 3 видалено
  1. 3 3
      hxd/Key.hx

+ 3 - 3
hxd/Key.hx

@@ -130,15 +130,15 @@ class Key {
 	}
 
 	public static inline function getFrame() {
-		return hxd.Timer.frameCount + 1;
+		return hxd.Timer.frameCount;
 	}
 
 	public static function isPressed( code : Int ) {
-		return keyPressed[code] == getFrame();
+		return keyPressed[code] == getFrame() - 1;
 	}
 
 	public static function isReleased( code : Int ) {
-		return keyPressed[code] == -getFrame();
+		return keyPressed[code] == -getFrame() + 1;
 	}
 
 	public static function initialize() {