Class: GGLib::StateObject

Inherits:
Object
  • Object
show all
Defined in:
lib/state.rb

Overview

A StaticScreen is a menu. It suspends the game and redirects all input to itself. StaticScreen is typically used through derivation, although it can be used otherwise. StaticScreen#start suspends the game and starts the menu. StaticScreen#end returns to the game.

Direct Known Subclasses

FadeScreen, MenuBase

Instance Method Summary collapse

Instance Method Details

#button_down(id) ⇒ Object

Equivalent to Gosu::Window#button_down



24
25
26
# File 'lib/state.rb', line 24

def button_down(id)
  #do nothing by default
end

#button_up(id) ⇒ Object

Equivalent to Gosu::Window#button_down



28
29
30
# File 'lib/state.rb', line 28

def button_up(id)
  #do nothing by default
end

#drawObject

Equivalent to Gosu::Window#draw



49
50
# File 'lib/state.rb', line 49

def draw
end

#endObject

Return control to the GameWindow. DO NOT OVERRIDE THIS METHOD.



15
16
17
18
19
20
21
22
# File 'lib/state.rb', line 15

def end
  onEnd
  $window.deleteAllWidgets
  $window.createWidgets
  $window.deleteAllImages
  $window.cursor.unforceVisible
  onTerminate
end

#onEndObject

This method is called when the static screen is uninitialized. It is ment to be overridden in derived classes. This is a good place to preform tasks such as stopping audio. Widgets are automatically destroyed on exit by the base class StaticScreen



44
45
# File 'lib/state.rb', line 44

def onEnd
end

#onStartObject

This method is called when the static screen is initialized. It is ment to be overridden in derived classes. This is a good place to preform tasks such as creating widgets.



40
41
# File 'lib/state.rb', line 40

def onStart
end

#onTerminateObject



46
47
# File 'lib/state.rb', line 46

def onTerminate
end

#startObject

Begin rerouting input to the static screen. DO NOT OVERRIDE THIS METHOD.



9
10
11
12
13
# File 'lib/state.rb', line 9

def start 
  $window.deleteAllImages
  $window.cursor.forceVisible
  onStart
end

#updateObject

Equivalent to Gosu::Window#update



32
33
# File 'lib/state.rb', line 32

def update
end

#windowObject

Returns a reference to the window to which the static screen is associated.



35
36
37
# File 'lib/state.rb', line 35

def window
  return $window
end