diff --git a/src/app.rb b/src/app.rb index e2c15c0..0847cf3 100755 --- a/src/app.rb +++ b/src/app.rb @@ -82,9 +82,9 @@ class Window < Gosu::Window @key_events[:down].delete(id) # when the key is released: stop holding it @key_events[:up] << id # append the key event to the queue - if( @world && @world.controller ) then - @world.controller.button_up(id) - end +# if( @world && @world.controller ) then +# @world.controller.button_up(id) +# end end def button_down(id) @@ -92,29 +92,32 @@ class Window < Gosu::Window print "down: " p id - if( id == BIND_PAUSE ) then - @freeze = !@freeze - end - - if( @world && @world.controller ) then - @world.controller.button_down(id) - end +# if( id == BIND_PAUSE ) then +# @freeze = !@freeze +# end +# +# if( @world && @world.controller ) then +# @world.controller.button_down(id) +# end end def button_up?(id) super id - if( @world && @world.controller ) then - @world.controller.button_up?(id) - end +# if( @world && @world.controller ) then +# @world.controller.button_up?(id) +# end end def button_down?(id) super id - if( @world && @world.controller ) then - @world.controller.button_down?(id) - end +# if( @world && @world.controller ) then +# @world.controller.button_down?(id) +# end + end + + private def broadcast_event(event) end def update diff --git a/src/config.rb b/src/config.rb index 6cc7bf5..d6ece28 100644 --- a/src/config.rb +++ b/src/config.rb @@ -17,3 +17,17 @@ MAIN_FONT = "monospace" BIND_INCREASE_THRUST = Gosu::KbUp BIND_DECREASE_THRUST = Gosu::KbDown BIND_TOGGLE_ENGINE = Gosu::KbSpace + +# Key events +KEY_EVENTS = { + # UI + BIND_PAUSE => :pause, + + # Player Controlls + BIND_TURN_LEFT => :turn_left, + BIND_TURN_RIGHT => :turn_right, + BIND_INCREASE_THRUST => :increase_thrust, + BIND_DECREASE_THRUST => :decrease_thrust, + BIND_TOGGLE_ENGINE => :toggle_engine +} +