gosu_extensions 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/{controls.rb → core/controls.rb} +0 -0
- data/lib/{game_window.rb → core/game_window.rb} +0 -0
- data/lib/{traits → core}/initializer_hooks.rb +0 -0
- data/lib/{traits → core}/it_is_a.rb +0 -0
- data/lib/{layer.rb → core/layer.rb} +0 -0
- data/lib/{resources.rb → core/resources.rb} +0 -0
- data/lib/{scheduling.rb → core/scheduling.rb} +0 -0
- data/lib/core/trait.rb +1 -0
- data/lib/core/traits.rb +9 -0
- data/lib/{vector_utilities.rb → core/vector_utilities.rb} +0 -0
- data/lib/{waves.rb → core/waves.rb} +0 -0
- data/lib/gosu_extensions.rb +14 -8
- data/lib/traits/attachable.rb +1 -1
- data/lib/traits/controllable.rb +1 -1
- data/lib/traits/damaging.rb +1 -1
- data/lib/traits/generator.rb +1 -1
- data/lib/traits/imageable.rb +1 -1
- data/lib/traits/lives.rb +1 -1
- data/lib/traits/moveable.rb +1 -1
- data/lib/traits/pod.rb +1 -1
- data/lib/traits/shooter.rb +1 -1
- data/lib/traits/short_lived.rb +1 -1
- data/lib/traits/shot.rb +1 -1
- data/lib/traits/targetable.rb +1 -1
- data/lib/traits/targeting/closest.rb +1 -1
- data/lib/traits/turnable.rb +5 -2
- data/spec/lib/{traits → core}/initializer_hooks_spec.rb +0 -0
- data/spec/lib/core/it_is_a_spec.rb +70 -0
- data/spec/lib/core/trait_spec.rb +9 -0
- data/spec/lib/core/traits_spec.rb +13 -0
- metadata +17 -12
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.15
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/core/trait.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
module Trait; end
|
data/lib/core/traits.rb
ADDED
File without changes
|
File without changes
|
data/lib/gosu_extensions.rb
CHANGED
@@ -15,19 +15,30 @@ rescue LoadError => e
|
|
15
15
|
end
|
16
16
|
|
17
17
|
require 'resources'
|
18
|
-
require 'vector_utilities'
|
19
18
|
|
20
19
|
$:.unshift File.join(File.dirname(__FILE__), '/extensions')
|
21
20
|
require 'module'
|
22
21
|
require 'numeric'
|
23
22
|
|
24
|
-
$:.unshift File.join(File.dirname(__FILE__), '/
|
23
|
+
$:.unshift File.join(File.dirname(__FILE__), '/core')
|
24
|
+
require 'vector_utilities'
|
25
|
+
require 'initializer_hooks'
|
26
|
+
|
27
|
+
require 'trait'
|
28
|
+
require 'traits'
|
25
29
|
require 'it_is_a'
|
30
|
+
|
31
|
+
require 'scheduling'
|
32
|
+
require 'game_window'
|
33
|
+
require 'controls'
|
34
|
+
require 'waves'
|
35
|
+
require 'layer'
|
36
|
+
|
37
|
+
$:.unshift File.join(File.dirname(__FILE__), '/traits')
|
26
38
|
require 'pod'
|
27
39
|
require 'attachable'
|
28
40
|
require 'damaging'
|
29
41
|
require 'generator'
|
30
|
-
require 'initializer_hooks'
|
31
42
|
require 'lives'
|
32
43
|
require 'targeting'
|
33
44
|
require 'targeting/closest'
|
@@ -43,12 +54,7 @@ require 'short_lived'
|
|
43
54
|
$:.unshift File.join(File.dirname(__FILE__), '/units')
|
44
55
|
require 'thing'
|
45
56
|
|
46
|
-
require 'controls'
|
47
57
|
require 'menu'
|
48
|
-
require 'game_window'
|
49
|
-
require 'scheduling'
|
50
|
-
require 'waves'
|
51
|
-
require 'layer'
|
52
58
|
|
53
59
|
DEFAULT_SCREEN_WIDTH = 1200 unless defined?(DEFAULT_SCREEN_WIDTH)
|
54
60
|
DEFAULT_SCREEN_HEIGHT = 700 unless defined?(DEFAULT_SCREEN_HEIGHT)
|
data/lib/traits/attachable.rb
CHANGED
data/lib/traits/controllable.rb
CHANGED
data/lib/traits/damaging.rb
CHANGED
data/lib/traits/generator.rb
CHANGED
data/lib/traits/imageable.rb
CHANGED
data/lib/traits/lives.rb
CHANGED
data/lib/traits/moveable.rb
CHANGED
data/lib/traits/pod.rb
CHANGED
data/lib/traits/shooter.rb
CHANGED
data/lib/traits/short_lived.rb
CHANGED
data/lib/traits/shot.rb
CHANGED
data/lib/traits/targetable.rb
CHANGED
data/lib/traits/turnable.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
#
|
3
|
-
module Turnable
|
3
|
+
module Turnable extend Trait
|
4
4
|
|
5
5
|
Left = :turn_left
|
6
6
|
Right = :turn_right
|
@@ -9,7 +9,10 @@ module Turnable
|
|
9
9
|
base.extend ClassMethods
|
10
10
|
end
|
11
11
|
|
12
|
-
#
|
12
|
+
# Defines a turn_speed method on the class.
|
13
|
+
#
|
14
|
+
# Calling it will define a turn_speed method on the instance
|
15
|
+
# that lets the thing rotate with the given frequency.
|
13
16
|
#
|
14
17
|
module ClassMethods
|
15
18
|
def turn_speed amount
|
File without changes
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '/../../spec_helper')
|
2
|
+
|
3
|
+
describe ItIsA do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
Trait1 = Trait
|
7
|
+
Trait2 = Trait
|
8
|
+
end
|
9
|
+
|
10
|
+
before(:each) do
|
11
|
+
@class = Class.new do
|
12
|
+
include ItIsA
|
13
|
+
def self.to_s
|
14
|
+
"TestClass"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should define a it_is_a method that calls include" do
|
20
|
+
@class.should_receive(:include).once.with Trait
|
21
|
+
|
22
|
+
@class.it_is_a Trait
|
23
|
+
end
|
24
|
+
it "should take multiple traits" do
|
25
|
+
@class.should_receive(:include).once.with Trait1
|
26
|
+
@class.should_receive(:include).once.with Trait2
|
27
|
+
|
28
|
+
@class.it_is_a Trait1, Trait2
|
29
|
+
end
|
30
|
+
it "should call a given block on the instance" do
|
31
|
+
@class.it_is_a Trait1, Trait2 do
|
32
|
+
self.to_s.should == "TestClass"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should define a it_is method that calls include" do
|
37
|
+
@class.should_receive(:include).once.with Trait
|
38
|
+
|
39
|
+
@class.it_is Trait
|
40
|
+
end
|
41
|
+
it "should take multiple traits" do
|
42
|
+
@class.should_receive(:include).once.with Trait1
|
43
|
+
@class.should_receive(:include).once.with Trait2
|
44
|
+
|
45
|
+
@class.it_is Trait1, Trait2
|
46
|
+
end
|
47
|
+
it "should call a given block on the instance" do
|
48
|
+
@class.it_is Trait1, Trait2 do
|
49
|
+
self.to_s.should == "TestClass"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should define a it_has method that calls include" do
|
54
|
+
@class.should_receive(:include).once.with Trait
|
55
|
+
|
56
|
+
@class.it_has Trait
|
57
|
+
end
|
58
|
+
it "should take multiple traits" do
|
59
|
+
@class.should_receive(:include).once.with Trait
|
60
|
+
@class.should_receive(:include).once.with Trait2
|
61
|
+
|
62
|
+
@class.it_has Trait1, Trait2
|
63
|
+
end
|
64
|
+
it "should call a given block on the instance" do
|
65
|
+
@class.it_has Trait1, Trait2 do
|
66
|
+
self.to_s.should == "TestClass"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '/../../spec_helper')
|
2
|
+
|
3
|
+
describe Traits do
|
4
|
+
|
5
|
+
describe "list" do
|
6
|
+
it "should return a list of all traits that can be included using it_is_a, it_is, or it_has" do
|
7
|
+
ActiveSupport::Deprecation.stub! :warn => :shut_up
|
8
|
+
|
9
|
+
Traits.list.should == [Attachable, Controllable, Damaging, Generator, Imageable, Lives, Moveable, Pod, Shooter, ShortLived, Shot, Targetable, Targeting::Closest, Turnable]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 15
|
9
|
+
version: 0.1.15
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Florian Hanke
|
@@ -53,22 +53,26 @@ files:
|
|
53
53
|
- Rakefile
|
54
54
|
- VERSION
|
55
55
|
- generator/gogogosu.rb
|
56
|
-
- lib/controls.rb
|
56
|
+
- lib/core/controls.rb
|
57
|
+
- lib/core/game_window.rb
|
58
|
+
- lib/core/initializer_hooks.rb
|
59
|
+
- lib/core/it_is_a.rb
|
60
|
+
- lib/core/layer.rb
|
61
|
+
- lib/core/resources.rb
|
62
|
+
- lib/core/scheduling.rb
|
63
|
+
- lib/core/trait.rb
|
64
|
+
- lib/core/traits.rb
|
65
|
+
- lib/core/vector_utilities.rb
|
66
|
+
- lib/core/waves.rb
|
57
67
|
- lib/extensions/module.rb
|
58
68
|
- lib/extensions/numeric.rb
|
59
|
-
- lib/game_window.rb
|
60
69
|
- lib/gosu_extensions.rb
|
61
|
-
- lib/layer.rb
|
62
70
|
- lib/menu.rb
|
63
|
-
- lib/resources.rb
|
64
|
-
- lib/scheduling.rb
|
65
71
|
- lib/traits/attachable.rb
|
66
72
|
- lib/traits/controllable.rb
|
67
73
|
- lib/traits/damaging.rb
|
68
74
|
- lib/traits/generator.rb
|
69
75
|
- lib/traits/imageable.rb
|
70
|
-
- lib/traits/initializer_hooks.rb
|
71
|
-
- lib/traits/it_is_a.rb
|
72
76
|
- lib/traits/lives.rb
|
73
77
|
- lib/traits/moveable.rb
|
74
78
|
- lib/traits/pod.rb
|
@@ -80,8 +84,6 @@ files:
|
|
80
84
|
- lib/traits/targeting/closest.rb
|
81
85
|
- lib/traits/turnable.rb
|
82
86
|
- lib/units/thing.rb
|
83
|
-
- lib/vector_utilities.rb
|
84
|
-
- lib/waves.rb
|
85
87
|
has_rdoc: true
|
86
88
|
homepage: http://www.github.com/floere/gosu_extensions
|
87
89
|
licenses: []
|
@@ -114,12 +116,15 @@ signing_key:
|
|
114
116
|
specification_version: 3
|
115
117
|
summary: Default extensions built onto the popular Gosu Framework. Uses Chipmunk for game physics. That's it for now. I'm working on them. Anyway, GAME ON!
|
116
118
|
test_files:
|
119
|
+
- spec/lib/core/initializer_hooks_spec.rb
|
120
|
+
- spec/lib/core/it_is_a_spec.rb
|
121
|
+
- spec/lib/core/trait_spec.rb
|
122
|
+
- spec/lib/core/traits_spec.rb
|
117
123
|
- spec/lib/extensions/module_spec.rb
|
118
124
|
- spec/lib/extensions/numeric_spec.rb
|
119
125
|
- spec/lib/traits/attachable_spec.rb
|
120
126
|
- spec/lib/traits/damaging_spec.rb
|
121
127
|
- spec/lib/traits/imageable_spec.rb
|
122
|
-
- spec/lib/traits/initializer_hooks_spec.rb
|
123
128
|
- spec/lib/traits/shooter_spec.rb
|
124
129
|
- spec/lib/traits/short_lived_spec.rb
|
125
130
|
- spec/lib/traits/shot_spec.rb
|