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: 800, height: 600) ⇒ ApplicationWindow

Returns a new instance of ApplicationWindow.



46
47
48
49
50
51
52
# File 'lib/joyce.rb', line 46

def initialize(app, width: 800, height: 600)
  @app = app
  self.width  = width
  self.height = height

  super(self.width, self.height)
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



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

def app
  @app
end

#heightObject

Returns the value of attribute height.



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

def height
  @height
end

#widthObject

Returns the value of attribute width.



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

def width
  @width
end

Instance Method Details

#button_down(id) ⇒ Object



62
63
64
65
66
# File 'lib/joyce.rb', line 62

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

#drawObject



54
55
56
# File 'lib/joyce.rb', line 54

def draw
  app.view.render
end

#mouse_positionObject



68
69
70
# File 'lib/joyce.rb', line 68

def mouse_position
  [ mouse_x, mouse_y ]
end

#updateObject



58
59
60
# File 'lib/joyce.rb', line 58

def update
  app.tick
end