Removed usages of Gosu.button_down? in InputMapper allowing for 'virtual input' support, tacked on demo support (recording and playback of camera yaw and pitch along with all key events in Game.), Camera now sets @game_object.y_rotation instead of @game_object setting Camera.yaw in Camera.position_camera.

This commit is contained in:
2019-02-17 20:06:48 -06:00
parent 5a97d292c0
commit 8d83901237
4 changed files with 133 additions and 28 deletions

View File

@@ -1,6 +1,15 @@
class IMICFPS
class InputMapper
@@keymap = {}
@@keys = Hash.new(false)
def self.keydown(id)
@@keys[id] = true
end
def self.keyup(id)
@@keys[id] = false
end
def self.get(category, action)
key = @@keymap.dig(category, action)
@@ -23,10 +32,10 @@ class IMICFPS
if keys.is_a?(Array)
keys.detect do |key|
Gosu.button_down?(key)
@@keys[key]
end
else
Gosu.button_down?(keys)
@@keys[keys]
end
end