Class: Joyce::ApplicationWindow

Inherits:
Gosu::Window
  • Object
show all
Defined in:
lib/joyce.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, width:, height:, fullscreen: true) ⇒ ApplicationWindow

Returns a new instance of ApplicationWindow.



22
23
24
25
26
27
28
# File 'lib/joyce.rb', line 22

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

#appObject (readonly)

Returns the value of attribute app.



20
21
22
# File 'lib/joyce.rb', line 20

def app
  @app
end

#heightObject

Returns the value of attribute height.



19
20
21
# File 'lib/joyce.rb', line 19

def height
  @height
end

#widthObject

Returns the value of attribute width.



19
20
21
# File 'lib/joyce.rb', line 19

def width
  @width
end

Instance Method Details

#button_down(id) ⇒ Object



38
39
40
41
42
# File 'lib/joyce.rb', line 38

def button_down(id)
  if id == Gosu::MsLeft then
    app.click
  end
end

#drawObject



30
31
32
# File 'lib/joyce.rb', line 30

def draw
  app.view.render
end

#mouse_positionObject



44
45
46
# File 'lib/joyce.rb', line 44

def mouse_position
  [ mouse_x, mouse_y ]
end

#updateObject



34
35
36
# File 'lib/joyce.rb', line 34

def update
  app.tick
end