Class: Straightedge::Gosu::Surface
- Inherits:
-
Gosu::Window
- Object
- Gosu::Window
- Straightedge::Gosu::Surface
- Includes:
- Surface
- Defined in:
- lib/straightedge/gosu/window.rb
Instance Attribute Summary collapse
-
#font ⇒ Object
readonly
Returns the value of attribute font.
-
#scale ⇒ Object
readonly
Returns the value of attribute scale.
-
#scene ⇒ Object
readonly
Returns the value of attribute scene.
Instance Method Summary collapse
- #button_down(id) ⇒ Object
- #draw ⇒ Object
-
#initialize(geometry = [800,600], caption: "Gosu-as-a-Surface") ⇒ Surface
constructor
A new instance of Surface.
- #update ⇒ Object
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. = @font = ::Gosu::Font.new(self, ::Gosu::default_font_name, 20) end |
Instance Attribute Details
#font ⇒ Object (readonly)
Returns the value of attribute font.
6 7 8 |
# File 'lib/straightedge/gosu/window.rb', line 6 def font @font end |
#scale ⇒ Object (readonly)
Returns the value of attribute scale.
6 7 8 |
# File 'lib/straightedge/gosu/window.rb', line 6 def scale @scale end |
#scene ⇒ Object (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 (id) case id when ::Gosu::MsLeft @adapter.click(mouse_x,mouse_y) else end end |
#draw ⇒ Object
16 |
# File 'lib/straightedge/gosu/window.rb', line 16 def draw; @adapter.render end |
#update ⇒ Object
15 |
# File 'lib/straightedge/gosu/window.rb', line 15 def update; @adapter.step end |