Sha256: f3f0d4dc647db2ecbab5b3f7e51ac602436a4c990a2c471c2f0a6cfdb31a156d

Contents?: true

Size: 906 Bytes

Versions: 17

Compression:

Stored size: 906 Bytes

Contents

module Dedalus
  class ApplicationView < Joyce::ApplicationView
    def initialize(app)
      super(app)
      Dedalus.activate!(self)
    end

    def render
      compose(app_screen)
    end

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

    def compose(screen)
      screen = composer.hover_molecule(screen, dimensions, mouse_position: mouse_position)
      composer.render!(screen, dimensions)
      # cursor.position = mouse_position
      # cursor.render
    end

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

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

    private
    def composer
      @composer ||= Dedalus::ApplicationViewComposer.new
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
dedalus-0.2.17 lib/dedalus/application_view.rb
dedalus-0.2.16 lib/dedalus/application_view.rb
dedalus-0.2.15 lib/dedalus/application_view.rb
dedalus-0.2.13 lib/dedalus/application_view.rb
dedalus-0.2.12 lib/dedalus/application_view.rb
dedalus-0.2.11 lib/dedalus/application_view.rb
dedalus-0.2.10 lib/dedalus/application_view.rb
dedalus-0.2.9 lib/dedalus/application_view.rb
dedalus-0.2.8 lib/dedalus/application_view.rb
dedalus-0.2.7 lib/dedalus/application_view.rb
dedalus-0.2.6 lib/dedalus/application_view.rb
dedalus-0.2.5 lib/dedalus/application_view.rb
dedalus-0.2.4 lib/dedalus/application_view.rb
dedalus-0.2.3 lib/dedalus/application_view.rb
dedalus-0.2.2 lib/dedalus/application_view.rb
dedalus-0.2.1.1 lib/dedalus/application_view.rb
dedalus-0.2.1 lib/dedalus/application_view.rb