gosu_enhanced 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/gosu_enhanced.gemspec +1 -1
- data/lib/gosu_enhanced/enhanced.rb +24 -1
- data/lib/gosu_enhanced/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdfb20c8fb5079f40adf28f07762babe6a844f1c
|
4
|
+
data.tar.gz: 6dd6cfd4a944a7e1888c423d878c7fd4835c67e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e27f8d50b970ee5a7b9b41b6ecb76fa1da3597cbcfb10df3af0d44c8b9a7fcb4840061b828a92fefc5a26291132680fc2ddb71e03a6e5da6a2c0798e54d6333f
|
7
|
+
data.tar.gz: 35804c2dac06b6b21ebd527c1617c16e626003c9b622063f46a7dca4eb9de003010c2aaaecb064d649618f8def62ad4c4f72156999c4bdf140b5c39d30536a0d
|
data/README.md
CHANGED
@@ -47,7 +47,7 @@ Or install it yourself as:
|
|
47
47
|
|
48
48
|
## Contributing
|
49
49
|
|
50
|
-
1. Fork it ( https://github.com/
|
50
|
+
1. Fork it ( https://github.com/JulianNicholls/gosu_enhanced/fork )
|
51
51
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
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`)
|
data/gosu_enhanced.gemspec
CHANGED
@@ -22,7 +22,7 @@ of text in a rectangle size.}
|
|
22
22
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.add_runtime_dependency "gosu", "~> 0.
|
25
|
+
spec.add_runtime_dependency "gosu", "~> 0.9"
|
26
26
|
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.6"
|
28
28
|
spec.add_development_dependency "rake", "~> 0.9"
|
@@ -1,7 +1,16 @@
|
|
1
|
+
# Gosu is the module that the Gosu library uses. It is re-opened here to allow
|
2
|
+
# access to the Window and Font classes.
|
1
3
|
module Gosu
|
2
4
|
# Add a draw_rectangle() to Window which simplifies drawing a simple rectangle
|
3
5
|
# in one colour
|
4
6
|
class Window
|
7
|
+
# Simplify drawing a rectangle in a single colour.
|
8
|
+
#
|
9
|
+
# @param point [Point] Top left corner
|
10
|
+
# @param size [Size] Width and Height
|
11
|
+
# @param z_index [Fixnum] Z-order
|
12
|
+
# @param colour [Gosu::Color] Colour of rectangle
|
13
|
+
|
5
14
|
def draw_rectangle( point, size, z_index, colour )
|
6
15
|
left, top = point.x, point.y
|
7
16
|
width, height = size.width, size.height
|
@@ -17,14 +26,28 @@ module Gosu
|
|
17
26
|
end
|
18
27
|
|
19
28
|
# Add a measure to return both width and height for a text and a way
|
20
|
-
# to centre a text in a rectangle
|
29
|
+
# to centre a text in a rectangle.
|
21
30
|
class Font
|
22
31
|
include GosuEnhanced
|
23
32
|
|
33
|
+
# Return the width and height of a given string
|
34
|
+
#
|
35
|
+
# @param text [String] String to measure
|
36
|
+
#
|
37
|
+
# @return [Size] The height and width of the string.
|
38
|
+
|
24
39
|
def measure( text )
|
25
40
|
Size.new( text_width( text, 1 ), height )
|
26
41
|
end
|
27
42
|
|
43
|
+
# Return the co-ordnates needed to place a given string in the centre of an
|
44
|
+
# area, both vertically and horizontally
|
45
|
+
#
|
46
|
+
# @param text [String] String to centre
|
47
|
+
# @param rect [Size] Rectangular area size
|
48
|
+
#
|
49
|
+
# @return [Point] The point to write the string, expressed as an offset from the top-left corner of the rectangle.
|
50
|
+
|
28
51
|
def centred_in( text, rect )
|
29
52
|
size = measure( text )
|
30
53
|
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Nicholls
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gosu
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.9'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.9'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
requirements: []
|
146
146
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.
|
147
|
+
rubygems_version: 2.4.7
|
148
148
|
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: Enhanced versions of some Gosu classes.
|
@@ -154,4 +154,3 @@ test_files:
|
|
154
154
|
- spec/region_spec.rb
|
155
155
|
- spec/size_spec.rb
|
156
156
|
- spec/spec_helper.rb
|
157
|
-
has_rdoc:
|