dedalus 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.document +3 -0
  3. data/.gitignore +7 -0
  4. data/.rspec +1 -0
  5. data/.yardopts +1 -0
  6. data/ChangeLog.md +4 -0
  7. data/Gemfile +11 -0
  8. data/LICENSE.txt +20 -0
  9. data/README.md +135 -0
  10. data/Rakefile +42 -0
  11. data/bin/dedalus +20 -0
  12. data/dedalus.gemspec +60 -0
  13. data/features/.gitkeep +0 -0
  14. data/features/dedalus.feature +1 -0
  15. data/features/step_definitions/.gitkeep +0 -0
  16. data/features/step_definitions/dedalus_steps.rb +1 -0
  17. data/gemspec.yml +20 -0
  18. data/lib/dedalus/app_view_composer.rb +60 -0
  19. data/lib/dedalus/application_view.rb +48 -0
  20. data/lib/dedalus/elements/heading.rb +13 -0
  21. data/lib/dedalus/elements/icon.rb +21 -0
  22. data/lib/dedalus/elements/image.rb +53 -0
  23. data/lib/dedalus/elements/paragraph.rb +13 -0
  24. data/lib/dedalus/elements/text.rb +44 -0
  25. data/lib/dedalus/elements.rb +78 -0
  26. data/lib/dedalus/palette.rb +89 -0
  27. data/lib/dedalus/pattern_library/application.rb +140 -0
  28. data/lib/dedalus/pattern_library/application_view.rb +28 -0
  29. data/lib/dedalus/pattern_library/library_view.rb +7 -0
  30. data/lib/dedalus/pattern_library/models/library.rb +10 -0
  31. data/lib/dedalus/pattern_library/models/library_item.rb +11 -0
  32. data/lib/dedalus/pattern_library/models/library_section.rb +26 -0
  33. data/lib/dedalus/pattern_library/molecules/library_item_example.rb +50 -0
  34. data/lib/dedalus/pattern_library/molecules/library_section_tab.rb +62 -0
  35. data/lib/dedalus/pattern_library/molecules/periodic_table.rb +32 -0
  36. data/lib/dedalus/pattern_library/molecules/periodic_table_entry.rb +70 -0
  37. data/lib/dedalus/pattern_library/organisms/app_footer.rb +37 -0
  38. data/lib/dedalus/pattern_library/organisms/app_header.rb +36 -0
  39. data/lib/dedalus/pattern_library/organisms/app_sidebar.rb +29 -0
  40. data/lib/dedalus/pattern_library/organisms/library_entry.rb +64 -0
  41. data/lib/dedalus/pattern_library/screens/app_screen.rb +22 -0
  42. data/lib/dedalus/pattern_library/templates/app_template.rb +94 -0
  43. data/lib/dedalus/pattern_library.rb +1 -0
  44. data/lib/dedalus/version.rb +4 -0
  45. data/lib/dedalus/view_traversal.rb +129 -0
  46. data/lib/dedalus.rb +40 -0
  47. data/media/icons/arrow_cursor.png +0 -0
  48. data/media/icons/atom.png +0 -0
  49. data/media/icons/hive.png +0 -0
  50. data/media/icons/house.png +0 -0
  51. data/media/icons/molecule.png +0 -0
  52. data/media/icons/paramecium.png +0 -0
  53. data/spec/dedalus_spec.rb +28 -0
  54. data/spec/spec_helper.rb +4 -0
  55. metadata +226 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e0478287f743dff77183fa294339e63c6391ae63
4
+ data.tar.gz: 004fd7192a547643a9cc859e8d64b7b4a4c7cd5c
5
+ SHA512:
6
+ metadata.gz: b7c1239ab8bb26509b2dcd82bdca36211911c3ea7bec1900e71d30fec676cbd5f6e3029a289597c9513aaa5e01a151dac19cd9004897d81ad9d469beafbc0f13
7
+ data.tar.gz: e7c517a6f3d4eff49dffa45aded6b581949e9dc0fb859b6a793c2c1f842e18ad36be7d9637b018b03db8233b9f0d8fd52687d7b0b0803a2095b1e2ffe9e3ede3
data/.document ADDED
@@ -0,0 +1,3 @@
1
+ -
2
+ ChangeLog.md
3
+ LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ /.bundle
2
+ /.yardoc/
3
+ /Gemfile.lock
4
+ /doc/
5
+ /pkg/
6
+ /vendor/cache/*.gem
7
+ /dist/
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour --format documentation
data/.yardopts ADDED
@@ -0,0 +1 @@
1
+ --markup markdown --title "dedalus Documentation" --protected
data/ChangeLog.md ADDED
@@ -0,0 +1,4 @@
1
+ ### 0.1.0 / 2016-04-16
2
+
3
+ * Initial release:
4
+
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'geometer'
6
+ gem 'joyce'
7
+
8
+ group :development do
9
+ gem 'kramdown'
10
+ gem 'pry'
11
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2016 Joseph Weissman
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # dedalus
2
+
3
+ * [Homepage](https://rubygems.org/gems/dedalus)
4
+ * [Documentation](http://rubydoc.info/gems/dedalus/frames)
5
+ * [Email](mailto:jweissman1986 at gmail.com)
6
+
7
+ [![Code Climate GPA](https://codeclimate.com/github//dedalus/badges/gpa.svg)](https://codeclimate.com/github//dedalus)
8
+
9
+ ## Description
10
+
11
+ An incredible atomic design pattern library for [Joyce](https://github.com/deepcerulean/joyce)
12
+
13
+ ## Features
14
+
15
+ - Layout manager for Joyce apps
16
+
17
+ ## Examples
18
+
19
+ require 'dedalus'
20
+
21
+ module PatternLibrary
22
+ class ApplicationView < Joyce::ApplicationView
23
+ def render
24
+ composer.render!(welcome_screen)
25
+ end
26
+
27
+ private
28
+ def welcome_screen
29
+ @welcome_screen ||= WelcomeScreen.create
30
+ end
31
+
32
+ def composer
33
+ @composer ||= Dedalus::ApplicationViewComposer.new(self)
34
+ end
35
+ end
36
+
37
+ class ApplicationHeader < Dedalus::Organism
38
+ attr_accessor :title, :subtitle
39
+
40
+ def show
41
+ [ heading, subheading ]
42
+ end
43
+
44
+ private
45
+ def heading
46
+ @heading ||= Elements::Heading.create(text: title)
47
+ end
48
+
49
+ def subheading
50
+ @subheading ||= Elements::Heading.create(text: subtitle, scale: 0.75)
51
+ end
52
+ end
53
+
54
+ class ApplicationSidebar < Dedalus::Organism
55
+ has_many :library_sections
56
+
57
+ def show
58
+ self.library_sections.all
59
+ end
60
+ end
61
+
62
+ class LibrarySection < Dedalus::Molecule
63
+ belongs_to :application_sidebar
64
+ attr_accessor :name
65
+
66
+ def show
67
+ Elements::Heading.create(text: name)
68
+ end
69
+
70
+ def height
71
+ 0.03
72
+ end
73
+ end
74
+
75
+ class ApplicationScreen < Dedalus::Template
76
+ def layout
77
+ [
78
+ page_header, [ sidebar, yield ]
79
+ ]
80
+ end
81
+
82
+ private
83
+ def page_header
84
+ @page_header ||= ApplicationHeader.create(
85
+ title: 'Dedalus',
86
+ subtitle: 'A Visual Pattern Library for Joyce',
87
+ height: 0.1
88
+ )
89
+ end
90
+
91
+ def sidebar
92
+ @sidebar ||= ApplicationSidebar.create(
93
+ library_sections: [
94
+ LibrarySection.create(name: "Home"),
95
+ LibrarySection.create(name: "Atoms"),
96
+ LibrarySection.create(name: "Molecules"),
97
+ LibrarySection.create(name: "Organisms"),
98
+ LibrarySection.create(name: "Templates"),
99
+ LibrarySection.create(name: "Screens")
100
+ ],
101
+ width: 0.3
102
+ )
103
+ end
104
+ end
105
+
106
+ class WelcomeScreen < ApplicationScreen
107
+ def show
108
+ layout { welcome_message }
109
+ end
110
+
111
+ def welcome_message
112
+ @welcome_message ||= Elements::Heading.create(text: "Welcome to our Pattern Library!")
113
+ end
114
+ end
115
+
116
+ class Application < Joyce::Application
117
+ viewed_with ApplicationView
118
+ end
119
+ end
120
+
121
+ ## Requirements
122
+
123
+ ## Install
124
+
125
+ $ gem install dedalus
126
+
127
+ ## Synopsis
128
+
129
+ $ dedalus
130
+
131
+ ## Copyright
132
+
133
+ Copyright (c) 2016 Joseph Weissman
134
+
135
+ See {file:LICENSE.txt} for details.
data/Rakefile ADDED
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+
5
+ begin
6
+ require 'bundler/setup'
7
+ rescue LoadError => e
8
+ abort e.message
9
+ end
10
+
11
+ require 'rake'
12
+
13
+ require 'rubygems/tasks'
14
+ Gem::Tasks.new
15
+
16
+ require 'rspec/core/rake_task'
17
+ RSpec::Core::RakeTask.new
18
+
19
+ task :test => :spec
20
+ task :default => :spec
21
+
22
+ require 'yard'
23
+ YARD::Rake::YardocTask.new
24
+ task :doc => :yard
25
+
26
+ require 'cucumber/rake/task'
27
+
28
+ Cucumber::Rake::Task.new do |t|
29
+ t.cucumber_opts = %w[--format pretty]
30
+ end
31
+
32
+ require 'joyce'
33
+ require 'joyce/tasks/build'
34
+
35
+ task :app do
36
+ Joyce::Tasks::AppBuilder.new.make({
37
+ app_name: "dedalus",
38
+ app_class_name: 'Dedalus::PatternLibrary::Application',
39
+ template_location: "dist/Ruby.app",
40
+ target_directory: "dist"
41
+ })
42
+ end
data/bin/dedalus ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ root = File.expand_path(File.join(File.dirname(__FILE__),'..'))
4
+ if File.directory?(File.join(root,'.git'))
5
+ Dir.chdir(root) do
6
+ begin
7
+ require 'bundler/setup'
8
+ require 'dedalus'
9
+ Dedalus::PatternLibrary::Application.kickstart!({
10
+ setup: {
11
+ module_to_search: Dedalus::PatternLibrary
12
+ }
13
+ })
14
+ rescue LoadError => e
15
+ warn e.message
16
+ warn "Run `gem install bundler` to install Bundler"
17
+ exit(-1)
18
+ end
19
+ end
20
+ end
data/dedalus.gemspec ADDED
@@ -0,0 +1,60 @@
1
+ # encoding: utf-8
2
+
3
+ require 'yaml'
4
+
5
+ Gem::Specification.new do |gem|
6
+ gemspec = YAML.load_file('gemspec.yml')
7
+
8
+ gem.name = gemspec.fetch('name')
9
+ gem.version = gemspec.fetch('version') do
10
+ lib_dir = File.join(File.dirname(__FILE__),'lib')
11
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
12
+
13
+ require 'dedalus/version'
14
+ Dedalus::VERSION
15
+ end
16
+
17
+ gem.summary = gemspec['summary']
18
+ gem.description = gemspec['description']
19
+ gem.licenses = Array(gemspec['license'])
20
+ gem.authors = Array(gemspec['authors'])
21
+ gem.email = gemspec['email']
22
+ gem.homepage = gemspec['homepage']
23
+
24
+ glob = lambda { |patterns| gem.files & Dir[*patterns] }
25
+
26
+ gem.files = `git ls-files`.split($/)
27
+ gem.files = glob[gemspec['files']] if gemspec['files']
28
+
29
+ gem.executables = gemspec.fetch('executables') do
30
+ glob['bin/*'].map { |path| File.basename(path) }
31
+ end
32
+ gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
33
+
34
+ gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb']
35
+ gem.test_files = glob[gemspec['test_files'] || '{test/{**/}*_test.rb']
36
+ gem.extra_rdoc_files = glob[gemspec['extra_doc_files'] || '*.{txt,md}']
37
+
38
+ gem.require_paths = Array(gemspec.fetch('require_paths') {
39
+ %w[ext lib].select { |dir| File.directory?(dir) }
40
+ })
41
+
42
+ gem.requirements = Array(gemspec['requirements'])
43
+ gem.required_ruby_version = gemspec['required_ruby_version']
44
+ gem.required_rubygems_version = gemspec['required_rubygems_version']
45
+ gem.post_install_message = gemspec['post_install_message']
46
+
47
+ split = lambda { |string| string.split(/,\s*/) }
48
+
49
+ if gemspec['dependencies']
50
+ gemspec['dependencies'].each do |name,versions|
51
+ gem.add_dependency(name,split[versions])
52
+ end
53
+ end
54
+
55
+ if gemspec['development_dependencies']
56
+ gemspec['development_dependencies'].each do |name,versions|
57
+ gem.add_development_dependency(name,split[versions])
58
+ end
59
+ end
60
+ end
data/features/.gitkeep ADDED
File without changes
@@ -0,0 +1 @@
1
+ Feature: Blah blah blah
File without changes
@@ -0,0 +1 @@
1
+ @wip
data/gemspec.yml ADDED
@@ -0,0 +1,20 @@
1
+ name: dedalus
2
+ summary: atomic patterns for 2d games
3
+ description: atomic ui pattern library toolkit for joyce
4
+ license: MIT
5
+ authors: Joseph Weissman
6
+ email: jweissman1986@gmail.com
7
+ homepage: https://rubygems.org/gems/dedalus
8
+
9
+ dependencies:
10
+ joyce: ~> 0.1
11
+ geometer: ~> 0.1
12
+
13
+ development_dependencies:
14
+ bundler: ~> 1.10
15
+ codeclimate-test-reporter: ~> 0.1
16
+ cucumber: ~> 0.10.2
17
+ rake: ~> 10.0
18
+ rspec: ~> 3.0
19
+ rubygems-tasks: ~> 0.2
20
+ yard: ~> 0.8
@@ -0,0 +1,60 @@
1
+ module Dedalus
2
+ class ApplicationViewComposer
3
+ include Geometer::PointHelpers
4
+ include Geometer::DimensionHelpers
5
+
6
+ def traverse(structure, origin: [0,0], dimensions:, &blk)
7
+ traversal = ViewTraversal.new(&blk)
8
+ traversal.walk!(structure, origin: origin, dimensions: dimensions)
9
+ structure
10
+ end
11
+
12
+ def send_molecule(structure, window_dims, mouse_position:, message:) #, origin: [0,0], dimensions:, mouse_position:)
13
+ mouse_coord = coord(*mouse_position)
14
+
15
+ traverse(structure, origin: [0,0], dimensions: window_dims) do
16
+ on_molecule do |molecule, origin:, dimensions:|
17
+ element_bounding_box = Geometer::Rectangle.new(coord(*origin), dim(*dimensions))
18
+ mouse_overlap = element_bounding_box.contains?(mouse_coord) rescue false # could get bad coords...
19
+ if mouse_overlap
20
+ molecule.send(message)
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ def hover_molecule(structure, window_dims, mouse_position:)
27
+ send_molecule(structure, window_dims, mouse_position: mouse_position, message: :hover)
28
+ end
29
+
30
+ def click_molecule(structure, window_dims, mouse_position:)
31
+ send_molecule(structure, window_dims, mouse_position: mouse_position, message: :click)
32
+ end
33
+
34
+ def render!(structure, dims)
35
+ traverse(structure, origin: [0,0], dimensions: dims) do
36
+ on_atom do |atom, origin:, dimensions:|
37
+ if atom.background_color
38
+ atom.draw_bounding_box(
39
+ color: atom.background_color,
40
+ origin: origin,
41
+ dimensions: dimensions
42
+ )
43
+ end
44
+ atom.position = origin
45
+ atom.render
46
+ end
47
+
48
+ on_element do |element, origin:, dimensions:|
49
+ if element.background_color
50
+ element.draw_bounding_box(
51
+ color: element.background_color,
52
+ origin: origin,
53
+ dimensions: dimensions
54
+ )
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,48 @@
1
+ module Dedalus
2
+ class ApplicationView < Joyce::ApplicationView
3
+ def initialize(app)
4
+ super(app)
5
+ Dedalus.activate!(self)
6
+ end
7
+
8
+ def render
9
+ compose(app_screen)
10
+ end
11
+
12
+ def click
13
+ p [ :app_view_click ]
14
+ composer.click_molecule(app_screen, [window.width, window.height], mouse_position: mouse_position)
15
+ end
16
+
17
+ def compose(screen)
18
+ screen = composer.hover_molecule(screen, dimensions, mouse_position: mouse_position)
19
+ composer.render!(screen, dimensions)
20
+
21
+ cursor.position = mouse_position
22
+ cursor.render
23
+ end
24
+
25
+ def dimensions
26
+ [window.width, window.height]
27
+ end
28
+
29
+ def mouse_position
30
+ if @application.window.fullscreen?
31
+ x0,y0 = *super
32
+ [ x0 * 2, y0 * 2 ]
33
+ else
34
+ super
35
+ end
36
+ end
37
+
38
+ protected
39
+ def cursor
40
+ @cursor ||= Elements::Icon.for :arrow_cursor
41
+ end
42
+
43
+ private
44
+ def composer
45
+ @composer ||= Dedalus::ApplicationViewComposer.new
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,13 @@
1
+ module Dedalus
2
+ module Elements
3
+ class Heading < Text
4
+ def scale
5
+ @scale ||= 2.4
6
+ end
7
+
8
+ def padding
9
+ @padding ||= 2.0
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ module Dedalus
2
+ module Elements
3
+ class Icon < Image
4
+ attr_accessor :name
5
+
6
+ def scale
7
+ @scale ||= 0.062
8
+ end
9
+
10
+ def path
11
+ @path ||= "media/icons/#{name}.png"
12
+ end
13
+
14
+ class << self
15
+ def for(sym, attrs={})
16
+ new(attrs.merge(name: sym))
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,53 @@
1
+ module Dedalus
2
+ module Elements
3
+ class ImageRepository
4
+ def self.lookup(path)
5
+ @images ||= {}
6
+ @images[path] ||= Gosu::Image.new(path)
7
+ @images[path]
8
+ end
9
+ end
10
+
11
+ class Image < Dedalus::Atom
12
+ attr_accessor :path, :padding
13
+
14
+ def render
15
+ x,y = *position
16
+ asset.draw(x + padding, y + padding, ZOrder::Foreground, scale, scale)
17
+ end
18
+
19
+ def width
20
+ 2*padding + (asset.width * scale)
21
+ end
22
+
23
+ def height
24
+ 2*padding + (asset.height * scale)
25
+ end
26
+
27
+ def dimensions
28
+ [ width, height ]
29
+ end
30
+
31
+ def padding
32
+ @padding ||= 10.0
33
+ end
34
+
35
+ def scale
36
+ @scale ||= 1.0
37
+ end
38
+
39
+ def self.example_data
40
+ { path: "media/icons/house.png" }
41
+ end
42
+
43
+ def self.description
44
+ "an image"
45
+ end
46
+
47
+ private
48
+ def asset
49
+ @asset ||= ImageRepository.lookup(path)
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,13 @@
1
+ module Dedalus
2
+ module Elements
3
+ class Paragraph < Text
4
+ def scale
5
+ @scale ||= 0.75
6
+ end
7
+
8
+ def padding
9
+ @padding ||= 2.6
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,44 @@
1
+ module Dedalus
2
+ module Elements
3
+ class Text < Dedalus::Atom
4
+ attr_accessor :text, :scale, :padding
5
+
6
+
7
+ def render(*)
8
+ x,y = *position
9
+ font.draw(text, x + padding, y + padding, ZOrder::Text, self.scale, self.scale)
10
+
11
+ # draw_bounding_box(origin: [x,y], dimensions: dimensions)
12
+ end
13
+
14
+ def width
15
+ 2*padding + (font.text_width(text) * scale)
16
+ end
17
+
18
+ def height
19
+ 2*padding + (font.height * scale)
20
+ end
21
+
22
+ def padding
23
+ @padding ||= 0.0
24
+ end
25
+
26
+ def scale
27
+ @scale ||= 1.0
28
+ end
29
+
30
+ def dimensions
31
+ [ width, height ]
32
+ end
33
+
34
+ # sample data for the explorer...
35
+ def self.example_data
36
+ { text: "Hello World" }
37
+ end
38
+
39
+ def self.description
40
+ "words"
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,78 @@
1
+ module Dedalus
2
+ def self.activate!(app_view)
3
+ @active_view = app_view
4
+ end
5
+
6
+ def self.active_view
7
+ @active_view ||= nil
8
+ end
9
+
10
+ class Element
11
+ attr_accessor :position
12
+
13
+ # in % as 0.0-1.0 (hint to compositing engine for elements in columns/rows respectively)
14
+ attr_accessor :width_percent, :height_percent
15
+
16
+ # raw width/height
17
+ attr_accessor :width, :height
18
+
19
+ attr_accessor :padding, :margin
20
+ attr_accessor :background_color
21
+
22
+ def initialize(attrs={})
23
+ attrs.each { |(k,v)| instance_variable_set(:"@#{k}",v) } unless attrs.nil?
24
+ end
25
+
26
+ def draw_bounding_box(origin:, dimensions:, color: Palette.gray) #, highlight: false)
27
+ x,y = *origin
28
+ w,h = *dimensions
29
+
30
+ raise "Invalid color #{color} given to #{self.class.name} for bounding box" unless color.is_a?(Dedalus::Color)
31
+
32
+ c = color.to_gosu
33
+ window.draw_quad(x,y,c,
34
+ x,y+h,c,
35
+ x+w,y,c,
36
+ x+w,y+h,c,ZOrder::Background)
37
+ end
38
+
39
+ def view
40
+ Dedalus.active_view
41
+ end
42
+
43
+ def font
44
+ view.font
45
+ end
46
+
47
+ def window
48
+ view.window
49
+ end
50
+ end
51
+
52
+ ###
53
+
54
+ class Atom < Element
55
+ attr_accessor :scale, :padding
56
+ end
57
+
58
+ class Molecule < Element
59
+ def click
60
+ end
61
+
62
+ def hover
63
+ end
64
+ end
65
+
66
+ class Organism < Element
67
+ end
68
+
69
+ class Template < Element
70
+ end
71
+
72
+ class Screen < Element
73
+ end
74
+
75
+ module ZOrder
76
+ Background, Foreground, Text, Overlay = *(0..5)
77
+ end
78
+ end