Class: Stage

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

Instance Method Summary collapse

Constructor Details

#initialize(window) ⇒ Stage

Returns a new instance of Stage.



4
5
6
7
8
9
# File 'lib/scrit/stage.rb', line 4

def initialize(window)
    @window = window
    @backdrops = ["white"]
    @file = File.join(File.dirname(__FILE__), '..', 'backdrops', @backdrops[0] + ".png")
    @background_image = Gosu::Image.new(window, @file, true)
end

Instance Method Details

#backdropsObject



16
17
18
# File 'lib/scrit/stage.rb', line 16

def backdrops
    @backdrops
end

#drawObject



11
12
13
14
# File 'lib/scrit/stage.rb', line 11

def draw
    #@background_image.draw(0, 0, ZOrder::Background)
    @background_image.draw_as_quad(0, 0, 0xffffffff, @window.width, 0, 0xffffffff, @window.width, @window.height, 0xffffffff, 0, @window.height, 0xffffffff, 0)
end

#switch_backdrop_to(name) ⇒ Object



20
21
22
23
# File 'lib/scrit/stage.rb', line 20

def switch_backdrop_to(name)
    @file = File.join(File.dirname(__FILE__), '..', 'backdrops', name + ".png")
    @background_image = Gosu::Image.new(@window, @file, true)
end