gosu_enhanced 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +15 -7
- data/gosu_enhanced.gemspec +5 -4
- data/lib/gosu_enhanced/region.rb +1 -1
- data/lib/gosu_enhanced/version.rb +2 -1
- data/spec/region_delegation_spec.rb +10 -8
- data/spec/region_spec.rb +1 -1
- data/spec/size_spec.rb +2 -2
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29d527338df273837e838094cad9d56f463d4431
|
4
|
+
data.tar.gz: fddbe0fc5685ec3cdd05d8911303bd4ed8acccb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0152edf5fd66eb1c471c7ec130a97ab6e24413ec8f8b445318c4bbb2d0eaecffc8f958316f6b76831198d57d38aeb22cfab5e421560b2b53b5c95f9f9834567
|
7
|
+
data.tar.gz: 545e3275da279399eff0475d104e52352232f0d2270aae72a82370b0ad3a5cb8ba92ad21045426dfcaab7ce831c5678f717e2b4721bbc43d17487223a858462f
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
#
|
1
|
+
# gosu_enhanced V0.4.0
|
2
2
|
|
3
3
|
Some added classes for using Gosu.
|
4
4
|
|
5
5
|
## Point
|
6
6
|
|
7
|
-
Holds a set of (x, y) co-ordinates. Allows for offsetting and moving by another
|
8
|
-
Point or a pair of co-ordinates.
|
7
|
+
Holds a set of (x, y) co-ordinates. Allows for offsetting and moving by another
|
8
|
+
Point, a Size, or a pair of co-ordinates.
|
9
9
|
|
10
10
|
## Size
|
11
11
|
|
12
12
|
Holds a (width, height) size. Allows for inflation / deflation with another
|
13
|
-
|
13
|
+
Size or a pair of dimensions.
|
14
14
|
|
15
15
|
## Region
|
16
16
|
|
17
|
-
Holds a position and size. Delegates movement and size change to its
|
17
|
+
Holds a position and size. Delegates movement and size change to its
|
18
18
|
constituents.
|
19
19
|
|
20
20
|
## Gosu::Window
|
21
21
|
|
22
|
-
Added #draw_rectangle which draws a simple rectangle specified with a Point
|
22
|
+
Added #draw_rectangle which draws a simple rectangle specified with a Point
|
23
23
|
and Size in one colour.
|
24
24
|
|
25
25
|
## Gosu::Font
|
26
26
|
|
27
27
|
Added #measure and #centred_in which measure a piece of text and centre it in
|
28
|
-
a given Size.
|
28
|
+
a given Size respectively.
|
29
29
|
|
30
30
|
## Installation
|
31
31
|
|
@@ -52,3 +52,11 @@ TODO: Write usage instructions here
|
|
52
52
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
53
53
|
4. Push to the branch (`git push origin my-new-feature`)
|
54
54
|
5. Create a new Pull Request
|
55
|
+
|
56
|
+
## DISCLAIMER
|
57
|
+
|
58
|
+
I am not affiliated in any way to the authors of the Gosu Gem or
|
59
|
+
[libgosu](libgosu.org).
|
60
|
+
|
61
|
+
Gosu and all documentation © 2001-2014 Julian Raschke, Jan Lücker, and
|
62
|
+
other contributors. Gosu is released under the MIT license.
|
data/gosu_enhanced.gemspec
CHANGED
@@ -9,10 +9,11 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Julian Nicholls"]
|
10
10
|
spec.email = ["juliannicholls29@gmail.com"]
|
11
11
|
spec.summary = %q{Enhanced versions of some Gosu classes.}
|
12
|
-
spec.description = %
|
13
|
-
rectangle sizes respectively.
|
14
|
-
|
15
|
-
|
12
|
+
spec.description = %{Point, Size, and Region classes to hold pixel addresses
|
13
|
+
and rectangle sizes respectively.
|
14
|
+
Updated window class to draw rectangle in a single colour more easily.
|
15
|
+
Updated font class to measure text and return co-ordinates to centre a piece
|
16
|
+
of text in a rectangle size.}
|
16
17
|
spec.homepage = "https://github.com/JulianNicholls/gosu_enhanced-gem"
|
17
18
|
spec.license = "MIT"
|
18
19
|
|
data/lib/gosu_enhanced/region.rb
CHANGED
@@ -37,8 +37,9 @@ describe GosuEnhanced::Region do
|
|
37
37
|
reg = GosuEnhanced::Region.new( point, size )
|
38
38
|
reg.move_by!( GosuEnhanced::Point.new( 30, 40 ) )
|
39
39
|
expect( reg.left ).to eq 40
|
40
|
-
expect( reg.top ).to
|
40
|
+
expect( reg.top ).to eq 60
|
41
41
|
|
42
|
+
# The original point should not have been changed by the move_by!
|
42
43
|
expect( point.x ).to eq 10
|
43
44
|
expect( point.y ).to eq 20
|
44
45
|
end
|
@@ -47,28 +48,28 @@ describe GosuEnhanced::Region do
|
|
47
48
|
reg = GosuEnhanced::Region.new( point, size )
|
48
49
|
reg.move_by!( GosuEnhanced::Size.new( 40, 50 ) )
|
49
50
|
expect( reg.left ).to eq 50
|
50
|
-
expect( reg.top ).to
|
51
|
+
expect( reg.top ).to eq 70
|
51
52
|
end
|
52
53
|
|
53
54
|
it 'should work with two positive values' do
|
54
55
|
reg = GosuEnhanced::Region.new( point, size )
|
55
56
|
reg.move_by!( 40, 50 )
|
56
57
|
expect( reg.left ).to eq 50
|
57
|
-
expect( reg.top ).to
|
58
|
+
expect( reg.top ).to eq 70
|
58
59
|
end
|
59
60
|
|
60
61
|
it 'should work with two negative values' do
|
61
62
|
reg = GosuEnhanced::Region.new( point, size )
|
62
63
|
reg.move_by!( -5, -10 )
|
63
64
|
expect( reg.left ).to eq 5
|
64
|
-
expect( reg.top ).to
|
65
|
+
expect( reg.top ).to eq 10
|
65
66
|
end
|
66
67
|
|
67
68
|
it 'should work with values that result in negative co-ordinates' do
|
68
69
|
reg = GosuEnhanced::Region.new( point, size )
|
69
70
|
reg.move_by!( -80, -150 )
|
70
71
|
expect( reg.left ).to eq( -70 )
|
71
|
-
expect( reg.top ).to
|
72
|
+
expect( reg.top ).to eq( -130 )
|
72
73
|
end
|
73
74
|
end
|
74
75
|
|
@@ -77,7 +78,7 @@ describe GosuEnhanced::Region do
|
|
77
78
|
reg = GosuEnhanced::Region.new( point, size )
|
78
79
|
reg.move_to!( GosuEnhanced::Point.new( 30, 40 ) )
|
79
80
|
expect( reg.left ).to eq 30
|
80
|
-
expect( reg.top ).to
|
81
|
+
expect( reg.top ).to eq 40
|
81
82
|
|
82
83
|
expect( point.x ).to eq 10
|
83
84
|
expect( point.y ).to eq 20
|
@@ -87,14 +88,14 @@ describe GosuEnhanced::Region do
|
|
87
88
|
reg = GosuEnhanced::Region.new( point, size )
|
88
89
|
reg.move_to!( 40, 50 )
|
89
90
|
expect( reg.left ).to eq 40
|
90
|
-
expect( reg.top ).to
|
91
|
+
expect( reg.top ).to eq 50
|
91
92
|
end
|
92
93
|
|
93
94
|
it 'should work with two negative values' do
|
94
95
|
reg = GosuEnhanced::Region.new( point, size )
|
95
96
|
reg.move_to!( -5, -10 )
|
96
97
|
expect( reg.left ).to eq( -5 )
|
97
|
-
expect( reg.top ).to
|
98
|
+
expect( reg.top ).to eq( -10 )
|
98
99
|
end
|
99
100
|
end
|
100
101
|
|
@@ -105,6 +106,7 @@ describe GosuEnhanced::Region do
|
|
105
106
|
expect( reg.width ).to eq 60
|
106
107
|
expect( reg.height ).to eq 80
|
107
108
|
|
109
|
+
# The original size should not have been changed by the inflate!
|
108
110
|
expect( size.width ).to eq 30
|
109
111
|
expect( size.height ).to eq 40
|
110
112
|
end
|
data/spec/region_spec.rb
CHANGED
data/spec/size_spec.rb
CHANGED
@@ -9,8 +9,8 @@ describe GosuEnhanced::Size do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
it 'should reject negative values' do
|
12
|
-
expect { GosuEnhanced::Size.new( -10, 20 ) }.to raise_error
|
13
|
-
expect { GosuEnhanced::Size.new( 10, -20 ) }.to raise_error
|
12
|
+
expect { GosuEnhanced::Size.new( -10, 20 ) }.to raise_error Exception
|
13
|
+
expect { GosuEnhanced::Size.new( 10, -20 ) }.to raise_error Exception
|
14
14
|
expect { GosuEnhanced::Size.new( -10, -20 ) }.to raise_error Exception
|
15
15
|
end
|
16
16
|
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.1
|
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-04-
|
11
|
+
date: 2014-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gosu
|
@@ -94,10 +94,12 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.9'
|
97
|
-
description:
|
98
|
-
|
99
|
-
|
100
|
-
|
97
|
+
description: |-
|
98
|
+
Point, Size, and Region classes to hold pixel addresses
|
99
|
+
and rectangle sizes respectively.
|
100
|
+
Updated window class to draw rectangle in a single colour more easily.
|
101
|
+
Updated font class to measure text and return co-ordinates to centre a piece
|
102
|
+
of text in a rectangle size.
|
101
103
|
email:
|
102
104
|
- juliannicholls29@gmail.com
|
103
105
|
executables: []
|