Class: Joyce::ApplicationWindow
- Inherits:
-
Gosu::Window
- Object
- Gosu::Window
- Joyce::ApplicationWindow
- Defined in:
- lib/joyce.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#height ⇒ Object
Returns the value of attribute height.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
- #button_down(id) ⇒ Object
- #draw ⇒ Object
-
#initialize(app, width:, height:, fullscreen: true) ⇒ ApplicationWindow
constructor
A new instance of ApplicationWindow.
- #mouse_position ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(app, width:, height:, fullscreen: true) ⇒ ApplicationWindow
Returns a new instance of ApplicationWindow.
24 25 26 27 28 29 30 |
# File 'lib/joyce.rb', line 24 def initialize(app, width:, height:, fullscreen: true) @app = app self.width = width self.height = height super(self.width, self.height, fullscreen) end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
22 23 24 |
# File 'lib/joyce.rb', line 22 def app @app end |
#height ⇒ Object
Returns the value of attribute height.
21 22 23 |
# File 'lib/joyce.rb', line 21 def height @height end |
#width ⇒ Object
Returns the value of attribute width.
21 22 23 |
# File 'lib/joyce.rb', line 21 def width @width end |
Instance Method Details
#button_down(id) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/joyce.rb', line 40 def (id) if id == Gosu::MsLeft app.click elsif id == Gosu::KbEscape close else app.press(id) end end |
#draw ⇒ Object
32 33 34 |
# File 'lib/joyce.rb', line 32 def draw app.view.render end |
#mouse_position ⇒ Object
50 51 52 |
# File 'lib/joyce.rb', line 50 def mouse_position [ mouse_x, mouse_y ] end |
#update ⇒ Object
36 37 38 |
# File 'lib/joyce.rb', line 36 def update app.tick end |