minigl 2.2.8 → 2.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/minigl/movement.rb +37 -32
- data/lib/minigl/text.rb +157 -36
- metadata +22 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8864115892b3cc8a853b6bea09aaa768f0750f40e1f39f247177db200c52dcc
|
4
|
+
data.tar.gz: 29bb72b4cf14e1e0b53850b46b5eeabc9de348854af4947ee803310e9fd7ff42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09d5fdd7c6d7bfed2ef5a026b8b1754ca24c9cd1116e8dc4c3e2ef113e8253f15831cb9a8d29d5ccd6a71e8a002b46ee27ccffe42f9ccca15c2cdfe00646862b'
|
7
|
+
data.tar.gz: 5ea1ff3572568e194a6ee4dae01b9ed9df11bedfa31738457ca449401708b0490a7f73e1a3f3a9f82eced6030f4ec35418e2ef48f3fd30b542466879d3db5d0d
|
data/README.md
CHANGED
@@ -29,9 +29,9 @@ After installing the Gosu dependencies, you can just `gem install minigl`.
|
|
29
29
|
* The [wiki](https://github.com/victords/minigl/wiki) is a work in progress with tutorials and examples.
|
30
30
|
* Test package and examples aren't complete!
|
31
31
|
|
32
|
-
## Version 2.
|
32
|
+
## Version 2.3.3
|
33
33
|
|
34
|
-
*
|
34
|
+
* Fix bug in `Movement#cycle`.
|
35
35
|
|
36
36
|
## Contributing
|
37
37
|
|
data/lib/minigl/movement.rb
CHANGED
@@ -360,17 +360,19 @@ module MiniGL
|
|
360
360
|
# [speed] If the first argument is a forces vector, then this should be
|
361
361
|
# +nil+. If it is a point, then this is the constant speed at which
|
362
362
|
# the object will move (provided as a scalar, not a vector).
|
363
|
-
# [
|
364
|
-
#
|
365
|
-
#
|
366
|
-
#
|
367
|
-
#
|
368
|
-
#
|
369
|
-
#
|
370
|
-
#
|
371
|
-
#
|
372
|
-
#
|
373
|
-
|
363
|
+
# [carried_objs] An array of objects that can potentially be carried by
|
364
|
+
# this object while it moves. The objects must respond to
|
365
|
+
# +x+, +y+, +w+ and +h+.
|
366
|
+
# [obstacles] Obstacles that should be considered for collision checking
|
367
|
+
# with the carried objects, if they include the +Movement+
|
368
|
+
# module, and with this object too, if moving with forces and
|
369
|
+
# the +ignore_collision+ flag is false.
|
370
|
+
# [ramps] Ramps that should be considered for the carried objects, if they
|
371
|
+
# include the +Movement+ module, and for this object too, if moving
|
372
|
+
# with forces and +ignore_collision+ is false.
|
373
|
+
# [ignore_collision] Set to true to make this object ignore collision even
|
374
|
+
# when moving with forces.
|
375
|
+
def move_carrying(arg, speed, carried_objs, obstacles, ramps, ignore_collision = false)
|
374
376
|
if speed
|
375
377
|
x_d = arg.x - @x; y_d = arg.y - @y
|
376
378
|
distance = Math.sqrt(x_d**2 + y_d**2)
|
@@ -382,18 +384,14 @@ module MiniGL
|
|
382
384
|
|
383
385
|
@speed.x = 1.0 * x_d * speed / distance
|
384
386
|
@speed.y = 1.0 * y_d * speed / distance
|
387
|
+
x_aim = @x + @speed.x; y_aim = @y + @speed.y
|
385
388
|
else
|
386
|
-
|
387
|
-
|
388
|
-
@speed.x = 0 if @speed.x.abs < G.min_speed.x
|
389
|
-
@speed.y = 0 if @speed.y.abs < G.min_speed.y
|
390
|
-
@speed.x = (@speed.x <=> 0) * @max_speed.x if @speed.x.abs > @max_speed.x
|
391
|
-
@speed.y = (@speed.y <=> 0) * @max_speed.y if @speed.y.abs > @max_speed.y
|
389
|
+
x_aim = @x + @speed.x + G.gravity.x + arg.x
|
390
|
+
y_aim = @y + @speed.y + G.gravity.y + arg.y
|
392
391
|
end
|
393
392
|
|
394
|
-
x_aim = @x + @speed.x; y_aim = @y + @speed.y
|
395
393
|
passengers = []
|
396
|
-
|
394
|
+
carried_objs.each do |o|
|
397
395
|
if @x + @w > o.x && o.x + o.w > @x
|
398
396
|
foot = o.y + o.h
|
399
397
|
if foot.round(6) == @y.round(6) || @speed.y < 0 && foot < @y && foot > y_aim
|
@@ -415,25 +413,30 @@ module MiniGL
|
|
415
413
|
@y = y_aim
|
416
414
|
end
|
417
415
|
else
|
418
|
-
|
416
|
+
move(arg, ignore_collision ? [] : obstacles, ignore_collision ? [] : ramps)
|
419
417
|
end
|
420
418
|
|
421
419
|
forces = Vector.new @x - prev_x, @y - prev_y
|
422
420
|
prev_g = G.gravity.clone
|
423
421
|
G.gravity.x = G.gravity.y = 0
|
424
422
|
passengers.each do |p|
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
423
|
+
if p.class.included_modules.include?(Movement)
|
424
|
+
prev_speed = p.speed.clone
|
425
|
+
prev_forces = p.stored_forces.clone
|
426
|
+
prev_bottom = p.bottom
|
427
|
+
p.speed.x = p.speed.y = 0
|
428
|
+
p.stored_forces.x = p.stored_forces.y = 0
|
429
|
+
p.instance_exec { @bottom = nil }
|
430
|
+
p.move(forces * p.mass, obstacles, ramps)
|
431
|
+
p.speed.x = prev_speed.x
|
432
|
+
p.speed.y = prev_speed.y
|
433
|
+
p.stored_forces.x = prev_forces.x
|
434
|
+
p.stored_forces.y = prev_forces.y
|
435
|
+
p.instance_exec(prev_bottom) { |b| @bottom = b }
|
436
|
+
else
|
437
|
+
p.x += forces.x
|
438
|
+
p.y += forces.y
|
439
|
+
end
|
437
440
|
end
|
438
441
|
G.gravity = prev_g
|
439
442
|
end
|
@@ -510,6 +513,8 @@ module MiniGL
|
|
510
513
|
unless @cycle_setup
|
511
514
|
@cur_point = 0 if @cur_point.nil?
|
512
515
|
if obstacles
|
516
|
+
obst_obstacles = [] if obst_obstacles.nil?
|
517
|
+
obst_ramps = [] if obst_ramps.nil?
|
513
518
|
move_carrying points[@cur_point], speed, obstacles, obst_obstacles, obst_ramps
|
514
519
|
else
|
515
520
|
move_free points[@cur_point], speed
|
data/lib/minigl/text.rb
CHANGED
@@ -1,23 +1,127 @@
|
|
1
1
|
module MiniGL
|
2
|
+
# This class represents a font and exposes most of the methods from +Gosu::Font+,
|
3
|
+
# but allows the font to be created from an image, allowing for better customization
|
4
|
+
# and also using the +retro+ option. Moreover, this class can be passed to the
|
5
|
+
# +TextHelper+ constructor as if it was a +Gosu::Font+.
|
6
|
+
#
|
7
|
+
# The image used to load the font must meet these criteria:
|
8
|
+
# * The characters should be laid out in lines of the same height in pixels.
|
9
|
+
# * The full image must have a height that is a multiple of that line height.
|
10
|
+
# * The characters should occupy the maximum available space in each line, i.e.,
|
11
|
+
# if a character fits in the current line it must not be placed in the next
|
12
|
+
# one. In the last line there can be any amount of free space at the end.
|
13
|
+
class ImageFont
|
14
|
+
# The height of this font in pixels.
|
15
|
+
attr_reader :height
|
16
|
+
|
17
|
+
# Creates an +ImageFont+.
|
18
|
+
#
|
19
|
+
# Parameters:
|
20
|
+
# [img_path] Identifier of an image fitting the description in the class documentation,
|
21
|
+
# as used in +Res.img+.
|
22
|
+
# [chars] A string containing all characters that will be present in the image, in the
|
23
|
+
# same order as they appear in the image. Do not include white space.
|
24
|
+
# [widths] An integer representing the width of the chars in pixels, if this is a fixed
|
25
|
+
# width font, or an array containing the width of each char, in the same order
|
26
|
+
# as they appear in the +chars+ string.
|
27
|
+
# [height] The height of the lines in the image (see description above).
|
28
|
+
# [space_width] The width of the white space character in this font.
|
29
|
+
# [global] Parameter that will be passed to +Res.img+ when loading the image.
|
30
|
+
# [ext] Parameter that will be passed to +Res.img+ when loading the image.
|
31
|
+
# [retro] Parameter that will be passed to +Res.img+ when loading the image.
|
32
|
+
def initialize(img_path, chars, widths, height, space_width, global = true, ext = '.png', retro = nil)
|
33
|
+
retro = Res.retro_images if retro.nil?
|
34
|
+
img = Res.img(img_path, global, false, ext, retro)
|
35
|
+
@chars = chars
|
36
|
+
@images = []
|
37
|
+
@height = height
|
38
|
+
@space_width = space_width
|
39
|
+
wa = widths.is_a?(Array)
|
40
|
+
if wa && widths.length != chars.length
|
41
|
+
raise 'Wrong widths array size!'
|
42
|
+
end
|
43
|
+
x = y = 0
|
44
|
+
(0...chars.length).each do |i|
|
45
|
+
@images.push(img.subimage(x, y, wa ? widths[i] : widths, height))
|
46
|
+
new_x = x + (wa ? widths[i] : widths)
|
47
|
+
if i < chars.length - 1 && new_x + (wa ? widths[i+1] : widths) > img.width
|
48
|
+
x = 0
|
49
|
+
y += height
|
50
|
+
else
|
51
|
+
x = new_x
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Returns the width, in pixels, of a given string written by this font.
|
57
|
+
# Note: Markup is not supported, this method is named this way to match
|
58
|
+
# <code>Gosu::Font</code>'s signature.
|
59
|
+
#
|
60
|
+
# Parameters:
|
61
|
+
# [text] The string to be measured
|
62
|
+
def markup_width(text)
|
63
|
+
text.chars.reduce(0) { |w, c| if c == ' '; w += @space_width; else; i = @chars.index(c); w += i ? @images[i].width : 0; end }
|
64
|
+
end
|
65
|
+
|
66
|
+
# See <code>Gosu::Font#draw_markup_rel</code> for details.
|
67
|
+
# Note: Markup is not supported, this method is named this way to match
|
68
|
+
# <code>Gosu::Font</code>'s signature.
|
69
|
+
def draw_markup_rel(text, x, y, z, rel_x, rel_y, scale_x, scale_y, color)
|
70
|
+
text = text.to_s unless text.is_a?(String)
|
71
|
+
if rel_x != 0
|
72
|
+
x -= scale_x * markup_width(text) * rel_x
|
73
|
+
end
|
74
|
+
if rel_y != 0
|
75
|
+
y -= scale_y * @height * rel_y
|
76
|
+
end
|
77
|
+
text.each_char do |c|
|
78
|
+
if c == ' '
|
79
|
+
x += scale_x * @space_width
|
80
|
+
next
|
81
|
+
end
|
82
|
+
i = @chars.index(c)
|
83
|
+
next if i.nil?
|
84
|
+
@images[i].draw(x, y, z, scale_x, scale_y, color)
|
85
|
+
x += scale_x * @images[i].width
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# See <code>Gosu::Font#draw_markup</code> for details.
|
90
|
+
# Note: Markup is not supported, this method is named this way to match
|
91
|
+
# <code>Gosu::Font</code>'s signature.
|
92
|
+
def draw_markup(text, x, y, z, scale_x, scale_y, color)
|
93
|
+
draw_markup_rel(text, x, y, z, 0, 0, scale_x, scale_y, color)
|
94
|
+
end
|
95
|
+
|
96
|
+
alias :draw_text_rel :draw_markup_rel
|
97
|
+
alias :draw_text :draw_markup
|
98
|
+
alias :text_width :markup_width
|
99
|
+
end
|
100
|
+
|
2
101
|
# This class provides methods for easily drawing one or multiple lines of
|
3
102
|
# text, with control over the text alignment and coloring.
|
4
103
|
class TextHelper
|
5
104
|
# Creates a TextHelper.
|
6
105
|
#
|
7
106
|
# Parameters:
|
8
|
-
# [font] A <code>Gosu::Font</code> that will
|
9
|
-
#
|
10
|
-
#
|
11
|
-
|
107
|
+
# [font] A <code>Gosu::Font</code> or <code>ImageFont</code> that will
|
108
|
+
# be used to draw the text.
|
109
|
+
# [line_spacing] When drawing multiple lines, the default distance, in
|
110
|
+
# pixels, between each line.
|
111
|
+
# [scale_x] The default horizontal scale of the font.
|
112
|
+
# [scale_y] The default vertical scale of the font.
|
113
|
+
def initialize(font, line_spacing = 0, scale_x = 1, scale_y = 1)
|
12
114
|
@font = font
|
13
115
|
@line_spacing = line_spacing
|
116
|
+
@scale_x = scale_x
|
117
|
+
@scale_y = scale_y
|
14
118
|
end
|
15
119
|
|
16
120
|
# Draws a single line of text.
|
17
121
|
#
|
18
122
|
# Parameters:
|
19
123
|
# [text] The text to be drawn. No line breaks are allowed. You can use the
|
20
|
-
|
124
|
+
# `<b>` tag for bold, `<i>` for italic and `<c=rrggbb>` for colors.
|
21
125
|
# [x] The horizontal reference for drawing the text. If +mode+ is +:left+,
|
22
126
|
# all text will be drawn from this point to the right; if +mode+ is
|
23
127
|
# +:right+, all text will be drawn from this point to the left; and if
|
@@ -43,12 +147,16 @@ module MiniGL
|
|
43
147
|
# provide less than 255.
|
44
148
|
# [z_index] The z-order to draw the object. Objects with larger z-orders
|
45
149
|
# will be drawn on top of the ones with smaller z-orders.
|
150
|
+
# [scale_x] The horizontal scaling of the text. If +nil+, this instance's
|
151
|
+
# +@scale_x+ value will be used.
|
152
|
+
# [scale_y] The vertical scaling of the text. If +nil+, this instance's
|
153
|
+
# +@scale_y+ value will be used.
|
46
154
|
#
|
47
155
|
# *Obs.:* This method accepts named parameters, but +text+, +x+ and +y+ are
|
48
156
|
# mandatory.
|
49
157
|
def write_line(text, x = nil, y = nil, mode = :left, color = 0, alpha = 0xff,
|
50
158
|
effect = nil, effect_color = 0, effect_size = 1, effect_alpha = 0xff,
|
51
|
-
z_index = 0)
|
159
|
+
z_index = 0, scale_x = nil, scale_y = nil)
|
52
160
|
if text.is_a? Hash
|
53
161
|
x = text[:x]
|
54
162
|
y = text[:y]
|
@@ -60,9 +168,13 @@ module MiniGL
|
|
60
168
|
effect_size = text.fetch(:effect_size, 1)
|
61
169
|
effect_alpha = text.fetch(:effect_alpha, 0xff)
|
62
170
|
z_index = text.fetch(:z_index, 0)
|
171
|
+
scale_x = text.fetch(:scale_x, nil)
|
172
|
+
scale_y = text.fetch(:scale_y, nil)
|
63
173
|
text = text[:text]
|
64
174
|
end
|
65
175
|
|
176
|
+
scale_x = @scale_x if scale_x.nil?
|
177
|
+
scale_y = @scale_y if scale_y.nil?
|
66
178
|
color = (alpha << 24) | color
|
67
179
|
rel =
|
68
180
|
case mode
|
@@ -74,19 +186,19 @@ module MiniGL
|
|
74
186
|
if effect
|
75
187
|
effect_color = (effect_alpha << 24) | effect_color
|
76
188
|
if effect == :border
|
77
|
-
@font.draw_markup_rel text, x - effect_size, y - effect_size, z_index, rel, 0,
|
78
|
-
@font.draw_markup_rel text, x, y - effect_size, z_index, rel, 0,
|
79
|
-
@font.draw_markup_rel text, x + effect_size, y - effect_size, z_index, rel, 0,
|
80
|
-
@font.draw_markup_rel text, x + effect_size, y, z_index, rel, 0,
|
81
|
-
@font.draw_markup_rel text, x + effect_size, y + effect_size, z_index, rel, 0,
|
82
|
-
@font.draw_markup_rel text, x, y + effect_size, z_index, rel, 0,
|
83
|
-
@font.draw_markup_rel text, x - effect_size, y + effect_size, z_index, rel, 0,
|
84
|
-
@font.draw_markup_rel text, x - effect_size, y, z_index, rel, 0,
|
189
|
+
@font.draw_markup_rel text, x - effect_size, y - effect_size, z_index, rel, 0, scale_x, scale_y, effect_color
|
190
|
+
@font.draw_markup_rel text, x, y - effect_size, z_index, rel, 0, scale_x, scale_y, effect_color
|
191
|
+
@font.draw_markup_rel text, x + effect_size, y - effect_size, z_index, rel, 0, scale_x, scale_y, effect_color
|
192
|
+
@font.draw_markup_rel text, x + effect_size, y, z_index, rel, 0, scale_x, scale_y, effect_color
|
193
|
+
@font.draw_markup_rel text, x + effect_size, y + effect_size, z_index, rel, 0, scale_x, scale_y, effect_color
|
194
|
+
@font.draw_markup_rel text, x, y + effect_size, z_index, rel, 0, scale_x, scale_y, effect_color
|
195
|
+
@font.draw_markup_rel text, x - effect_size, y + effect_size, z_index, rel, 0, scale_x, scale_y, effect_color
|
196
|
+
@font.draw_markup_rel text, x - effect_size, y, z_index, rel, 0, scale_x, scale_y, effect_color
|
85
197
|
elsif effect == :shadow
|
86
|
-
@font.draw_markup_rel text, x + effect_size, y + effect_size, z_index, rel, 0,
|
198
|
+
@font.draw_markup_rel text, x + effect_size, y + effect_size, z_index, rel, 0, scale_x, scale_y, effect_color
|
87
199
|
end
|
88
200
|
end
|
89
|
-
@font.draw_markup_rel text, x, y, z_index, rel, 0,
|
201
|
+
@font.draw_markup_rel text, x, y, z_index, rel, 0, scale_x, scale_y, color
|
90
202
|
end
|
91
203
|
|
92
204
|
# Draws text, breaking lines when needed and when explicitly caused by the
|
@@ -94,7 +206,7 @@ module MiniGL
|
|
94
206
|
#
|
95
207
|
# Parameters:
|
96
208
|
# [text] The text to be drawn. Line breaks are allowed. You can use the
|
97
|
-
|
209
|
+
# `<b>` tag for bold, `<i>` for italic and `<c=rrggbb>` for colors.
|
98
210
|
# [x] The horizontal reference for drawing the text. Works like in
|
99
211
|
# +write_line+ for the +:left+, +:right+ and +:center+ modes. For the
|
100
212
|
# +:justified+ mode, works the same as for +:left+.
|
@@ -109,11 +221,20 @@ module MiniGL
|
|
109
221
|
# transparent) to 255 (fully opaque).
|
110
222
|
# [z_index] The z-order to draw the object. Objects with larger z-orders
|
111
223
|
# will be drawn on top of the ones with smaller z-orders.
|
112
|
-
|
224
|
+
# [scale_x] The horizontal scaling of the text. If +nil+, this instance's
|
225
|
+
# +@scale_x+ value will be used.
|
226
|
+
# [scale_y] The vertical scaling of the text. If +nil+, this instance's
|
227
|
+
# +@scale_y+ value will be used.
|
228
|
+
# [line_spacing] The spacing between lines, in pixels. If +nil+, this
|
229
|
+
# instance's +@line_spacing+ value will be used.
|
230
|
+
def write_breaking(text, x, y, width, mode = :left, color = 0, alpha = 0xff, z_index = 0, scale_x = nil, scale_y = nil, line_spacing = nil)
|
231
|
+
line_spacing = @line_spacing if line_spacing.nil?
|
232
|
+
scale_x = @scale_x if scale_x.nil?
|
233
|
+
scale_y = @scale_y if scale_y.nil?
|
113
234
|
color = (alpha << 24) | color
|
114
235
|
text.split("\n").each do |p|
|
115
236
|
if mode == :justified
|
116
|
-
y = write_paragraph_justified p, x, y, width, color, z_index
|
237
|
+
y = write_paragraph_justified p, x, y, width, color, z_index, scale_x, scale_y, line_spacing
|
117
238
|
else
|
118
239
|
rel =
|
119
240
|
case mode
|
@@ -122,40 +243,40 @@ module MiniGL
|
|
122
243
|
when :right then 1
|
123
244
|
else 0
|
124
245
|
end
|
125
|
-
y = write_paragraph p, x, y, width, rel, color, z_index
|
246
|
+
y = write_paragraph p, x, y, width, rel, color, z_index, scale_x, scale_y, line_spacing
|
126
247
|
end
|
127
248
|
end
|
128
249
|
end
|
129
250
|
|
130
251
|
private
|
131
252
|
|
132
|
-
def write_paragraph(text, x, y, width, rel, color, z_index)
|
253
|
+
def write_paragraph(text, x, y, width, rel, color, z_index, scale_x, scale_y, line_spacing)
|
133
254
|
line = ''
|
134
255
|
line_width = 0
|
135
256
|
text.split(' ').each do |word|
|
136
|
-
w = @font.markup_width
|
137
|
-
if line_width + w > width
|
138
|
-
@font.draw_markup_rel line.chop, x, y, z_index, rel, 0,
|
257
|
+
w = @font.markup_width(word)
|
258
|
+
if line_width + w * scale_x > width
|
259
|
+
@font.draw_markup_rel line.chop, x, y, z_index, rel, 0, scale_x, scale_y, color
|
139
260
|
line = ''
|
140
261
|
line_width = 0
|
141
|
-
y += @font.height +
|
262
|
+
y += (@font.height + line_spacing) * scale_y
|
142
263
|
end
|
143
264
|
line += "#{word} "
|
144
|
-
line_width += @font.markup_width
|
265
|
+
line_width += @font.markup_width("#{word} ") * scale_x
|
145
266
|
end
|
146
|
-
@font.draw_markup_rel line.chop, x, y, z_index, rel, 0,
|
147
|
-
y + @font.height +
|
267
|
+
@font.draw_markup_rel line.chop, x, y, z_index, rel, 0, scale_x, scale_y, color unless line.empty?
|
268
|
+
y + (@font.height + line_spacing) * scale_y
|
148
269
|
end
|
149
270
|
|
150
|
-
def write_paragraph_justified(text, x, y, width, color, z_index)
|
151
|
-
space_width = @font.text_width '
|
271
|
+
def write_paragraph_justified(text, x, y, width, color, z_index, scale_x, scale_y, line_spacing)
|
272
|
+
space_width = @font.text_width(' ') * scale_x
|
152
273
|
spaces = [[]]
|
153
274
|
line_index = 0
|
154
275
|
new_x = x
|
155
276
|
words = text.split(' ')
|
156
277
|
words.each do |word|
|
157
|
-
w = @font.markup_width
|
158
|
-
if new_x + w > x + width
|
278
|
+
w = @font.markup_width(word)
|
279
|
+
if new_x + w * scale_x > x + width
|
159
280
|
space = x + width - new_x + space_width
|
160
281
|
index = 0
|
161
282
|
while space > 0
|
@@ -170,7 +291,7 @@ module MiniGL
|
|
170
291
|
|
171
292
|
new_x = x
|
172
293
|
end
|
173
|
-
new_x += @font.markup_width(word) + space_width
|
294
|
+
new_x += @font.markup_width(word) * scale_x + space_width
|
174
295
|
spaces[line_index] << space_width
|
175
296
|
end
|
176
297
|
|
@@ -178,11 +299,11 @@ module MiniGL
|
|
178
299
|
spaces.each do |line|
|
179
300
|
new_x = x
|
180
301
|
line.each do |s|
|
181
|
-
@font.draw_markup
|
182
|
-
new_x += @font.markup_width(words[index]) + s
|
302
|
+
@font.draw_markup(words[index], new_x, y, z_index, scale_x, scale_y, color)
|
303
|
+
new_x += @font.markup_width(words[index]) * scale_x + s
|
183
304
|
index += 1
|
184
305
|
end
|
185
|
-
y += @font.height +
|
306
|
+
y += (@font.height + line_spacing) * scale_y
|
186
307
|
end
|
187
308
|
y
|
188
309
|
end
|
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: 2.
|
4
|
+
version: 2.3.3
|
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: 2020-
|
11
|
+
date: 2020-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gosu
|
@@ -98,37 +98,37 @@ signing_key:
|
|
98
98
|
specification_version: 4
|
99
99
|
summary: MiniGL
|
100
100
|
test_files:
|
101
|
+
- test/vector_tests.rb
|
101
102
|
- test/res_tests.rb
|
102
|
-
- test/iso_game.rb
|
103
103
|
- test/mov_game.rb
|
104
|
+
- test/movement_tests.rb
|
104
105
|
- test/map_tests.rb
|
105
|
-
- test/
|
106
|
+
- test/iso_game.rb
|
106
107
|
- test/game_object_tests.rb
|
107
|
-
- test/
|
108
|
-
- test/movement_tests.rb
|
108
|
+
- test/game.rb
|
109
109
|
- test/test.png
|
110
|
+
- test/data/tileset/tileset1.png
|
110
111
|
- test/data/font/font1.ttf
|
112
|
+
- test/data/sound/1.wav
|
113
|
+
- test/data/img/check.png
|
111
114
|
- test/data/img/square.svg
|
112
|
-
- test/data/img/
|
113
|
-
- test/data/img/img1.png
|
114
|
-
- test/data/img/tile1.png
|
115
|
-
- test/data/img/tile2b.png
|
116
|
-
- test/data/img/text.png
|
117
|
-
- test/data/img/btn.png
|
118
|
-
- test/data/img/square2.svg
|
119
|
-
- test/data/img/square2.png
|
115
|
+
- test/data/img/tile2.svg
|
120
116
|
- test/data/img/barfg.png
|
121
|
-
- test/data/img/tile1b.png
|
122
117
|
- test/data/img/tile2.png
|
123
|
-
- test/data/img/
|
124
|
-
- test/data/img/tile2.svg
|
125
|
-
- test/data/img/square3.png
|
118
|
+
- test/data/img/tile1.svg
|
126
119
|
- test/data/img/square3.svg
|
120
|
+
- test/data/img/text.png
|
121
|
+
- test/data/img/square2.svg
|
127
122
|
- test/data/img/image.png
|
128
|
-
- test/data/img/
|
129
|
-
- test/data/img/
|
123
|
+
- test/data/img/img1.png
|
124
|
+
- test/data/img/square2.png
|
130
125
|
- test/data/img/barbg.svg
|
131
126
|
- test/data/img/barfg.svg
|
132
|
-
- test/data/
|
133
|
-
- test/data/
|
127
|
+
- test/data/img/tile1b.png
|
128
|
+
- test/data/img/barbg.png
|
129
|
+
- test/data/img/square.png
|
130
|
+
- test/data/img/btn.png
|
131
|
+
- test/data/img/square3.png
|
132
|
+
- test/data/img/tile2b.png
|
133
|
+
- test/data/img/tile1.png
|
134
134
|
- test/data/img/sub/image.png
|