dare 0.0.9 → 0.1.0

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODE2OWNiOTg3YTZlMjYwNDhhMWJiYTU4ZDJiYWQ2YjcxOGViNDg1YQ==
4
+ OWY5MzQ5MzBmNTE3YzExNTNmZTU3YmI0NjBiOTBkOTMxZWMwOGFhMA==
5
5
  data.tar.gz: !binary |-
6
- OGFjZWRhYTFlNjQ1YmE1NWJlOWZmYjRiNGY4NTUyOGZlYWZhNjZkNw==
6
+ YTkwYTc2OWI5NGM4NjVkN2FiOGIzNjk5ZjkwNTQ5Nzg5ZmMxZTcyOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODJiOTZiZTI2ZjE1OGU3NzRiODE4OTc5ZmUwY2QzOWRjYTE4ZTdlMTM4ZTIz
10
- MjhhMmE4MmU0OThjNTZiMTVmNDM2YjhhYmNiOWI3OTNkMmNmNDEwMjE0NzYw
11
- Njg3ZjI1YjhjNjg4NTYwOGRjZjhkODUxNTYzYTE5MWQ4OTI1NjU=
9
+ YTUzYjQwMDM4Njc0ZjM2NTIxZGJlNGY4MDIxN2FkMjk3ZTg2YjAwNTM1N2Qz
10
+ NDAyMDNlM2JhMjk5MDViODA4NDNiM2JlN2M0M2QxOTE0YmQ3ZTI2ZWZmZTYx
11
+ N2I0YzM1ZDE0MjdiM2UwZWE4ZTI2MDAzMjhlZDY1ZDk4ZTZlNzA=
12
12
  data.tar.gz: !binary |-
13
- MTlhYTA2ZDE4ZDE1MWQ2MmJkNDU3ZjliMTVjNzE4ZmQ3NjIzYzFkNDAxYTVj
14
- NTc3MzY0NDU2MDFiMjExZGRjMDNiMTVmMGExNmUzNjBjYTFhNWQ5YzNmZjQ5
15
- Zjc0NDA5YWZjYzE0NmJiZjgyNTc3ZGNkMTRmNDE5YjI0Mzg3NDI=
13
+ YmI0NzllYzU0NjJmZTdmMTBmNzRiMDExMTA1ZThkMTc0MmI1NTMyZWQ3ZjA5
14
+ NDkxOTkwMzUzNzk5Y2NlNzcwM2I4ZDZjY2U1MTA5YzJhOTI5MmQzYTNkMGJk
15
+ ODlkNjZiNjhmZWY4YTE0OWJlNWY1NzUyM2VjM2U5YzQyZjUyOTQ=
data/bin/dare CHANGED
@@ -6,14 +6,23 @@ class DareCLI < Thor
6
6
  desc "new", "creates a new app"
7
7
  def new(app_name)
8
8
  add_file("#{app_name}/Gemfile") do
9
- "gem 'dare', '0.0.9'"
9
+ "gem 'dare', '0.1.0'
10
+ gem 'opal', '0.7.0beta3'
11
+ gem 'opal-jquery', '0.3.0beta1'"
10
12
  end
11
13
  add_file "#{app_name}/Rakefile" do
12
14
  "desc \"Build #{app_name}.js\"
13
15
  task :build do
16
+ gem 'dare', '0.1.0'
17
+ gem 'opal', '0.7.0beta3'
18
+ gem 'opal-jquery', '0.3.0beta1'
14
19
  require 'opal'
15
20
  require 'opal-jquery'
16
- env = Opal::Environment.new
21
+ Opal::Processor.source_map_enabled = false
22
+ env = Sprockets::Environment.new
23
+ Opal.paths.each do |path|
24
+ env.append_path path
25
+ end
17
26
  env.append_path \".\"
18
27
  env.append_path `bundle show dare`.chomp + '/lib'
19
28
 
@@ -23,8 +32,9 @@ task :build do
23
32
  end"
24
33
  end
25
34
  add_file "#{app_name}/#{app_name}.rb" do
26
- "require 'dare'
35
+ "require 'opal' #this will be removed when 0.7.0 is released
27
36
  require 'opal-jquery'
37
+ require 'dare'
28
38
 
29
39
  class #{app_name[0].upcase + app_name[1..-1]} < Dare::Window
30
40
 
@@ -48,8 +58,10 @@ end
48
58
  "<!DOCTYPE html>
49
59
  <html>
50
60
  <head>
61
+ <title id=\"pageTitle\"></title>
51
62
  <script src=\"http://code.jquery.com/jquery-1.11.0.min.js\"></script>
52
- <script src=\"http://cdn.opalrb.org/opal/0.6.3/opal.min.js\"></script>
63
+ <!-- Will add this back when 0.7.0 is released -->
64
+ <!-- <script src=\"http://cdn.opalrb.org/opal/0.7.0/opal.min.js\"></script> -->
53
65
  </head>
54
66
  <body>
55
67
  <script src=\"#{app_name}.js\"></script>
@@ -1,18 +1,49 @@
1
- require 'dare/clock.rb'
2
- require 'dare/sound.rb'
3
- require 'dare/font.rb'
4
- require 'dare/sprite.rb'
5
- require 'dare/window.rb'
1
+ require 'opal-jquery'
2
+ # Dir["dare/*.rb"].each {|f| require f } # can't do this because Opal
3
+ require "dare/canvas.rb"
4
+ require "dare/font.rb"
5
+ require "dare/image.rb"
6
+ require "dare/keyboard_constants.rb"
7
+ require "dare/sound.rb"
8
+ require "dare/sprite.rb"
9
+ require "dare/window.rb"
6
10
 
7
11
  module Dare
8
- VERSION = "0.0.9"
12
+
13
+ # returns the current version of this gem
14
+ VERSION = "0.1.0"
15
+
16
+ # returns the magnitude of the horizontal component of a vector
17
+ # at some angle and some magnitude where the angle is in degrees
18
+ # starting on the unit circle pointing to the right and going
19
+ # counterclockwise
20
+ # e.g.
21
+ # Dare.offset_x(90, 10) # returns 0
22
+ # Dare.offset_x(45, 10) # returns 10 times the square root of 2
23
+ #
9
24
  def self.offset_x(angle, magnitude)
10
25
  `#{magnitude}*Math.cos(#{angle}*Math.PI/180.0)`
11
26
  end
27
+
28
+ # returns the magnitude of the vertical component of a vector
29
+ # at some angle and some magnitude where the angle is in degrees
30
+ # starting on the unit circle pointing to the right and going
31
+ # counterclockwise
32
+ # e.g.
33
+ # Dare.offset_y(90, 10) # returns 10
34
+ # Dare.offset_y(45, 10) # returns 10 times the square root of 2
35
+ #
12
36
  def self.offset_y(angle, magnitude)
13
37
  `#{magnitude}*Math.sin(#{angle}*Math.PI/180.0)`
14
38
  end
39
+
40
+ # returns the number of milliseconds since the Unix epoch
41
+ # useful for delta physics
42
+ #
15
43
  def self.ms
16
44
  `(new Date()).getTime()`
17
45
  end
46
+ class << self
47
+ attr_accessor :default_canvas
48
+ end
18
49
  end
@@ -0,0 +1,21 @@
1
+ module Dare
2
+ class Canvas
3
+ attr_reader :id, :canvas
4
+ def initialize(opts = {})
5
+ opts[:width] ||= 640
6
+ opts[:height] ||= 480
7
+ opts[:border] ||= false
8
+ `var my_canvas = document.createElement("canvas")`
9
+ @id = rand(36**8).to_s(36)
10
+ `my_canvas.setAttribute('id', #{@id})`
11
+ `my_canvas.width = #{opts[:width]}`
12
+ `my_canvas.height = #{opts[:height]}`
13
+ `my_canvas.style.border = "solid 1px black"` if opts[:border]
14
+ `document.body.appendChild(my_canvas)`
15
+ @canvas = `my_canvas`
16
+ end
17
+ def context
18
+ `#{@canvas}.getContext('2d')`
19
+ end
20
+ end
21
+ end
@@ -1,6 +1,6 @@
1
1
  module Dare
2
2
  class Font
3
- def initialize(window, font_type = "30px Arial")
3
+ def initialize(window = Dare.default_canvas, font_type = "30px Arial")
4
4
  @window = window
5
5
  @font = font_type
6
6
  @color = "red"
@@ -0,0 +1,24 @@
1
+ module Dare
2
+
3
+ # loads an image which can be drawn to a canvas
4
+ #
5
+ class Image
6
+
7
+ # loads a new image resource
8
+ # image = Dare::Image.new('some_image.png')
9
+ #
10
+ def initialize(path = "", window = Dare.default_canvas)
11
+ @img = `new Image()`
12
+ `#{@img}.src = #{path}`
13
+ @window = window
14
+ end
15
+
16
+ # draws image to a canvas at an x and y position
17
+ # x and y represent the top-left corner of the image
18
+ # image.draw(100, 200)
19
+ #
20
+ def draw(x = 0, y = 0)
21
+ `#{@window.canvas.context}.drawImage(#{@img},#{x},#{y})`
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,211 @@
1
+ module Dare
2
+
3
+ # These are the corresponding character keycodes for keyboard presses
4
+ # e.g.
5
+ # if button_down? Dare::KbDown
6
+ # player.crouch #or something
7
+ # end
8
+ #
9
+ # for convenience, you can "include Dare::Kb" at the top
10
+ # of your main app file (after require 'dare'), and then
11
+ # refer to these constants directly
12
+ # e.g.
13
+ # if button_down? KbI
14
+ # open_inventory
15
+ # end
16
+ #
17
+
18
+ Kb0 = 48
19
+ Kb1 = 49
20
+ Kb2 = 50
21
+ Kb3 = 51
22
+ Kb4 = 52
23
+ Kb5 = 53
24
+ Kb6 = 54
25
+ Kb7 = 55
26
+ Kb8 = 56
27
+ Kb9 = 57
28
+ KbA = 65
29
+ KbB = 66
30
+ KbC = 67
31
+ KbD = 68
32
+ KbE = 69
33
+ KbF = 70
34
+ KbG = 71
35
+ KbH = 72
36
+ KbI = 73
37
+ KbJ = 74
38
+ KbK = 75
39
+ KbL = 76
40
+ KbM = 77
41
+ KbN = 78
42
+ KbO = 79
43
+ KbP = 80
44
+ KbQ = 81
45
+ KbR = 82
46
+ KbS = 83
47
+ KbT = 84
48
+ KbU = 85
49
+ KbV = 86
50
+ KbW = 87
51
+ KbX = 88
52
+ KbY = 89
53
+ KbZ = 90
54
+ KbBackspace = 8
55
+ KbDelete = 46
56
+ KbDown = 40
57
+ KbEnd = 35
58
+ KbEnter = 13
59
+ KbReturn = 13
60
+ KbEscape = 27
61
+ KbF1 = 112
62
+ KbF2 = 113
63
+ KbF3 = 114
64
+ KbF4 = 115
65
+ KbF5 = 116
66
+ KbF6 = 117
67
+ KbF7 = 118
68
+ KbF8 = 119
69
+ KbF9 = 120
70
+ KbF10 = 121
71
+ KbF11 = 122
72
+ KbF12 = 123
73
+ KbSpace = 32
74
+ KbPageUp = 33
75
+ KbPageDown = 34
76
+ KbHome = 36
77
+ KbLeft = 37
78
+ KbUp = 38
79
+ KbRight = 39
80
+ KbInsert = 45
81
+ KbShift = 16
82
+ KbControl = 17
83
+ KbAlt = 18
84
+ KbNumpad0 = 96
85
+ KbNumpad1 = 97
86
+ KbNumpad2 = 98
87
+ KbNumpad3 = 99
88
+ KbNumpad4 = 100
89
+ KbNumpad5 = 101
90
+ KbNumpad6 = 102
91
+ KbNumpad7 = 103
92
+ KbNumpad8 = 104
93
+ KbNumpad9 = 105
94
+ KbNumpadMultiply = 106
95
+ KbNumpadAdd = 107
96
+ KbNumpadSubtract = 109
97
+ KbNumpadDivide = 111
98
+ KbTab = 9
99
+ KbBacktick = 192
100
+ KbTilde = 192
101
+ KbGraveAccent = 192
102
+ KbMinus = 189
103
+ KbDash = 189
104
+ KbEqual = 187
105
+ KbBracketLeft = 219
106
+ KbBracketRight = 221
107
+ KbBackslash = 220
108
+ KbSemicolon = 186
109
+ KbApostrophe = 222
110
+ KbComma = 188
111
+ KbPeriod = 190
112
+ KbSlash = 191
113
+
114
+ module Kb
115
+ Kb0 = 48
116
+ Kb1 = 49
117
+ Kb2 = 50
118
+ Kb3 = 51
119
+ Kb4 = 52
120
+ Kb5 = 53
121
+ Kb6 = 54
122
+ Kb7 = 55
123
+ Kb8 = 56
124
+ Kb9 = 57
125
+ KbA = 65
126
+ KbB = 66
127
+ KbC = 67
128
+ KbD = 68
129
+ KbE = 69
130
+ KbF = 70
131
+ KbG = 71
132
+ KbH = 72
133
+ KbI = 73
134
+ KbJ = 74
135
+ KbK = 75
136
+ KbL = 76
137
+ KbM = 77
138
+ KbN = 78
139
+ KbO = 79
140
+ KbP = 80
141
+ KbQ = 81
142
+ KbR = 82
143
+ KbS = 83
144
+ KbT = 84
145
+ KbU = 85
146
+ KbV = 86
147
+ KbW = 87
148
+ KbX = 88
149
+ KbY = 89
150
+ KbZ = 90
151
+ KbBackspace = 8
152
+ KbDelete = 46
153
+ KbDown = 40
154
+ KbEnd = 35
155
+ KbEnter = 13
156
+ KbReturn = 13
157
+ KbEscape = 27
158
+ KbF1 = 112
159
+ KbF2 = 113
160
+ KbF3 = 114
161
+ KbF4 = 115
162
+ KbF5 = 116
163
+ KbF6 = 117
164
+ KbF7 = 118
165
+ KbF8 = 119
166
+ KbF9 = 120
167
+ KbF10 = 121
168
+ KbF11 = 122
169
+ KbF12 = 123
170
+ KbSpace = 32
171
+ KbPageUp = 33
172
+ KbPageDown = 34
173
+ KbHome = 36
174
+ KbLeft = 37
175
+ KbUp = 38
176
+ KbRight = 39
177
+ KbInsert = 45
178
+ KbShift = 16
179
+ KbControl = 17
180
+ KbAlt = 18
181
+ KbNumpad0 = 96
182
+ KbNumpad1 = 97
183
+ KbNumpad2 = 98
184
+ KbNumpad3 = 99
185
+ KbNumpad4 = 100
186
+ KbNumpad5 = 101
187
+ KbNumpad6 = 102
188
+ KbNumpad7 = 103
189
+ KbNumpad8 = 104
190
+ KbNumpad9 = 105
191
+ KbNumpadMultiply = 106
192
+ KbNumpadAdd = 107
193
+ KbNumpadSubtract = 109
194
+ KbNumpadDivide = 111
195
+ KbTab = 9
196
+ KbBacktick = 192
197
+ KbTilde = 192
198
+ KbGraveAccent = 192
199
+ KbMinus = 189
200
+ KbDash = 189
201
+ KbEqual = 187
202
+ KbBracketLeft = 219
203
+ KbBracketRight = 221
204
+ KbBackslash = 220
205
+ KbSemicolon = 186
206
+ KbApostrophe = 222
207
+ KbComma = 188
208
+ KbPeriod = 190
209
+ KbSlash = 191
210
+ end
211
+ end
@@ -1,16 +1,52 @@
1
1
  module Dare
2
+
3
+ # wrapper for JS Audio
4
+ # takes a path/uri as an argument
5
+ # e.g. song = Dare::Sound.new('my_song.mp3')
6
+ # song.play will then play the mp3 in the browser
7
+ #
2
8
  class Sound
3
9
 
4
- def initialize(path)
10
+ # loads an audio resource from a path
11
+ # Sound.new('http://www.some-site.com/song.mp3')
12
+ # Sound.new('local_song_in_same_directory_of_app_js_file.mp3')
13
+ # a predefined volume may be passed as a second parameter
14
+ # Sound.new('file.mp3', 0.5)
15
+ def initialize(path, volume = 1)
5
16
  `var snd = new Audio(#{path})`
6
- `snd.volume = 0.3`
7
- @file = `snd`
17
+ `snd.volume = #{volume}`
18
+ @sound = `snd`
19
+ end
20
+
21
+ # set the volume of the audio resource to value between 0 and 1
22
+ #
23
+ def volume=(vol)
24
+ `#{@sound}.volume = #{vol}`
25
+ end
26
+
27
+ # retrieve the current volume of the audio resource
28
+ #
29
+ def volume
30
+ `#{@sound}.volume`
8
31
  end
9
32
 
33
+ # play the audio resource in the window/tab it was created in
34
+ # if resource was paused, it will start playing from where it left off
35
+ #
10
36
  def play
11
- %x{
12
- #{@file}.play();
13
- }
37
+ `#{@sound}.play()`
38
+ end
39
+
40
+ # pause the audio resource, halting playback
41
+ #
42
+ def pause
43
+ `#{@sound}.pause()`
44
+ end
45
+
46
+ # seek to particular time in playback. Time passed is in seconds.
47
+ #
48
+ def time=(time)
49
+ `#{@sound}.currentTime = #{time}`
14
50
  end
15
51
  end
16
52
  end
@@ -1,9 +1,10 @@
1
1
  module Dare
2
2
  class Sprite
3
- attr_accessor :images
4
- def initialize(window)
3
+ attr_accessor :images, :state
4
+ def initialize(window = Dare.default_canvas)
5
5
  @window = window
6
6
  @images = []
7
+ @state = Hash.new {|h,k| h[k] = Dare::AnimationState.new}
7
8
  @current_image = 0
8
9
  @ticks_on_current_image = 0
9
10
  @x = 0
@@ -1,44 +1,36 @@
1
1
  module Dare
2
- KbRight = 39
3
- KbLeft = 37
4
- class Canvas
5
- attr_reader :id, :canvas
6
- def initialize(opts = {})
7
- opts[:width] ||= 640
8
- opts[:height] ||= 480
9
- opts[:border] ||= false
10
- `var my_canvas = document.createElement("canvas")`
11
- @id = rand(36**8).to_s(36)
12
- `my_canvas.setAttribute('id', #{@id})`
13
- `my_canvas.width = #{opts[:width]}`
14
- `my_canvas.height = #{opts[:height]}`
15
- `my_canvas.style.border = "solid 1px black"` if opts[:border]
16
- `document.body.appendChild(my_canvas)`
17
- @canvas = `my_canvas`
18
- end
19
- def context
20
- `#{@canvas}.getContext('2d')`
21
- end
22
- end
23
2
  class Window
24
- attr_reader :width, :height, :ticks, :mouse_x, :mouse_y, :canvas, :key
3
+
4
+ attr_reader :width, :height, :ticks, :mouse_x, :mouse_y, :canvas, :key, :update_interval
5
+
6
+ # creates a new window object to hold all your game goodness
7
+ # options include:
8
+ # :width # (default 640) sets default canvas to a particular width in pixels
9
+ # :height # (default (480) sets default canvas to a particular height in pixels
10
+ # :update_interval # (default 16.666666) sets the update interval in milliseconds between updates
11
+ # :border # true/false (default false) draws a border around the default canvas
12
+ # :canvas # a canvas to refer to when drawing. Just let the default do its thing
13
+ # :mouse # true/false (default true) turn off mouse event listeners by setting to false
14
+ #
25
15
  def initialize(opts = {})
26
16
  opts[:width] ||= 640
27
17
  opts[:height] ||= 480
28
18
  opts[:update_interval] ||= 16.666666
29
19
  opts[:border] ||= false
30
- opts[:clock] ||= Clock.new(update_interval: opts[:update_interval])
31
20
  opts[:canvas] ||= Canvas.new(width: opts[:width], height: opts[:height], border: opts[:border])
32
- opts[:no_mouse] ||= false
21
+ opts[:mouse] ||= true
33
22
  @width = opts[:width]
34
23
  @height = opts[:height]
24
+ @update_interval = opts[:update_interval]
35
25
  @clock = opts[:clock]
36
- @ticks = 0
37
26
  @canvas = opts[:canvas]
38
- @keys = Array.new(108)
39
- add_mouse_event_listener unless opts[:no_mouse]
27
+ Dare.default_canvas ||= @canvas
28
+ @keys = []
29
+ add_mouse_event_listener if opts[:mouse]
40
30
  add_keyboard_event_listeners
41
31
  end
32
+
33
+ # starts the game loop for the window.
42
34
  def run!
43
35
  %x{
44
36
  function anim_loop() {
@@ -50,13 +42,20 @@ module Dare
50
42
  requestAnimationFrame(anim_loop);
51
43
  }
52
44
  end
53
- def update
54
- @ticks += 1
45
+
46
+ # gets run every frame of animation
47
+ # override this in your subclass of Dare::Window
48
+ def draw
49
+
55
50
  end
56
- def stop!
57
- @clock.stop
51
+
52
+ # gets run every update_interval if it can
53
+ # override this in your subclass of Dare::Window
54
+ def update
55
+
58
56
  end
59
57
 
58
+ # adds mousemove event listener to main canvas
60
59
  def add_mouse_event_listener
61
60
  Element.find("##{@canvas.id}").on :mousemove do |event|
62
61
  coords = get_cursor_position(event)
@@ -65,6 +64,7 @@ module Dare
65
64
  end
66
65
  end
67
66
 
67
+ # adds keyboard event listeners to entire page
68
68
  def add_keyboard_event_listeners
69
69
  Element.find("html").on :keydown do |event|
70
70
  @keys[get_key_id(event)] = true
@@ -74,30 +74,36 @@ module Dare
74
74
  end
75
75
  end
76
76
 
77
+ # checks to see if button passed is currently being pressed
77
78
  def button_down?(button)
78
79
  @keys[button]
79
80
  end
80
81
 
82
+ # sets mouse_x and mouse_y to current mouse positions relative
83
+ # to the main canvas
81
84
  def get_cursor_position(event)
82
85
  if (event.page_x && event.page_y)
83
- x = event.page_x;
84
- y = event.page_y;
86
+ x = event.page_x
87
+ y = event.page_y
85
88
  else
86
89
  doc = Opal.Document[0]
87
90
  x = event[:clientX] + doc.scrollLeft +
88
- doc.documentElement.scrollLeft;
91
+ doc.documentElement.scrollLeft
89
92
  y = event[:clientY] + doc.body.scrollTop +
90
- doc.documentElement.scrollTop;
93
+ doc.documentElement.scrollTop
91
94
  end
92
95
  x -= `#{@canvas.canvas}.offsetLeft`
93
96
  y -= `#{@canvas.canvas}.offsetTop`
94
97
  Coordinates.new(x: x, y: y)
95
98
  end
96
99
 
100
+ # retrieves key code of current pressed key for keydown or keyup event
97
101
  def get_key_id(event)
98
102
  event[:keyCode]
99
103
  end
100
104
 
105
+ # draws a rectangle starting at (top_left[0], top_left[1])
106
+ # down to (top_left[0]+width, top_left[1]+height)
101
107
  def draw_rect(opts = {})
102
108
  x = opts[:top_left][0]
103
109
  y = opts[:top_left][1]
@@ -109,16 +115,19 @@ module Dare
109
115
  `#{@canvas.context}.fillRect(#{x}, #{y}, #{width}, #{height})`
110
116
  end
111
117
 
112
- end
113
- class Coordinates < Struct.new(:x, :y); end
114
- class Image
115
- def initialize(window, path = "")
116
- @img = `new Image()`
117
- `#{@img}.src = #{path}`
118
- @window = window
118
+ # sets the caption/title of the window to the string passed
119
+ def caption(title)
120
+ `document.getElementById('pageTitle').innerHTML = #{title}`
119
121
  end
120
- def draw(x = 0, y = 0)
121
- `#{@window.canvas.context}.drawImage(#{@img},#{x},#{y})`
122
+
123
+ # checks if game is fullscreen. currently not implemented.
124
+ def fullscreen?
125
+ false
122
126
  end
127
+
128
+ # this is here for Gosu API compatability
129
+ def text_input; end
130
+
123
131
  end
132
+ class Coordinates < Struct.new(:x, :y); end
124
133
  end
metadata CHANGED
@@ -1,103 +1,105 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominic Muller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-08 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 10.4.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 10.4.2
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: opal
15
29
  requirement: !ruby/object:Gem::Requirement
16
30
  requirements:
17
31
  - - '='
18
32
  - !ruby/object:Gem::Version
19
- version: 0.6.3
33
+ version: 0.7.0.beta3
20
34
  type: :runtime
21
35
  prerelease: false
22
36
  version_requirements: !ruby/object:Gem::Requirement
23
37
  requirements:
24
38
  - - '='
25
39
  - !ruby/object:Gem::Version
26
- version: 0.6.3
40
+ version: 0.7.0.beta3
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: opal-jquery
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - '='
32
46
  - !ruby/object:Gem::Version
33
- version: 0.2.0
47
+ version: 0.3.0.beta1
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - '='
39
53
  - !ruby/object:Gem::Version
40
- version: 0.2.0
54
+ version: 0.3.0.beta1
41
55
  - !ruby/object:Gem::Dependency
42
- name: rspec
56
+ name: thor
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - ~>
46
- - !ruby/object:Gem::Version
47
- version: '3.0'
48
- - - ! '>='
59
+ - - '='
49
60
  - !ruby/object:Gem::Version
50
- version: 3.0.0
51
- type: :development
61
+ version: 0.19.1
62
+ type: :runtime
52
63
  prerelease: false
53
64
  version_requirements: !ruby/object:Gem::Requirement
54
65
  requirements:
55
- - - ~>
56
- - !ruby/object:Gem::Version
57
- version: '3.0'
58
- - - ! '>='
66
+ - - '='
59
67
  - !ruby/object:Gem::Version
60
- version: 3.0.0
68
+ version: 0.19.1
61
69
  - !ruby/object:Gem::Dependency
62
- name: pry
70
+ name: opal-rspec
63
71
  requirement: !ruby/object:Gem::Requirement
64
72
  requirements:
65
- - - ~>
66
- - !ruby/object:Gem::Version
67
- version: '0.10'
68
- - - ! '>='
73
+ - - '='
69
74
  - !ruby/object:Gem::Version
70
- version: 0.10.1
75
+ version: 0.4.0.beta4
71
76
  type: :development
72
77
  prerelease: false
73
78
  version_requirements: !ruby/object:Gem::Requirement
74
79
  requirements:
75
- - - ~>
76
- - !ruby/object:Gem::Version
77
- version: '0.10'
78
- - - ! '>='
80
+ - - '='
79
81
  - !ruby/object:Gem::Version
80
- version: 0.10.1
82
+ version: 0.4.0.beta4
81
83
  - !ruby/object:Gem::Dependency
82
- name: coveralls
84
+ name: pry
83
85
  requirement: !ruby/object:Gem::Requirement
84
86
  requirements:
85
87
  - - ~>
86
88
  - !ruby/object:Gem::Version
87
- version: '0.7'
89
+ version: '0.10'
88
90
  - - ! '>='
89
91
  - !ruby/object:Gem::Version
90
- version: 0.7.2
92
+ version: 0.10.1
91
93
  type: :development
92
94
  prerelease: false
93
95
  version_requirements: !ruby/object:Gem::Requirement
94
96
  requirements:
95
97
  - - ~>
96
98
  - !ruby/object:Gem::Version
97
- version: '0.7'
99
+ version: '0.10'
98
100
  - - ! '>='
99
101
  - !ruby/object:Gem::Version
100
- version: 0.7.2
102
+ version: 0.10.1
101
103
  description:
102
104
  email: nicklink483@gmail.com
103
105
  executables:
@@ -107,8 +109,10 @@ extra_rdoc_files: []
107
109
  files:
108
110
  - bin/dare
109
111
  - lib/dare.rb
110
- - lib/dare/clock.rb
112
+ - lib/dare/canvas.rb
111
113
  - lib/dare/font.rb
114
+ - lib/dare/image.rb
115
+ - lib/dare/keyboard_constants.rb
112
116
  - lib/dare/sound.rb
113
117
  - lib/dare/sprite.rb
114
118
  - lib/dare/window.rb
@@ -1,17 +0,0 @@
1
- module Dare
2
- class Clock
3
-
4
- def initialize(opts = {})
5
- opts[:update_interval] ||= 16.666
6
- @update_interval = opts[:update_interval]
7
- end
8
-
9
- def start(&block)
10
- @interval = `setInterval(function(){#{block.call}}, #{@update_interval})`
11
- end
12
-
13
- def stop
14
- `clearInterval(#@interval)`
15
- end
16
- end
17
- end