mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 23:52:35 +00:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user