physics
E. Almqvist 3 years ago
parent d8a646621b
commit c35923e368
  1. 33
      src/app.rb
  2. 14
      src/config.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)
# if( @world && @world.controller ) then
# @world.controller.button_down?(id)
# end
end
private def broadcast_event(event)
end
def update

@ -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
}

Loading…
Cancel
Save