gosu_enhanced 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -5
- data/lib/gosu_enhanced/enhanced.rb +15 -15
- data/lib/gosu_enhanced/point.rb +2 -2
- data/lib/gosu_enhanced/size.rb +4 -4
- data/lib/gosu_enhanced/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86a01316020552b01f0150a2bb8959dbdbdeaa21
|
4
|
+
data.tar.gz: 275b3afa6758e7a4c5183ebb39ecfe66714dfab3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f4abcb1c2bcaffac031df9bdd7fc1f167de6b0d96204d7657eb558c79221c8ca470d79eb3d542a7371e8f188a3cd45bf2877eac468cbc049fa42bbeba95e469
|
7
|
+
data.tar.gz: 5bff949502d28ffe791207ed7b363efdfe98b7d8c75f5a25646d7b4d8a641434bdbe3829d4483502c05f79ae86633d032ec0aa369a556edf505cc5d31cbc3b2c
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# gosu_enhanced V0.
|
1
|
+
# gosu_enhanced V0.4.0
|
2
2
|
|
3
|
-
Some added classes for using Gosu. Updated to use Gosu 0.
|
3
|
+
Some added classes for using Gosu. Updated to use Gosu 0.10.x.
|
4
4
|
|
5
5
|
## Point
|
6
6
|
|
@@ -20,12 +20,15 @@ constituents.
|
|
20
20
|
## Gosu::Window
|
21
21
|
|
22
22
|
Added #draw_rectangle which draws a simple rectangle specified with a Point
|
23
|
-
and Size in one colour
|
23
|
+
and Size in one colour and #draw_simple_line which draws a line in a single
|
24
|
+
colour.
|
25
|
+
|
26
|
+
### N.B. There are serious warnings against using #draw_line for anything other than debugging purposes
|
24
27
|
|
25
28
|
## Gosu::Font
|
26
29
|
|
27
|
-
Added #measure and #centred_in which measure a piece of text
|
28
|
-
a given Size respectively.
|
30
|
+
Added #measure and #centred_in / #centered_in which measure a piece of text
|
31
|
+
and centre it in a given Size respectively.
|
29
32
|
|
30
33
|
## Installation
|
31
34
|
|
@@ -6,10 +6,10 @@ module Gosu
|
|
6
6
|
class Window
|
7
7
|
# Simplify drawing a rectangle in a single colour.
|
8
8
|
#
|
9
|
-
# +point+ [Point] Top left corner
|
10
|
-
# +size+ [Size] Width and Height
|
11
|
-
# +z_index+ [Fixnum] Z-order
|
12
|
-
# +colour+ [Gosu::Color] Colour of rectangle
|
9
|
+
# * +point+ [Point] Top left corner
|
10
|
+
# * +size+ [Size] Width and Height
|
11
|
+
# * +z_index+ [Fixnum] Z-order
|
12
|
+
# * +colour+ [Gosu::Color] Colour of rectangle
|
13
13
|
|
14
14
|
def draw_rectangle(point, size, z_index, colour)
|
15
15
|
left = point.x
|
@@ -30,10 +30,10 @@ module Gosu
|
|
30
30
|
# There are dire warnings in the Gosu documentation for draw_line() which
|
31
31
|
# suggest that line drawing should only be done for debugging purposes.
|
32
32
|
#
|
33
|
-
# +p1+ [Point] Beginning point
|
34
|
-
# +p2+ [Point] Endpoint
|
35
|
-
# +z_index+ [Fixnum] Z-order
|
36
|
-
# +colour+ [Gosu::Color] Colour of line
|
33
|
+
# * +p1+ [Point] Beginning point
|
34
|
+
# * +p2+ [Point] Endpoint
|
35
|
+
# * +z_index+ [Fixnum] Z-order
|
36
|
+
# * +colour+ [Gosu::Color] Colour of line
|
37
37
|
|
38
38
|
def draw_simple_line(p1, p2, z_index, colour)
|
39
39
|
draw_line(p1.x, p1.y, colour, p2.x, p2.y, colour, z_index)
|
@@ -47,9 +47,9 @@ module Gosu
|
|
47
47
|
|
48
48
|
# Return the width and height of a given string
|
49
49
|
#
|
50
|
-
# +text+ String to measure
|
50
|
+
# * +text+ String to measure
|
51
51
|
#
|
52
|
-
# return [Size] The height and width of the string.
|
52
|
+
# return:: [Size] The height and width of the string.
|
53
53
|
|
54
54
|
def measure(text)
|
55
55
|
Size.new(text_width(text, 1), height)
|
@@ -58,11 +58,11 @@ module Gosu
|
|
58
58
|
# Return the co-ordnates needed to place a given string in the centre of an
|
59
59
|
# area, both vertically and horizontally.
|
60
60
|
#
|
61
|
-
# return
|
61
|
+
# return:: [Point] The point to write the string, expressed as an offset
|
62
62
|
# from the top-left corner of the rectangle.
|
63
63
|
#
|
64
|
-
# +text+ [String] String to centre
|
65
|
-
# +rect+ [Size] Rectangular area size
|
64
|
+
# * +text+ [String] String to centre
|
65
|
+
# * +rect+ [Size] Rectangular area size
|
66
66
|
|
67
67
|
def centred_in(text, rect)
|
68
68
|
size = measure(text)
|
@@ -75,8 +75,8 @@ module Gosu
|
|
75
75
|
|
76
76
|
# Synonym for centred_in, allowing for centre to be spelled center.
|
77
77
|
#
|
78
|
-
# +text+ [String] String to centre
|
79
|
-
# +rect+ [Size] Rectangular area size
|
78
|
+
# * +text+ [String] String to centre
|
79
|
+
# * +rect+ [Size] Rectangular area size
|
80
80
|
|
81
81
|
alias_method :centered_in, :centred_in
|
82
82
|
end
|
data/lib/gosu_enhanced/point.rb
CHANGED
data/lib/gosu_enhanced/size.rb
CHANGED
@@ -10,8 +10,8 @@ module GosuEnhanced
|
|
10
10
|
# The values are checked on inflation / deflation.
|
11
11
|
|
12
12
|
# Initialise a size
|
13
|
-
# +wid+ Width
|
14
|
-
# +ht+ Height
|
13
|
+
# * +wid+ Width
|
14
|
+
# * +ht+ Height
|
15
15
|
|
16
16
|
def initialize(wid, ht)
|
17
17
|
@width = wid
|
@@ -103,8 +103,8 @@ module GosuEnhanced
|
|
103
103
|
|
104
104
|
# Utility function to construct a size
|
105
105
|
#
|
106
|
-
# +x+ Width
|
107
|
-
# +y+ Height
|
106
|
+
# * +x+ Width
|
107
|
+
# * +y+ Height
|
108
108
|
|
109
109
|
def Size(x, y)
|
110
110
|
Size.new(x, y)
|