minigl 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -6
- data/lib/minigl/forms.rb +8 -1
- data/lib/minigl/game_object.rb +58 -11
- data/lib/minigl/global.rb +18 -0
- data/lib/minigl/map.rb +6 -0
- data/lib/minigl/movement.rb +8 -0
- data/lib/minigl/text.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 450b8d40d9d7a949621ae94fac7cdf702742e80a
|
4
|
+
data.tar.gz: e70c4b21bcf68daed5a06704dfbbb2cc16234cfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 159a32f1c0ea9688e10d8599984b6d0e65ed4579e49c94b80a02bf77c065d7bceca0127be3a011acf174c6d5cd1067f51996c60e17d9a36ed56dece1e340aa7b
|
7
|
+
data.tar.gz: c9bc082ef4e2ce42b531d665ad0be11e65897830fdf4367e6262c2aba790f23bfba857ff4cf01a7d776313a264293b43c9c07851ce6407b73005b1d129d3d3bc
|
data/README.md
CHANGED
@@ -18,11 +18,12 @@ Please note:
|
|
18
18
|
* The test package is not complete! Most of the functionality
|
19
19
|
provided by the gem is difficult to test automatically, but you can check out
|
20
20
|
this [working game example](https://github.com/victords/aventura-do-saber).
|
21
|
-
* The
|
22
|
-
construction
|
21
|
+
* The RDoc documentation is now available.
|
22
|
+
* An auxiliary, tutorial-like documentation is under construction
|
23
|
+
[here](https://github.com/victords/minigl/wiki).
|
23
24
|
|
24
|
-
**Version 1.2.
|
25
|
+
**Version 1.2.7**
|
25
26
|
|
26
|
-
*
|
27
|
-
*
|
28
|
-
*
|
27
|
+
* Completed and added documentation for the `Effect` class.
|
28
|
+
* Slight adjusts in the documentation.
|
29
|
+
* Slight adjust in the implementation of `Button`.
|
data/lib/minigl/forms.rb
CHANGED
@@ -4,6 +4,7 @@ module AGL
|
|
4
4
|
# This class represents a button.
|
5
5
|
class Button
|
6
6
|
# Creates a button.
|
7
|
+
#
|
7
8
|
# Parameters:
|
8
9
|
# [x] The x-coordinate where the button will be drawn in the screen.
|
9
10
|
# [y] The y-coordinate where the button will be drawn in the screen.
|
@@ -52,7 +53,7 @@ module AGL
|
|
52
53
|
end
|
53
54
|
@text_color = text_color
|
54
55
|
@center = center
|
55
|
-
@action =
|
56
|
+
@action = action
|
56
57
|
|
57
58
|
@state = :up
|
58
59
|
@img_index = 0
|
@@ -104,6 +105,7 @@ module AGL
|
|
104
105
|
end
|
105
106
|
|
106
107
|
# Sets the position of the button in the screen.
|
108
|
+
#
|
107
109
|
# Parameters:
|
108
110
|
# [x] The new x-coordinate for the button.
|
109
111
|
# [y] The new y-coordinate for the button.
|
@@ -121,6 +123,7 @@ module AGL
|
|
121
123
|
end
|
122
124
|
|
123
125
|
# Draws the button in the screen.
|
126
|
+
#
|
124
127
|
# Parameters:
|
125
128
|
# [alpha] The opacity with which the button will be drawn. Allowed values
|
126
129
|
# vary between 0 (fully transparent) and 255 (fully opaque).
|
@@ -144,6 +147,7 @@ module AGL
|
|
144
147
|
attr_reader :text
|
145
148
|
|
146
149
|
# Creates a new text field.
|
150
|
+
#
|
147
151
|
# Parameters:
|
148
152
|
# [x] The x-coordinate where the text field will be drawn in the screen.
|
149
153
|
# [y] The y-coordinate where the text field will be drawn in the screen.
|
@@ -379,6 +383,7 @@ module AGL
|
|
379
383
|
end
|
380
384
|
|
381
385
|
# Sets the text of the text field to the specified value.
|
386
|
+
#
|
382
387
|
# Parameters:
|
383
388
|
# [value] The new text to be set. If it's longer than the +max_length+
|
384
389
|
# parameter used in the constructor, it will be truncated to
|
@@ -420,6 +425,7 @@ module AGL
|
|
420
425
|
end
|
421
426
|
|
422
427
|
# Sets the position of the text field in the screen.
|
428
|
+
#
|
423
429
|
# Parameters:
|
424
430
|
# [x] The new x-coordinate for the text field.
|
425
431
|
# [y] The new y-coordinate for the text field.
|
@@ -435,6 +441,7 @@ module AGL
|
|
435
441
|
end
|
436
442
|
|
437
443
|
# Draws the text field in the screen.
|
444
|
+
#
|
438
445
|
# Parameters:
|
439
446
|
# [alpha] The opacity with which the text field will be drawn. Allowed
|
440
447
|
# values vary between 0 (fully transparent) and 255 (fully opaque).
|
data/lib/minigl/game_object.rb
CHANGED
@@ -13,9 +13,12 @@ module AGL
|
|
13
13
|
attr_accessor :y
|
14
14
|
|
15
15
|
# Creates a new sprite.
|
16
|
+
#
|
16
17
|
# Parameters:
|
17
|
-
# [x] The x-coordinate where the sprite will be
|
18
|
-
#
|
18
|
+
# [x] The x-coordinate in the screen (or map) where the sprite will be
|
19
|
+
# drawn. This can be modified later via the +x+ attribute.
|
20
|
+
# [y] The y-coordinate in the screen (or map) where the sprite will be
|
21
|
+
# drawn. This can be modified later via the +y+ attribute.
|
19
22
|
# [img] The path to a PNG image or spritesheet, following the MiniGL
|
20
23
|
# convention: images must be inside a 'data/img' directory, relative
|
21
24
|
# to the code file, and you must only provide the file name, without
|
@@ -44,6 +47,7 @@ module AGL
|
|
44
47
|
|
45
48
|
# Performs time checking to update the image index according to the
|
46
49
|
# sequence of indices and the interval.
|
50
|
+
#
|
47
51
|
# Parameters:
|
48
52
|
# [indices] The sequence of image indices used in the animation. The
|
49
53
|
# indices are determined from left to right, and from top to
|
@@ -63,6 +67,7 @@ module AGL
|
|
63
67
|
end
|
64
68
|
|
65
69
|
# Draws the sprite in the screen
|
70
|
+
#
|
66
71
|
# Parameters:
|
67
72
|
# [map] A Map object, relative to which the sprite will be drawn (the x
|
68
73
|
# and y coordinates of the sprite will be changed according to the
|
@@ -101,9 +106,12 @@ module AGL
|
|
101
106
|
include Movement
|
102
107
|
|
103
108
|
# Creates a new game object.
|
109
|
+
#
|
104
110
|
# Parameters:
|
105
|
-
# [x] The x-coordinate of the object's bounding box.
|
106
|
-
#
|
111
|
+
# [x] The x-coordinate of the object's bounding box. This can be modified
|
112
|
+
# later via the +x+ attribute.
|
113
|
+
# [y] The y-coordinate of the object's bounding box. This can be modified
|
114
|
+
# later via the +y+ attribute.
|
107
115
|
# [w] The width of the object's bounding box.
|
108
116
|
# [h] The height of the object's bounding box.
|
109
117
|
# [img] The image or spritesheet for the object.
|
@@ -133,6 +141,7 @@ module AGL
|
|
133
141
|
|
134
142
|
# Resets the animation timer and immediately changes the image index to
|
135
143
|
# the specified value.
|
144
|
+
#
|
136
145
|
# Parameters:
|
137
146
|
# [index] The image index to be set.
|
138
147
|
def set_animation index
|
@@ -147,6 +156,7 @@ module AGL
|
|
147
156
|
end
|
148
157
|
|
149
158
|
# Draws the game object in the screen.
|
159
|
+
#
|
150
160
|
# Parameters:
|
151
161
|
# [map] A Map object, relative to which the object will be drawn (the x
|
152
162
|
# and y coordinates of the image will be changed according to the
|
@@ -180,11 +190,38 @@ module AGL
|
|
180
190
|
end
|
181
191
|
end
|
182
192
|
|
183
|
-
#
|
193
|
+
# Represents a visual effect, i.e., a graphic - usually animated - that shows
|
194
|
+
# up in the screen, lasts for a given time and "disappears". You should
|
195
|
+
# explicitly dispose of references to effects whose attribute +dead+ is set
|
196
|
+
# to +true+.
|
184
197
|
class Effect < Sprite
|
185
|
-
|
198
|
+
# This is +true+ when the effect's lifetime has already passed.
|
199
|
+
attr_reader :dead
|
200
|
+
|
201
|
+
# Creates a new Effect.
|
202
|
+
#
|
203
|
+
# Parameters:
|
204
|
+
# [x] The x-coordinate in the screen (or map) where the effect will be
|
205
|
+
# drawn. This can be modified later via the +x+ attribute.
|
206
|
+
# [y] The y-coordinate in the screen (or map) where the effect will be
|
207
|
+
# drawn. This can be modified later via the +y+ attribute.
|
208
|
+
# [img] The image or spritesheet to use for this effect (see Sprite for
|
209
|
+
# details on spritesheets).
|
210
|
+
# [sprite_cols] (see Sprite)
|
211
|
+
# [sprite_rows] (see Sprite)
|
212
|
+
# [interval] The interval between steps of the animation, in updates.
|
213
|
+
# [indices] The indices to use in the animation. See Sprite#animate for
|
214
|
+
# details. If +nil+, it will be the sequence from 0 to
|
215
|
+
# <code>sprite_cols * sprite_rows - 1</code>.
|
216
|
+
# [lifetime] The lifetime of the effect, in updates. After +update+ is
|
217
|
+
# called this number of times, the effect will no longer
|
218
|
+
# be visible, even when +draw+ is called, and the +dead+ flag
|
219
|
+
# will be set to +true+, so you get to know when to dispose
|
220
|
+
# of the Effect object. If +nil+, it will be set to
|
221
|
+
# <code>@indices.length * interval</code>, i.e., the exact time
|
222
|
+
# needed for one animation cycle to complete.
|
223
|
+
def initialize x, y, img, sprite_cols = nil, sprite_rows = nil, interval = 10, indices = nil, lifetime = nil
|
186
224
|
super x, y, img, sprite_cols, sprite_rows
|
187
|
-
@life_time = life_time
|
188
225
|
@timer = 0
|
189
226
|
if indices
|
190
227
|
@indices = indices
|
@@ -192,14 +229,24 @@ module AGL
|
|
192
229
|
@indices = *(0..(@img.length - 1))
|
193
230
|
end
|
194
231
|
@interval = interval
|
232
|
+
if lifetime
|
233
|
+
@lifetime = lifetime
|
234
|
+
else
|
235
|
+
@lifetime = @indices.length * interval
|
236
|
+
end
|
195
237
|
end
|
196
238
|
|
239
|
+
# Updates the effect, animating and counting its remaining lifetime.
|
197
240
|
def update
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
@dead = true
|
241
|
+
unless @dead
|
242
|
+
animate @indices, @interval
|
243
|
+
@timer += 1
|
244
|
+
@dead = true if @timer == @lifetime
|
202
245
|
end
|
203
246
|
end
|
247
|
+
|
248
|
+
def draw map = nil, scale_x = 1, scale_y = 1, alpha = 0xff, color = 0xffffff, angle = nil
|
249
|
+
super unless @dead
|
250
|
+
end
|
204
251
|
end
|
205
252
|
end
|
data/lib/minigl/global.rb
CHANGED
@@ -22,6 +22,7 @@ module AGL
|
|
22
22
|
attr_accessor :h
|
23
23
|
|
24
24
|
# Creates a new rectangle.
|
25
|
+
#
|
25
26
|
# Parameters:
|
26
27
|
# [x] The x-coordinate of the rectangle.
|
27
28
|
# [y] The y-coordinate of the rectangle.
|
@@ -32,6 +33,7 @@ module AGL
|
|
32
33
|
end
|
33
34
|
|
34
35
|
# Returns whether this rectangle intersects another.
|
36
|
+
#
|
35
37
|
# Parameters:
|
36
38
|
# [r] The rectangle to check intersection with.
|
37
39
|
def intersects r
|
@@ -44,6 +46,7 @@ module AGL
|
|
44
46
|
class Game
|
45
47
|
# Initializes a MiniGL game. This method must be called before any feature
|
46
48
|
# provided by the library can be used.
|
49
|
+
#
|
47
50
|
# Parameters:
|
48
51
|
# [window] An instance of a class which inherits from
|
49
52
|
# <code>Gosu::Window</code>. This will be the game window, used
|
@@ -154,6 +157,7 @@ module AGL
|
|
154
157
|
|
155
158
|
# Returns whether the given key is down in the current frame and was not
|
156
159
|
# down in the frame before.
|
160
|
+
#
|
157
161
|
# Parameters:
|
158
162
|
# [key] Code of the key to be checked. The available codes are <code>
|
159
163
|
# Gosu::KbUp, Gosu::KbDown, Gosu::KbReturn, Gosu::KbEscape,
|
@@ -177,6 +181,7 @@ module AGL
|
|
177
181
|
end
|
178
182
|
|
179
183
|
# Returns whether the given key is down in the current frame.
|
184
|
+
#
|
180
185
|
# Parameters:
|
181
186
|
# [key] Code of the key to be checked. See +key_pressed?+ for details.
|
182
187
|
def self.key_down? key
|
@@ -185,6 +190,7 @@ module AGL
|
|
185
190
|
|
186
191
|
# Returns whether the given key is not down in the current frame but was
|
187
192
|
# down in the frame before.
|
193
|
+
#
|
188
194
|
# Parameters:
|
189
195
|
# [key] Code of the key to be checked. See +key_pressed?+ for details.
|
190
196
|
def self.key_released? key
|
@@ -193,6 +199,7 @@ module AGL
|
|
193
199
|
|
194
200
|
# Returns whether the given key is being held down. See
|
195
201
|
# <code>Game.initialize</code> for details.
|
202
|
+
#
|
196
203
|
# Parameters:
|
197
204
|
# [key] Code of the key to be checked. See +key_pressed?+ for details.
|
198
205
|
def self.key_held? key
|
@@ -246,6 +253,7 @@ module AGL
|
|
246
253
|
|
247
254
|
# Returns whether the given button is down in the current frame and was
|
248
255
|
# not down in the frame before.
|
256
|
+
#
|
249
257
|
# Parameters:
|
250
258
|
# [btn] Button to be checked. Valid values are +:left+, +:middle+ and
|
251
259
|
# +:right+
|
@@ -254,6 +262,7 @@ module AGL
|
|
254
262
|
end
|
255
263
|
|
256
264
|
# Returns whether the given button is down in the current frame.
|
265
|
+
#
|
257
266
|
# Parameters:
|
258
267
|
# [btn] Button to be checked. Valid values are +:left+, +:middle+ and
|
259
268
|
# +:right+
|
@@ -263,6 +272,7 @@ module AGL
|
|
263
272
|
|
264
273
|
# Returns whether the given button is not down in the current frame, but
|
265
274
|
# was down in the frame before.
|
275
|
+
#
|
266
276
|
# Parameters:
|
267
277
|
# [btn] Button to be checked. Valid values are +:left+, +:middle+ and
|
268
278
|
# +:right+
|
@@ -271,6 +281,7 @@ module AGL
|
|
271
281
|
end
|
272
282
|
|
273
283
|
# Returns whether the given button has just been double clicked.
|
284
|
+
#
|
274
285
|
# Parameters:
|
275
286
|
# [btn] Button to be checked. Valid values are +:left+, +:middle+ and
|
276
287
|
# +:right+
|
@@ -279,6 +290,7 @@ module AGL
|
|
279
290
|
end
|
280
291
|
|
281
292
|
# Returns whether the mouse cursor is currently inside the given area.
|
293
|
+
#
|
282
294
|
# Parameters:
|
283
295
|
# [x] The x-coordinate of the top left corner of the area.
|
284
296
|
# [y] The y-coordinate of the top left corner of the area.
|
@@ -317,6 +329,7 @@ module AGL
|
|
317
329
|
end
|
318
330
|
|
319
331
|
# Returns a <code>Gosu::Image</code> object.
|
332
|
+
#
|
320
333
|
# Parameters:
|
321
334
|
# [id] A string or symbol representing the path to the image. If the file
|
322
335
|
# is inside 'data/img', only the file name is needed. If it's inside
|
@@ -344,6 +357,7 @@ module AGL
|
|
344
357
|
# a spritesheet. The image with index 0 will be the top left sprite, and
|
345
358
|
# the following indices raise first from left to right and then from top
|
346
359
|
# to bottom.
|
360
|
+
#
|
347
361
|
# Parameters:
|
348
362
|
# [id] A string or symbol representing the path to the image. See +img+
|
349
363
|
# for details.
|
@@ -366,6 +380,7 @@ module AGL
|
|
366
380
|
# a tileset. Works the same as +imgs+, except you must provide the tile
|
367
381
|
# size instead of the number of columns and rows, and that the images will
|
368
382
|
# be loaded as tileable.
|
383
|
+
#
|
369
384
|
# Parameters:
|
370
385
|
# [id] A string or symbol representing the path to the image. It must be
|
371
386
|
# specified the same way as in +img+, but the base directory is
|
@@ -387,6 +402,7 @@ module AGL
|
|
387
402
|
|
388
403
|
# Returns a <code>Gosu::Sample</code> object. This should be used for
|
389
404
|
# simple and short sound effects.
|
405
|
+
#
|
390
406
|
# Parameters:
|
391
407
|
# [id] A string or symbol representing the path to the sound. It must be
|
392
408
|
# specified the same way as in +img+, but the base directory is
|
@@ -406,6 +422,7 @@ module AGL
|
|
406
422
|
|
407
423
|
# Returns a <code>Gosu::Song</code> object. This should be used for the
|
408
424
|
# background musics of your game.
|
425
|
+
#
|
409
426
|
# Parameters:
|
410
427
|
# [id] A string or symbol representing the path to the song. It must be
|
411
428
|
# specified the same way as in +img+, but the base directory is
|
@@ -426,6 +443,7 @@ module AGL
|
|
426
443
|
# Returns a <code>Gosu::Font</code> object. Fonts are needed to draw text
|
427
444
|
# and used by MiniGL elements like buttons, text fields and TextHelper
|
428
445
|
# objects.
|
446
|
+
#
|
429
447
|
# Parameters:
|
430
448
|
# [id] A string or symbol representing the path to the song. It must be
|
431
449
|
# specified the same way as in +img+, but the base directory is
|
data/lib/minigl/map.rb
CHANGED
@@ -16,6 +16,7 @@ module AGL
|
|
16
16
|
attr_reader :cam
|
17
17
|
|
18
18
|
# Creates a new map.
|
19
|
+
#
|
19
20
|
# Parameters:
|
20
21
|
# [t_w] The width of the tiles.
|
21
22
|
# [t_h] The height of the tiles.
|
@@ -44,6 +45,7 @@ module AGL
|
|
44
45
|
|
45
46
|
# Returns the position in the screen corresponding to the given tile
|
46
47
|
# indices.
|
48
|
+
#
|
47
49
|
# Parameters:
|
48
50
|
# [map_x] The index of the tile in the horizontal direction. It must be in
|
49
51
|
# the interval <code>0..t_x_count</code>.
|
@@ -56,6 +58,7 @@ module AGL
|
|
56
58
|
# Returns the tile in the map that corresponds to the given position in
|
57
59
|
# the screen, as a Vector, where x is the horizontal index and y the
|
58
60
|
# vertical index.
|
61
|
+
#
|
59
62
|
# Parameters:
|
60
63
|
# [scr_x] The x-coordinate in the screen.
|
61
64
|
# [scr_y] The y-coordinate in the screen.
|
@@ -64,6 +67,7 @@ module AGL
|
|
64
67
|
end
|
65
68
|
|
66
69
|
# Verifies whether a tile is inside the map.
|
70
|
+
#
|
67
71
|
# Parameters:
|
68
72
|
# [v] A Vector representing the tile, with x as the horizontal index and
|
69
73
|
# y as the vertical index.
|
@@ -73,6 +77,7 @@ module AGL
|
|
73
77
|
|
74
78
|
# Sets the top left corner of the viewport to the given position of the
|
75
79
|
# map. Note that this is not the position in the screen.
|
80
|
+
#
|
76
81
|
# Parameters:
|
77
82
|
# [cam_x] The x-coordinate inside the map, in pixels (not a tile index).
|
78
83
|
# [cam_y] The y-coordinate inside the map, in pixels (not a tile index).
|
@@ -83,6 +88,7 @@ module AGL
|
|
83
88
|
end
|
84
89
|
|
85
90
|
# Moves the viewport by the given amount of pixels.
|
91
|
+
#
|
86
92
|
# Parameters:
|
87
93
|
# [x] The amount of pixels to move horizontally. Negative values will
|
88
94
|
# cause the camera to move to the left.
|
data/lib/minigl/movement.rb
CHANGED
@@ -22,6 +22,7 @@ module AGL
|
|
22
22
|
attr_reader :passable
|
23
23
|
|
24
24
|
# Creates a new block.
|
25
|
+
#
|
25
26
|
# Parameters:
|
26
27
|
# [x] The x-coordinate of the top left corner of the bounding box.
|
27
28
|
# [y] The y-coordinate of the top left corner of the bounding box.
|
@@ -48,6 +49,7 @@ module AGL
|
|
48
49
|
# to the +ramps+ array parameter of the +move+ method.
|
49
50
|
class Ramp
|
50
51
|
# Creates a new ramp.
|
52
|
+
#
|
51
53
|
# Parameters:
|
52
54
|
# [x] The x-coordinate of the top left corner of a rectangle that
|
53
55
|
# completely (and precisely) encloses the ramp (thought of as a right
|
@@ -71,6 +73,7 @@ module AGL
|
|
71
73
|
end
|
72
74
|
|
73
75
|
# Checks if an object is in contact with this ramp (standing over it).
|
76
|
+
#
|
74
77
|
# Parameters:
|
75
78
|
# [obj] The object to check contact with. It must have the +x+, +y+, +w+
|
76
79
|
# and +h+ accessible attributes determining its bounding box.
|
@@ -80,6 +83,7 @@ module AGL
|
|
80
83
|
|
81
84
|
# Checks if an object is intersecting this ramp (inside the corresponding
|
82
85
|
# right triangle and at the floor level or above).
|
86
|
+
#
|
83
87
|
# Parameters:
|
84
88
|
# [obj] The object to check intersection with. It must have the +x+, +y+,
|
85
89
|
# +w+ and +h+ accessible attributes determining its bounding box.
|
@@ -176,6 +180,7 @@ module AGL
|
|
176
180
|
|
177
181
|
# Moves this object, based on the forces being applied to it, and
|
178
182
|
# performing collision checking.
|
183
|
+
#
|
179
184
|
# Parameters:
|
180
185
|
# [forces] A Vector where x is the horizontal component of the resulting
|
181
186
|
# force and y is the vertical component.
|
@@ -285,6 +290,7 @@ module AGL
|
|
285
290
|
|
286
291
|
# Moves this object as an elevator (i.e., potentially carrying other
|
287
292
|
# objects) towards a given point.
|
293
|
+
#
|
288
294
|
# Parameters:
|
289
295
|
# [aim] A Vector specifying where the object will move to.
|
290
296
|
# [speed] The constant speed at which the object will move. This must be
|
@@ -328,6 +334,7 @@ module AGL
|
|
328
334
|
|
329
335
|
# Moves this object, without performing any collision checking, towards
|
330
336
|
# the specified point.
|
337
|
+
#
|
331
338
|
# Parameters:
|
332
339
|
# [aim] A Vector specifying where the object will move to.
|
333
340
|
# [speed] The constant speed at which the object will move. This must be
|
@@ -357,6 +364,7 @@ module AGL
|
|
357
364
|
# method must be called repeatedly, and it returns the value that must be
|
358
365
|
# provided to +cur_point+ after the first call). If obstacles are
|
359
366
|
# provided, it will behave as an elevator (as in +move_carrying+).
|
367
|
+
#
|
360
368
|
# Parameters:
|
361
369
|
# [points] An array of Vectors representing the path that the object will
|
362
370
|
# perform.
|
data/lib/minigl/text.rb
CHANGED
@@ -3,6 +3,7 @@ module AGL
|
|
3
3
|
# text, with control over the text alignment and coloring.
|
4
4
|
class TextHelper
|
5
5
|
# Creates a TextHelper.
|
6
|
+
#
|
6
7
|
# Parameters:
|
7
8
|
# [font] A <code>Gosu::Font</code> that will be used to draw the text.
|
8
9
|
# [line_spacing] When drawing multiple lines, the distance, in pixels,
|
@@ -13,6 +14,7 @@ module AGL
|
|
13
14
|
end
|
14
15
|
|
15
16
|
# Draws a single line of text.
|
17
|
+
#
|
16
18
|
# Parameters:
|
17
19
|
# [text] The text to be drawn. No line breaks are allowed.
|
18
20
|
# [x] The horizontal reference for drawing the text. If +mode+ is +:left+,
|
@@ -41,6 +43,7 @@ module AGL
|
|
41
43
|
|
42
44
|
# Draws text, breaking lines when needed and when explicitly caused by the
|
43
45
|
# "\n" character.
|
46
|
+
#
|
44
47
|
# Parameters:
|
45
48
|
# [text] The text to be drawn. Line breaks are allowed.
|
46
49
|
# [x] The horizontal reference for drawing the text. Works like in
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minigl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor David Santos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gosu
|