Class: Chingu::GameStates::Debug
- Inherits:
-
Chingu::GameState
- Object
- Chingu::GameState
- Chingu::GameStates::Debug
- Defined in:
- lib/chingu/game_states/debug.rb
Instance Attribute Summary
Attributes inherited from Chingu::GameState
#game_objects, #game_state_manager, #options
Attributes included from Helpers::InputDispatcher
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(options) ⇒ Debug
constructor
A new instance of Debug.
- #pause ⇒ Object
- #return_to_game ⇒ Object
- #update ⇒ Object
Methods inherited from Chingu::GameState
#button_down, #button_up, #close, #close_game, #setup, #to_s, #to_sym
Methods included from Helpers::InputClient
Methods included from Helpers::InputDispatcher
#add_input_client, #dispatch_action, #dispatch_button_down, #dispatch_button_up, #dispatch_input_for, #remove_input_client
Methods included from Helpers::GameObject
#add_game_object, #game_objects, #game_objects_of_class, #remove_game_object
Methods included from Helpers::GameState
#clear_game_states, #current_game_state, #pop_game_state, #previous_game_state, #push_game_state, #switch_game_state, #transitional_game_state
Methods included from Helpers::GFX
#fill, #fill_gradient, #fill_rect
Constructor Details
#initialize(options) ⇒ Debug
Returns a new instance of Debug.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/chingu/game_states/debug.rb', line 29 def initialize() super @white = Color.new(255,255,255,255) @fade_color = Gosu::Color.new(100,255,255,255) @font = Gosu::Font.new($window, default_font_name, 15) @paused = true self.input = {:p => :pause, :f1 => :return_to_game, :esc => :return_to_game} end |
Instance Method Details
#draw ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/chingu/game_states/debug.rb', line 52 def draw game_state_manager.previous_game_state.draw $window.draw_quad( 0,0,@fade_color, $window.width,0,@fade_color, $window.width,$window.height,@fade_color, 0,$window.height,@fade_color,10) text = "DEBUG CONSOLE" @font.draw(text, $window.width - @font.text_width(text), @font.height, 999) end |
#pause ⇒ Object
44 45 46 |
# File 'lib/chingu/game_states/debug.rb', line 44 def pause @paused = @paused ? false : true end |
#return_to_game ⇒ Object
40 41 42 |
# File 'lib/chingu/game_states/debug.rb', line 40 def return_to_game game_state_manager.pop_game_state end |
#update ⇒ Object
48 49 50 |
# File 'lib/chingu/game_states/debug.rb', line 48 def update game_state_manager.previous_game_state.update unless @paused end |