class RubyMan::Menu

title screen showing high scores

Public Instance Methods

button_down(id) click to toggle source
# File lib/ruby_man/GameObjects/menu.rb, line 62
def button_down(id)
  @game.start if id == Gosu::KbEnter || id == Gosu::KbReturn
end
created() click to toggle source
# File lib/ruby_man/GameObjects/menu.rb, line 54
def created
  @logo = Sprite['logo']
  @text = ResourceManager['text_normal']
  @large_text = ResourceManager['text_large']
  @game.add_object(MenuRubyMan.new)
  @game.add_object(MenuGhost.new)
end
draw() click to toggle source
# File lib/ruby_man/GameObjects/menu.rb, line 66
def draw
  @logo.draw_centered(@game.x_res / 2, 92)
  @large_text.draw_centered('Press Enter to start!', @game.x_res / 2, 200)
  draw_scores(@game.x_res / 2 - 192, @game.y_res / 2)
end
draw_scores(x, y) click to toggle source
# File lib/ruby_man/GameObjects/menu.rb, line 72
def draw_scores(x, y)
  y_offset = 0
  @game.scores.each do |entry|
    @text.draw(entry[0], x, y + y_offset, 0)
    @text.draw(entry[1], x + 128, y + y_offset, 0)
    @text.draw(entry[2], x + 320, y + y_offset, 0)
    y_offset += 32
  end
end