Class: Dedalus::ApplicationView

Inherits:
Joyce::ApplicationView
  • Object
show all
Defined in:
lib/dedalus/application_view.rb

Direct Known Subclasses

PatternLibrary::ApplicationView

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ApplicationView

Returns a new instance of ApplicationView.



3
4
5
6
# File 'lib/dedalus/application_view.rb', line 3

def initialize(app)
  super(app)
  Dedalus.activate!(self)
end

Instance Method Details

#clickObject



12
13
14
15
16
17
18
# File 'lib/dedalus/application_view.rb', line 12

def click
  composer.click_molecule(
    app_screen,
    [window.width, window.height],
    mouse_position: mouse_position
  )
end

#compose(screen) ⇒ Object



20
21
22
23
# File 'lib/dedalus/application_view.rb', line 20

def compose(screen)
  composer.hover_molecule(screen, dimensions, mouse_position: mouse_position)
  composer.render!(screen, dimensions)
end

#dimensionsObject



25
26
27
# File 'lib/dedalus/application_view.rb', line 25

def dimensions
  [window.width, window.height]
end

#mouse_positionObject



29
30
31
32
33
34
35
36
# File 'lib/dedalus/application_view.rb', line 29

def mouse_position
  if @application.window.fullscreen?
    x0,y0 = *super
    [ x0 * 2, y0 * 2 ]
  else
    super
  end
end

#renderObject



8
9
10
# File 'lib/dedalus/application_view.rb', line 8

def render
  compose(app_screen)
end