Class: Background

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

Instance Method Summary collapse

Constructor Details

#initializeBackground

Returns a new instance of Background.



4
5
6
7
# File 'lib/lib/user_interface/background.rb', line 4

def initialize()
  dir_path = File.dirname(__FILE__)
  @image = Gosu::Image.new(dir_path + '/../../media/square.png')
end

Instance Method Details

#drawObject



9
10
11
12
13
14
15
16
# File 'lib/lib/user_interface/background.rb', line 9

def draw
  @image.draw(0, 0, ZBACKGROUND,
              scale_x = MAPX, scale_y = MAPY,
              color = Gosu::Color::CYAN) # sky
  @image.draw(0, WINDOW_HEIGHT - GRASS_THICKNESS * TILESIZE, ZBACKGROUND,
              scale_x = MAPX, scale_y = GRASS_THICKNESS,
              color = Gosu::Color::GREEN) # grass
end