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



44
45
46
47
48
49
50
# File 'lib/joyce.rb', line 44

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.



42
43
44
# File 'lib/joyce.rb', line 42

def app
  @app
end

#heightObject

Returns the value of attribute height.



41
42
43
# File 'lib/joyce.rb', line 41

def height
  @height
end

#widthObject

Returns the value of attribute width.



41
42
43
# File 'lib/joyce.rb', line 41

def width
  @width
end

Instance Method Details

#button_down(id) ⇒ Object



60
61
62
63
64
# File 'lib/joyce.rb', line 60

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

#drawObject



52
53
54
# File 'lib/joyce.rb', line 52

def draw
  app.view.render
end

#mouse_positionObject



66
67
68
# File 'lib/joyce.rb', line 66

def mouse_position
  [ mouse_x, mouse_y ]
end

#updateObject



56
57
58
# File 'lib/joyce.rb', line 56

def update
  app.tick
end