minigl 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0362df674b485b64cd44d6b167377b2d46d6c33fd9b2d65428fe75e8de9e027
4
- data.tar.gz: d91ae820bfc76cb9895f43227646028b23927cffe2e4b226f3b2b14779fe08a3
3
+ metadata.gz: 01f5acaeb5e8ec1f22e2ffcd206b34a65bdd10215bbf11905d81d669c016c966
4
+ data.tar.gz: 27e794b64224d12c5e9d839f811b98832a3f033d15dd8589b202d9813d1155fb
5
5
  SHA512:
6
- metadata.gz: 70af1a521abd0f23110b62b2c88a1de5f1fd94aeb664fc8c9e4ca8cd414a024c0ac93037889b9b8431598c7e63cf11e62b00f657213f5eb68957da70ca4fdfc5
7
- data.tar.gz: 685115af1a42dc3662af276580771b0be33eae0348fd54e1f11f679c2de26a10f8d158a9d00cf0e67ae42ae5bab2af4841adbf466aca38b46b6e75665ca3b773
6
+ metadata.gz: 2b3fc964c0a8fd8cebbbbef53b8e04724ff598a1dcc3239ee80c3416e1280653e1a8afa78f0d733809376d057ec918c62dc6973ed7f9b91395dd237b96607e55
7
+ data.tar.gz: dd1bd674701076bc3fb1c9e1c4ea935cd5aa40288bfd440712bf08fd2d3156c5b3bd1c580a565dc8a842af1c9238bc34158c0d04ee9067b114c27c1568318d40
data/README.md CHANGED
@@ -29,10 +29,11 @@ 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.3.0
32
+ ## Version 2.3.1
33
33
 
34
- * Added the `ImageFont` class.
35
- * Added scale and line spacing options to `TextHelper` methods.
34
+ * Fix bug in `Movement#move_carrying`.
35
+ * Fix `ImageFont#draw_markup_rel` for different values of `rel_x` and `rel_y`.
36
+ * Add missing documentation in `TextHelper` methods.
36
37
 
37
38
  ## Contributing
38
39
 
@@ -382,6 +382,9 @@ module MiniGL
382
382
  @speed.x = 1.0 * x_d * speed / distance
383
383
  @speed.y = 1.0 * y_d * speed / distance
384
384
  x_aim = @x + @speed.x; y_aim = @y + @speed.y
385
+ else
386
+ x_aim = @x + @speed.x + G.gravity.x + arg.x
387
+ y_aim = @y + @speed.y + G.gravity.y + arg.y
385
388
  end
386
389
 
387
390
  passengers = []
@@ -1,7 +1,8 @@
1
1
  module MiniGL
2
2
  # This class represents a font and exposes most of the methods from +Gosu::Font+,
3
3
  # but allows the font to be created from an image, allowing for better customization
4
- # and also using the +retro+ option.
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+.
5
6
  #
6
7
  # The image used to load the font must meet these criteria:
7
8
  # * The characters should be laid out in lines of the same height in pixels.
@@ -53,6 +54,8 @@ module MiniGL
53
54
  end
54
55
 
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.
56
59
  #
57
60
  # Parameters:
58
61
  # [text] The string to be measured
@@ -61,17 +64,15 @@ module MiniGL
61
64
  end
62
65
 
63
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.
64
69
  def draw_markup_rel(text, x, y, z, rel_x, rel_y, scale_x, scale_y, color)
65
70
  text = text.to_s unless text.is_a?(String)
66
- if rel_x == 0.5
67
- x -= scale_x * markup_width(text) / 2
68
- elsif rel_x == 1
69
- x -= scale_x * markup_width(text)
71
+ if rel_x != 0
72
+ x -= scale_x * markup_width(text) * rel_x
70
73
  end
71
- if rel_y == 0.5
72
- y -= scale_y * @height / 2
73
- elsif rel_y == 1
74
- y -= scale_x * @height
74
+ if rel_y != 0
75
+ y -= scale_y * @height * rel_y
75
76
  end
76
77
  text.each_char do |c|
77
78
  if c == ' '
@@ -86,6 +87,8 @@ module MiniGL
86
87
  end
87
88
 
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.
89
92
  def draw_markup(text, x, y, z, scale_x, scale_y, color)
90
93
  draw_markup_rel(text, x, y, z, 0, 0, scale_x, scale_y, color)
91
94
  end
@@ -101,9 +104,12 @@ module MiniGL
101
104
  # Creates a TextHelper.
102
105
  #
103
106
  # Parameters:
104
- # [font] A <code>Gosu::Font</code> that will be used to draw the text.
105
- # [line_spacing] When drawing multiple lines, the distance, in pixels,
106
- # between each line.
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.
107
113
  def initialize(font, line_spacing = 0, scale_x = 1, scale_y = 1)
108
114
  @font = font
109
115
  @line_spacing = line_spacing
@@ -115,7 +121,7 @@ module MiniGL
115
121
  #
116
122
  # Parameters:
117
123
  # [text] The text to be drawn. No line breaks are allowed. You can use the
118
- # `<b>` tag for bold, `<i>` for italic and `<c=rrggbb>` for colors.
124
+ # `<b>` tag for bold, `<i>` for italic and `<c=rrggbb>` for colors.
119
125
  # [x] The horizontal reference for drawing the text. If +mode+ is +:left+,
120
126
  # all text will be drawn from this point to the right; if +mode+ is
121
127
  # +:right+, all text will be drawn from this point to the left; and if
@@ -141,6 +147,10 @@ module MiniGL
141
147
  # provide less than 255.
142
148
  # [z_index] The z-order to draw the object. Objects with larger z-orders
143
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.
144
154
  #
145
155
  # *Obs.:* This method accepts named parameters, but +text+, +x+ and +y+ are
146
156
  # mandatory.
@@ -211,6 +221,12 @@ module MiniGL
211
221
  # transparent) to 255 (fully opaque).
212
222
  # [z_index] The z-order to draw the object. Objects with larger z-orders
213
223
  # will be drawn on top of the ones with smaller z-orders.
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.
214
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)
215
231
  line_spacing = @line_spacing if line_spacing.nil?
216
232
  scale_x = @scale_x if scale_x.nil?
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.3.0
4
+ version: 2.3.1
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-07-06 00:00:00.000000000 Z
11
+ date: 2020-07-22 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/game.rb
106
+ - test/iso_game.rb
106
107
  - test/game_object_tests.rb
107
- - test/vector_tests.rb
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/barbg.png
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/check.png
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/tile1.svg
129
- - test/data/img/square.png
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/tileset/tileset1.png
133
- - test/data/sound/1.wav
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