[gosuhunt] fiddling around
This commit is contained in:
parent
e6bb987641
commit
801490298c
1 changed files with 4 additions and 2 deletions
|
@ -16,6 +16,7 @@ class GosuHunt < Gosu::Window
|
||||||
@finished = false
|
@finished = false
|
||||||
@state = { dead: false, victory: false }
|
@state = { dead: false, victory: false }
|
||||||
|
|
||||||
|
@font = Gosu::Font.new( 20 )
|
||||||
@images = { explorer: Gosu::Image.from_text( '()', 20 ),
|
@images = { explorer: Gosu::Image.from_text( '()', 20 ),
|
||||||
dead_explorer: Gosu::Image.from_text( '☠ ', 20 ),
|
dead_explorer: Gosu::Image.from_text( '☠ ', 20 ),
|
||||||
door: Gosu::Image.from_text( '=>', 20 ),
|
door: Gosu::Image.from_text( '=>', 20 ),
|
||||||
|
@ -81,7 +82,7 @@ class GosuHunt < Gosu::Window
|
||||||
self.caption = "#{@field.number_of_mines} mines, #{@field.count_nearby_mines} nearby, score #{@field.score}"
|
self.caption = "#{@field.number_of_mines} mines, #{@field.count_nearby_mines} nearby, score #{@field.score}"
|
||||||
end
|
end
|
||||||
|
|
||||||
Gosu::Font.new( 20 ).draw_text( self.caption, 0, 0, 0 )
|
@font.draw_text( self.caption, 0, 0, 0 )
|
||||||
|
|
||||||
@field.height.times do |y|
|
@field.height.times do |y|
|
||||||
@field.width.times do |x|
|
@field.width.times do |x|
|
||||||
|
@ -95,7 +96,8 @@ class GosuHunt < Gosu::Window
|
||||||
@images[:mine]
|
@images[:mine]
|
||||||
else
|
else
|
||||||
@images[:cell]
|
@images[:cell]
|
||||||
end ).draw( x * 2 * 10, (y * 20) + 20, 0 )
|
end )
|
||||||
|
.draw( x * 2 * 10, (y * 20) + 20, 0 )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue