Просмотр исходного кода

fixed isPressed/isReleased with new frame counter

ncannasse 7 лет назад
Родитель
Сommit
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() {