Class: HighScoreScene
Constant Summary collapse
- WIDTH =
10
- HEIGHT =
20
- BLOCK_SIZE =
pixels
20
Instance Attribute Summary
Attributes inherited from Scene
Instance Method Summary collapse
- #add_score(score) ⇒ Object
- #button_down(id) ⇒ Object
- #draw ⇒ Object
-
#initialize(window) ⇒ HighScoreScene
constructor
A new instance of HighScoreScene.
Methods inherited from Scene
Constructor Details
#initialize(window) ⇒ HighScoreScene
Returns a new instance of HighScoreScene.
156 157 158 159 160 |
# File 'lib/scene.rb', line 156 def initialize(window) super(window) @list = [0] end |
Instance Method Details
#add_score(score) ⇒ Object
162 163 164 165 |
# File 'lib/scene.rb', line 162 def add_score(score) @list.append(score) @list = @list.sort.reverse end |
#button_down(id) ⇒ Object
167 168 169 |
# File 'lib/scene.rb', line 167 def (id) @window. if id == Gosu::KB_ESCAPE end |
#draw ⇒ Object
171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/scene.rb', line 171 def draw i = 1 x = 150 y = 10 @list.each do |l| @window.font.draw_text("#{i}. #{l}", x, y, ZOrder::UI, 1.0, 1.0, Gosu::Color::YELLOW) i += 1 y += 50 return if i >= 10 end end |