Class: Straightedge::Gosu::Surface

Inherits:
Gosu::Window
  • Object
show all
Includes:
Surface
Defined in:
lib/straightedge/gosu/window.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(geometry = [800,600], caption: "Gosu-as-a-Surface") ⇒ Surface

Returns a new instance of Surface.



8
9
10
11
12
13
# File 'lib/straightedge/gosu/window.rb', line 8

def initialize(geometry=[800,600], caption: "Gosu-as-a-Surface")
	@width, @height  = *geometry
	super @width, @height, false
	self.caption   = caption
	@font = ::Gosu::Font.new(self, ::Gosu::default_font_name, 20)
end

Instance Attribute Details

#fontObject (readonly)

Returns the value of attribute font.



6
7
8
# File 'lib/straightedge/gosu/window.rb', line 6

def font
  @font
end

#scaleObject (readonly)

Returns the value of attribute scale.



6
7
8
# File 'lib/straightedge/gosu/window.rb', line 6

def scale
  @scale
end

#sceneObject (readonly)

Returns the value of attribute scene.



6
7
8
# File 'lib/straightedge/gosu/window.rb', line 6

def scene
  @scene
end

Instance Method Details

#button_down(id) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/straightedge/gosu/window.rb', line 17

def button_down(id)
	case id
	when ::Gosu::MsLeft
	  @adapter.click(mouse_x,mouse_y)
	else
	end
end

#drawObject



16
# File 'lib/straightedge/gosu/window.rb', line 16

def draw;   @adapter.render end

#updateObject



15
# File 'lib/straightedge/gosu/window.rb', line 15

def update; @adapter.step   end