Class: Core::States::IngameMenu

Inherits:
State show all
Includes:
Core, GUI
Defined in:
lib/states/menus/ingame.rb

Constant Summary

Constants included from Core

CURSOR_Z, DEFAULT_CONFIG, DEFAULT_FONT, FOG_Z, GUI_Z, HOME_PATH, LIBRARY_PATH, MAPOBJECT_Z, MAP_Z, PARTICLE_Z, RELEASE, Core::SAVE_DIR, VERSION

Instance Attribute Summary

Attributes inherited from State

#window, #x, #y

Instance Method Summary collapse

Methods included from Core

anim, animations, animations=, between?, config, exit, font, inside?, load_game, mouse_inside?, multiline, particles, particles=, save_game, silently, sprite, tiles, window, window=

Methods inherited from State

#draw_cursor, #finish, #update_cursor

Constructor Details

#initialize(window, party) ⇒ IngameMenu

Returns a new instance of IngameMenu.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/states/menus/ingame.rb', line 7

def initialize(window, party)
  super(window)
  @background = Core.sprite("menu/ingame_background")
  @w = Core::GUI::Window.new(0, 0, 1024, 768, Trans.menu(:menu))
  @w.add(:items, Button.new(32, 32, 224, 32, Trans.menu(:items), lambda {}))
  @w.add(:equip, Button.new(32, 96, 224, 32, Trans.menu(:equipment), lambda { @window.advance(EquipMenu.new(@window, self, party)) }))
  @w.add(:skills, Button.new(32, 160, 224, 32, Trans.menu(:skills), lambda {}))
  @w.add(:alchemy, Button.new(32, 224, 224, 32, Trans.menu(:botany), lambda { @window.advance(AlchemyMenu.new(@window, self, party)) }))
  @w.add(:magic, Button.new(32, 284, 224, 32, Trans.menu(:magic), lambda { @window.advance(MagicMenu.new(@window, self, party)) }))
  @w.add(:save, Button.new(32, 552, 224, 32, Trans.menu(:save), lambda { Core.save_game }))
  @w.add(:load, Button.new(32, 616, 224, 32, Trans.menu(:load), lambda { Core.load_game }))
  @w.add(:options, Button.new(32, 680, 224, 32, Trans.menu(:options), lambda {}))
end

Instance Method Details

#drawObject



27
28
29
30
31
# File 'lib/states/menus/ingame.rb', line 27

def draw
  @background.draw(0, 0, 0)
  @w.draw
  draw_cursor
end

#updateObject



20
21
22
23
24
25
26
# File 'lib/states/menus/ingame.rb', line 20

def update
  if @window.pressed?(Gosu::KbEscape) or @w.remove?
    @window.load
  end
  update_cursor
  @w.update
end