class Onsengame::Window

Attributes

options[R]
scenes[R]

Public Class Methods

new(options={}) click to toggle source
Calls superclass method
# File lib/onsengame/window.rb, line 9
def initialize(options={})
  width = options[:width] || 640
  height = options[:height] || 480
  fullscreen = options[:fullscreen] || false
  super(width, height, fullscreen)
  self.caption = "Onsengame"
  @options = options
  @options[:font_dir] ||= File.expand_path("../../../data/fonts", __FILE__)
  @scenes = []
  @scenes << Scene::Title.new(self)
end

Public Instance Methods

button_down(id) click to toggle source
# File lib/onsengame/window.rb, line 29
def button_down(id)
  case id
  when Gosu::KbEscape
    close
  else
    current_scene.button_down(id)
  end
end
current_scene() click to toggle source
# File lib/onsengame/window.rb, line 38
def current_scene
  @scenes[0]
end
draw() click to toggle source
# File lib/onsengame/window.rb, line 25
def draw
  current_scene.draw
end
draw_rectangle(x1, y1, x2, y2, color, z_order) click to toggle source
# File lib/onsengame/window.rb, line 42
def draw_rectangle(x1, y1, x2, y2, color, z_order)
  draw_quad(x1, y1, color,
            x2, y1, color,
            x2, y2, color,
            x1, y2, color,
            z_order)
end
draw_rectangle_outline(x1, y1, x2, y2, color, z_order) click to toggle source
# File lib/onsengame/window.rb, line 50
def draw_rectangle_outline(x1, y1, x2, y2, color, z_order)
  draw_line(x1, y1, color,
            x2, y1, color,
            z_order)
  draw_line(x1, y1, color,
            x1, y2, color,
            z_order)
  draw_line(x1, y2, color,
            x2, y2, color,
            z_order)
  draw_line(x2, y1, color,
            x2, y2, color,
            z_order)
end
update() click to toggle source
# File lib/onsengame/window.rb, line 21
def update
  current_scene.update
end