Class: Smagacor::GameMenuShutter
- Defined in:
- lib/smagacor/smagacor-ui.rb
Overview
Widget for listing all installed games.
Instance Method Summary collapse
-
#init_game_list(switcher, controller) ⇒ Object
Initializes the list of games.
-
#initialize(p) ⇒ GameMenuShutter
constructor
Returns a default version of the class.
Constructor Details
#initialize(p) ⇒ GameMenuShutter
Returns a default version of the class.
35 36 37 38 |
# File 'lib/smagacor/smagacor-ui.rb', line 35 def initialize( p ) super( p, nil, 0, FRAME_SUNKEN|LAYOUT_FILL_X|LAYOUT_FILL_Y ) @categories = {} end |
Instance Method Details
#init_game_list(switcher, controller) ⇒ Object
Initializes the list of games. The switcher parameter has to be an object of class GameSwitcher. The method uses the list of games supplied by the controller object.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/smagacor/smagacor-ui.rb', line 42 def init_game_list( switcher, controller ) each_child do |child| removeChild( child ) child.destroy end controller.load_games controller.games.each do |game| @categories[game.category] ||= CategoryShutterItem.new( self, game.category ) btn = GameShutterButton.new( @categories[game.category].content, game.name ) btn.tipText = game.description btn.helpText = game.description btn.icon = SmagacorWindow.load_image( getApp(), File.join( game.directory, game.icon ) ) btn.connect( SEL_COMMAND ) { switcher.select_game( game ) } end end |