gosu_enhanced 0.3.2 → 0.3.3
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 +4 -4
- data/Gemfile.lock +21 -17
- data/Rakefile +1 -1
- data/gosu_enhanced.gemspec +2 -2
- data/lib/gosu_enhanced/point.rb +6 -8
- data/lib/gosu_enhanced/size.rb +6 -16
- data/lib/gosu_enhanced/version.rb +1 -1
- data/spec/point_spec.rb +7 -0
- data/spec/region_spec.rb +10 -0
- data/spec/size_spec.rb +7 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dc6fb4cc8601ab21b00c0d32b1f15c164e11286
|
4
|
+
data.tar.gz: 1eeb8f44e773cfeee38f073071816e50f6cd462d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5abb6c36d7f637e360a6264fa7b570f0c29e650a378e32279d03d6c5cfedf168dcdfe79d7231c7684d8abc10784111729f0c14287ba531a0d57fd057bc64f76b
|
7
|
+
data.tar.gz: cbbc81526079ec291068f354bd01f816d5af62d4678a3e210cfecc18320491bcb2c5c07558cd5e5f04e862ddb70295bb363faf058b6912b1fca8d3debeeb2831
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gosu_enhanced (0.3.
|
4
|
+
gosu_enhanced (0.3.3)
|
5
5
|
gosu (~> 0.7)
|
6
6
|
|
7
7
|
GEM
|
@@ -11,22 +11,26 @@ GEM
|
|
11
11
|
diff-lcs (1.2.5)
|
12
12
|
gosu (0.7.50)
|
13
13
|
method_source (0.8.2)
|
14
|
-
pry (0.
|
15
|
-
coderay (~> 1.0)
|
16
|
-
method_source (~> 0.8)
|
14
|
+
pry (0.10.0)
|
15
|
+
coderay (~> 1.1.0)
|
16
|
+
method_source (~> 0.8.1)
|
17
17
|
slop (~> 3.4)
|
18
|
-
rake (0.9.
|
19
|
-
rspec (
|
20
|
-
rspec-core (~>
|
21
|
-
rspec-expectations (~>
|
22
|
-
rspec-mocks (~>
|
23
|
-
rspec-core (
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
18
|
+
rake (0.9.6)
|
19
|
+
rspec (3.0.0)
|
20
|
+
rspec-core (~> 3.0.0)
|
21
|
+
rspec-expectations (~> 3.0.0)
|
22
|
+
rspec-mocks (~> 3.0.0)
|
23
|
+
rspec-core (3.0.2)
|
24
|
+
rspec-support (~> 3.0.0)
|
25
|
+
rspec-expectations (3.0.2)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.0.0)
|
28
|
+
rspec-mocks (3.0.2)
|
29
|
+
rspec-support (~> 3.0.0)
|
30
|
+
rspec-nc (0.1.0)
|
31
|
+
rspec (>= 2.9)
|
29
32
|
terminal-notifier (~> 1.4.2)
|
33
|
+
rspec-support (3.0.2)
|
30
34
|
slop (3.5.0)
|
31
35
|
terminal-notifier (1.4.2)
|
32
36
|
|
@@ -36,7 +40,7 @@ PLATFORMS
|
|
36
40
|
DEPENDENCIES
|
37
41
|
bundler (~> 1.6)
|
38
42
|
gosu_enhanced!
|
39
|
-
pry (~> 0.
|
43
|
+
pry (~> 0.10)
|
40
44
|
rake (~> 0.9)
|
41
|
-
rspec (~>
|
45
|
+
rspec (~> 3.0)
|
42
46
|
rspec-nc (~> 0.0)
|
data/Rakefile
CHANGED
data/gosu_enhanced.gemspec
CHANGED
@@ -26,7 +26,7 @@ of text in a rectangle size.}
|
|
26
26
|
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.6"
|
28
28
|
spec.add_development_dependency "rake", "~> 0.9"
|
29
|
-
spec.add_development_dependency "rspec", "~>
|
29
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
30
30
|
spec.add_development_dependency "rspec-nc", "~> 0.0"
|
31
|
-
spec.add_development_dependency "pry", "~> 0.
|
31
|
+
spec.add_development_dependency "pry", "~> 0.10"
|
32
32
|
end
|
data/lib/gosu_enhanced/point.rb
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
module GosuEnhanced
|
2
2
|
# Hold a (x, y) pixel position, and allow for offsetting and movement
|
3
|
-
|
3
|
+
Point = Struct.new( :x, :y ) do
|
4
4
|
def offset( by_x, by_y = nil )
|
5
|
-
|
6
|
-
Point.new( x + by_x.x, y + by_x.y )
|
7
|
-
elsif by_x.respond_to? :width
|
8
|
-
Point.new( x + by_x.width, y + by_x.height )
|
9
|
-
else
|
10
|
-
Point.new( x + by_x, y + by_y )
|
11
|
-
end
|
5
|
+
self.dup.move_by!( by_x, by_y )
|
12
6
|
end
|
13
7
|
|
14
8
|
# Negative co-ordinates are allowed.
|
@@ -24,6 +18,8 @@ module GosuEnhanced
|
|
24
18
|
self.x += by_x
|
25
19
|
self.y += by_y
|
26
20
|
end
|
21
|
+
|
22
|
+
self
|
27
23
|
end
|
28
24
|
|
29
25
|
def move_to!( new_x, new_y = nil )
|
@@ -32,6 +28,8 @@ module GosuEnhanced
|
|
32
28
|
else
|
33
29
|
self.x, self.y = new_x, new_y
|
34
30
|
end
|
31
|
+
|
32
|
+
self
|
35
33
|
end
|
36
34
|
end
|
37
35
|
end
|
data/lib/gosu_enhanced/size.rb
CHANGED
@@ -12,23 +12,11 @@ module GosuEnhanced
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def inflate( by_w, by_h = nil )
|
15
|
-
|
16
|
-
validate( by_w.width, by_w.height )
|
17
|
-
|
18
|
-
Size.new( width + by_w.width, height + by_w.height )
|
19
|
-
else
|
20
|
-
validate( by_w, by_h )
|
21
|
-
|
22
|
-
Size.new( width + by_w, height + by_h )
|
23
|
-
end
|
15
|
+
self.dup.inflate!( by_w, by_h )
|
24
16
|
end
|
25
17
|
|
26
18
|
def deflate( by_w, by_h = nil )
|
27
|
-
|
28
|
-
inflate( -by_w.width, -by_w.height )
|
29
|
-
else
|
30
|
-
inflate( -by_w, -by_h )
|
31
|
-
end
|
19
|
+
self.dup.deflate!( by_w, by_h )
|
32
20
|
end
|
33
21
|
|
34
22
|
def inflate!( by_w, by_h = nil )
|
@@ -43,6 +31,8 @@ module GosuEnhanced
|
|
43
31
|
@width += by_w
|
44
32
|
@height += by_h
|
45
33
|
end
|
34
|
+
|
35
|
+
self
|
46
36
|
end
|
47
37
|
|
48
38
|
def deflate!( by_w, by_h = nil )
|
@@ -56,11 +46,11 @@ module GosuEnhanced
|
|
56
46
|
def ==( other )
|
57
47
|
width == other.width && height == other.height
|
58
48
|
end
|
59
|
-
|
49
|
+
|
60
50
|
def to_s
|
61
51
|
"<GosuEnhanced::Size #{width}x#{height}>"
|
62
52
|
end
|
63
|
-
|
53
|
+
|
64
54
|
private
|
65
55
|
|
66
56
|
def validate( by_w, by_h )
|
data/spec/point_spec.rb
CHANGED
@@ -141,4 +141,11 @@ describe GosuEnhanced::Point do
|
|
141
141
|
expect( point.y ).to eq 20
|
142
142
|
end
|
143
143
|
end
|
144
|
+
|
145
|
+
describe '#to_s' do
|
146
|
+
it 'should render usefully.' do
|
147
|
+
point = GosuEnhanced::Point.new( 10, 20 )
|
148
|
+
expect( point.to_s ).to eq '#<struct GosuEnhanced::Point x=10, y=20>'
|
149
|
+
end
|
150
|
+
end
|
144
151
|
end
|
data/spec/region_spec.rb
CHANGED
@@ -79,4 +79,14 @@ describe GosuEnhanced::Region do
|
|
79
79
|
expect( reg.size ).to eq GosuEnhanced::Size.new( 30, 40 )
|
80
80
|
end
|
81
81
|
end
|
82
|
+
|
83
|
+
describe '#to_s' do
|
84
|
+
it 'should render usefully' do
|
85
|
+
point = GosuEnhanced::Point.new( 10, 20 )
|
86
|
+
size = GosuEnhanced::Size.new( 30, 40 )
|
87
|
+
region = GosuEnhanced::Region.new( point, size )
|
88
|
+
|
89
|
+
expect( region.to_s ).to eq '<GosuEnhanced::Region: #<struct GosuEnhanced::Point x=10, y=20>, <GosuEnhanced::Size 30x40>>'
|
90
|
+
end
|
91
|
+
end
|
82
92
|
end
|
data/spec/size_spec.rb
CHANGED
@@ -140,4 +140,11 @@ describe GosuEnhanced::Size do
|
|
140
140
|
expect( size.height ).to eq 20
|
141
141
|
end
|
142
142
|
end
|
143
|
+
|
144
|
+
describe '#to_s' do
|
145
|
+
it 'should render usefully' do
|
146
|
+
size = GosuEnhanced::Size.new( 10, 20 )
|
147
|
+
expect( size.to_s ).to eq '<GosuEnhanced::Size 10x20>'
|
148
|
+
end
|
149
|
+
end
|
143
150
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gosu_enhanced
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Nicholls
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gosu
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '3.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '3.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec-nc
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0.
|
89
|
+
version: '0.10'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0.
|
96
|
+
version: '0.10'
|
97
97
|
description: |-
|
98
98
|
Point, Size, and Region classes to hold pixel addresses
|
99
99
|
and rectangle sizes respectively.
|
@@ -154,3 +154,4 @@ test_files:
|
|
154
154
|
- spec/region_spec.rb
|
155
155
|
- spec/size_spec.rb
|
156
156
|
- spec/spec_helper.rb
|
157
|
+
has_rdoc:
|