minigl 2.3.3 → 2.3.7

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: f8864115892b3cc8a853b6bea09aaa768f0750f40e1f39f247177db200c52dcc
4
- data.tar.gz: 29bb72b4cf14e1e0b53850b46b5eeabc9de348854af4947ee803310e9fd7ff42
3
+ metadata.gz: 6623569ecf1fbd81357b4fe2e06b22024c2ce05829298750e1574e08a02b2706
4
+ data.tar.gz: ded142065a95df7c458d873a6c2049f4229f3fd40863872fdf19033f07331635
5
5
  SHA512:
6
- metadata.gz: '09d5fdd7c6d7bfed2ef5a026b8b1754ca24c9cd1116e8dc4c3e2ef113e8253f15831cb9a8d29d5ccd6a71e8a002b46ee27ccffe42f9ccca15c2cdfe00646862b'
7
- data.tar.gz: 5ea1ff3572568e194a6ee4dae01b9ed9df11bedfa31738457ca449401708b0490a7f73e1a3f3a9f82eced6030f4ec35418e2ef48f3fd30b542466879d3db5d0d
6
+ metadata.gz: 6cbb8a59c7b77104a1a8bba97d2ab740520cc6987eda4761e438b8b36fcd30b85eaacaa6caab32884118f52dadf3b763718017114db25b09b6f416dd7e1d5588
7
+ data.tar.gz: 6b3db4da549096602dc258f26101f665713422f510f5623cf7e53bdb1940226dd4a97740e44446a60554e6e1ea29abfb981355ac3caa2006e8111b32dc3aa9d2
data/README.md CHANGED
@@ -14,6 +14,14 @@ It provides the following features:
14
14
  More functionalities are coming. Feel free to contribute! You can send feedback
15
15
  to victordavidsantos@gmail.com.
16
16
 
17
+ ## Made with MiniGL
18
+
19
+ Below are two full games built with MiniGL, both available for free download and also open source.
20
+ * [Super Bombinhas](https://victords.itch.io/super-bombinhas) ([source](https://github.com/victords/super-bombinhas))
21
+ * [ConnecMan](https://victords.itch.io/connecman) ([source](https://github.com/victords/connecman))
22
+
23
+ *Super Bombinhas* is also available on [Steam](https://store.steampowered.com/app/1553840).
24
+
17
25
  ## Installing
18
26
 
19
27
  MiniGL was built on top of the Gosu gem. This gem has its own dependencies for
@@ -29,9 +37,10 @@ After installing the Gosu dependencies, you can just `gem install minigl`.
29
37
  * The [wiki](https://github.com/victords/minigl/wiki) is a work in progress with tutorials and examples.
30
38
  * Test package and examples aren't complete!
31
39
 
32
- ## Version 2.3.3
40
+ ## Version 2.3.7
33
41
 
34
- * Fix bug in `Movement#cycle`.
42
+ * Exposed the `Panel#controls`, `TextField#focused` and `DropDownList#open` properties.
43
+ * Fixed a bug when clicking overlapping buttons: only the click action of the button with highest z-index (or last updated if z-indexes are the same) will be triggered. **WARNING**: the click callback will only be executed if `Mouse.update` is called after the click happened. If you call `Mouse.update` every frame (which is recommended), there's nothing to worry about.
35
44
 
36
45
  ## Contributing
37
46
 
data/lib/minigl/forms.rb CHANGED
@@ -98,6 +98,9 @@ module MiniGL
98
98
  # Gets or sets whether the panel (and thus all components inside it) are visible.
99
99
  attr_accessor :visible
100
100
 
101
+ # The components contained in this panel.
102
+ attr_reader :controls
103
+
101
104
  # Creates a new Panel.
102
105
  # Parameters:
103
106
  # [x] The horizontal coordinate of the top-left corner of the panel, or the horizontal offset from the anchor, if provided.
@@ -348,8 +351,10 @@ module MiniGL
348
351
  @img_index = 0
349
352
  @state = :up
350
353
  elsif mouse_press
351
- @img_index = 2
352
- @state = :down
354
+ Mouse.add_click(@z_index || 0, lambda do
355
+ @img_index = 2
356
+ @state = :down
357
+ end)
353
358
  else
354
359
  @img_index = 1
355
360
  end
@@ -360,7 +365,7 @@ module MiniGL
360
365
  elsif mouse_rel
361
366
  @img_index = 1
362
367
  @state = :over
363
- click
368
+ Mouse.add_click(@z_index || 0, method(:perform_action))
364
369
  else
365
370
  @img_index = 2
366
371
  end
@@ -379,7 +384,7 @@ module MiniGL
379
384
 
380
385
  # Executes the button click action.
381
386
  def click
382
- @action.call @params if @action
387
+ perform_action
383
388
  end
384
389
 
385
390
  # Sets the position of the button in the screen.
@@ -404,6 +409,7 @@ module MiniGL
404
409
  # will be drawn on top of the ones with smaller z-orders.
405
410
  # [color] Color to apply a filter to the image.
406
411
  def draw(alpha = 0xff, z_index = 0, color = 0xffffff)
412
+ @z_index = z_index
407
413
  return unless @visible
408
414
 
409
415
  color = (alpha << 24) | color
@@ -435,6 +441,12 @@ module MiniGL
435
441
  @state = :up
436
442
  @img_index = 3
437
443
  end
444
+
445
+ private
446
+
447
+ def perform_action
448
+ @action.call @params if @action
449
+ end
438
450
  end
439
451
 
440
452
  # This class represents a toggle button, which can be also interpreted as a
@@ -517,20 +529,12 @@ module MiniGL
517
529
  @img_index += 1 if @checked
518
530
  end
519
531
 
520
- # Executes the button click action, and toggles its state. The +action+
521
- # block always receives as a first parameter +true+, if the button has
522
- # been changed to checked, or +false+, otherwise.
523
- def click
524
- @checked = !@checked
525
- @action.call @checked, @params if @action
526
- end
527
-
528
532
  # Sets the state of the button to the value given.
529
533
  #
530
534
  # Parameters:
531
535
  # [value] The state to be set (+true+ for checked, +false+ for unchecked).
532
536
  def checked=(value)
533
- click if value != @checked
537
+ @action.call(value, @params) if @action && value != @checked
534
538
  @checked = value
535
539
  end
536
540
 
@@ -539,6 +543,13 @@ module MiniGL
539
543
  @state = :up
540
544
  @img_index = @checked ? 7 : 6
541
545
  end
546
+
547
+ private
548
+
549
+ def perform_action
550
+ @checked = !@checked
551
+ @action.call(@checked, @params) if @action
552
+ end
542
553
  end
543
554
 
544
555
  # This class represents a text field (input).
@@ -547,6 +558,9 @@ module MiniGL
547
558
  # INCOMPLETE!
548
559
  attr_reader :locale
549
560
 
561
+ # Whether the text field is focused (accepting input)
562
+ attr_reader :focused
563
+
550
564
  # Creates a new text field.
551
565
  #
552
566
  # Parameters:
@@ -566,9 +580,9 @@ module MiniGL
566
580
  # [margin_x] The x offset, from the field x-coordinate, to draw the text.
567
581
  # [margin_y] The y offset, from the field y-coordinate, to draw the text.
568
582
  # [max_length] The maximum length of the text inside the field.
569
- # [active] Whether the text field must be focused by default. If +false+,
570
- # focus can be granted by clicking inside the text field or by
571
- # calling the +focus+ method.
583
+ # [focused] Whether the text field must be focused by default. If +false+,
584
+ # focus can be granted by clicking inside the text field or by
585
+ # calling the +focus+ method.
572
586
  # [text] The starting text. Must not be +nil+.
573
587
  # [allowed_chars] A string containing all characters that can be typed
574
588
  # inside the text field. The complete set of supported
@@ -606,7 +620,7 @@ module MiniGL
606
620
  # *Obs.:* This method accepts named parameters, but +x+, +y+, +font+ and
607
621
  # +img+ are mandatory.
608
622
  def initialize(x, y = nil, font = nil, img = nil, cursor_img = nil, disabled_img = nil, margin_x = 0, margin_y = 0,
609
- max_length = 100, active = false, text = '', allowed_chars = nil,
623
+ max_length = 100, focused = false, text = '', allowed_chars = nil,
610
624
  text_color = 0, disabled_text_color = 0, selection_color = 0, locale = 'en-us',
611
625
  params = nil, retro = nil, scale_x = 1, scale_y = 1, anchor = nil, &on_text_changed)
612
626
  if x.is_a? Hash
@@ -618,7 +632,7 @@ module MiniGL
618
632
  margin_x = x.fetch(:margin_x, 0)
619
633
  margin_y = x.fetch(:margin_y, 0)
620
634
  max_length = x.fetch(:max_length, 100)
621
- active = x.fetch(:active, false)
635
+ focused = x.fetch(:focused, false)
622
636
  text = x.fetch(:text, '')
623
637
  allowed_chars = x.fetch(:allowed_chars, nil)
624
638
  text_color = x.fetch(:text_color, 0)
@@ -647,7 +661,7 @@ module MiniGL
647
661
  @cursor_img = Res.img(cursor_img, false, false, '.png', retro) if cursor_img
648
662
  @disabled_img = Res.img(disabled_img, false, false, '.png', retro) if disabled_img
649
663
  @max_length = max_length
650
- @active = active
664
+ @focused = focused
651
665
  @text_x = x + margin_x * @scale_x
652
666
  @text_y = y + margin_y * @scale_y
653
667
  @selection_color = selection_color
@@ -690,14 +704,14 @@ module MiniGL
690
704
 
691
705
  ################################ Mouse ################################
692
706
  if Mouse.over? @x, @y, @w, @h
693
- if not @active and Mouse.button_pressed? :left
694
- focus
707
+ if not @focused and Mouse.button_pressed? :left
708
+ Mouse.add_click(@z_index || 0, method(:focus))
695
709
  end
696
710
  elsif Mouse.button_pressed? :left
697
711
  unfocus
698
712
  end
699
713
 
700
- return unless @active
714
+ return unless @focused
701
715
 
702
716
  if Mouse.double_click? :left
703
717
  if @nodes.size > 1
@@ -708,11 +722,7 @@ module MiniGL
708
722
  end
709
723
  set_cursor_visible
710
724
  elsif Mouse.button_pressed? :left
711
- set_node_by_mouse
712
- @anchor1 = @cur_node
713
- @anchor2 = nil
714
- @double_clicked = false
715
- set_cursor_visible
725
+ Mouse.add_click(@z_index || 0, method(:focus))
716
726
  elsif Mouse.button_down? :left
717
727
  if @anchor1 and not @double_clicked
718
728
  set_node_by_mouse
@@ -902,7 +912,12 @@ module MiniGL
902
912
 
903
913
  # Grants focus to the text field, so that it allows keyboard input.
904
914
  def focus
905
- @active = true
915
+ @focused = true
916
+ set_node_by_mouse
917
+ @anchor1 = @cur_node
918
+ @anchor2 = nil
919
+ @double_clicked = false
920
+ set_cursor_visible
906
921
  end
907
922
 
908
923
  # Removes focus from the text field, so that no keyboard input will be
@@ -911,7 +926,7 @@ module MiniGL
911
926
  @anchor1 = @anchor2 = nil
912
927
  @cursor_visible = false
913
928
  @cursor_timer = 0
914
- @active = false
929
+ @focused = false
915
930
  end
916
931
 
917
932
  # Sets the position of the text field in the screen.
@@ -941,6 +956,7 @@ module MiniGL
941
956
  # [disabled_color] Color to apply a filter to the image when the field is
942
957
  # disabled.
943
958
  def draw(alpha = 0xff, z_index = 0, color = 0xffffff, disabled_color = 0x808080)
959
+ @z_index = z_index
944
960
  return unless @visible
945
961
 
946
962
  color = (alpha << 24) | ((@enabled or @disabled_img) ? color : disabled_color)
@@ -1250,6 +1266,9 @@ module MiniGL
1250
1266
  # The selected value in the drop-down list. This is one of the +options+.
1251
1267
  attr_reader :value
1252
1268
 
1269
+ # Whether the list of options is currently visible.
1270
+ attr_reader :open
1271
+
1253
1272
  # An array containing all the options (each of them +String+s) that can be
1254
1273
  # selected in the drop-down list.
1255
1274
  attr_accessor :options
data/lib/minigl/global.rb CHANGED
@@ -397,6 +397,11 @@ module MiniGL
397
397
  @down.clear
398
398
  @dbl_click.clear
399
399
 
400
+ if @click
401
+ @click[:action].call
402
+ @click = nil
403
+ end
404
+
400
405
  @dbl_click_timer.each do |k, v|
401
406
  if v < G.double_click_delay; @dbl_click_timer[k] += 1
402
407
  else; @dbl_click_timer.delete k; end
@@ -474,6 +479,13 @@ module MiniGL
474
479
  return @x >= x.x && @x < x.x + x.w && @y >= x.y && @y < x.y + x.h if x.is_a? Rectangle
475
480
  @x >= x && @x < x + w && @y >= y && @y < y + h
476
481
  end
482
+
483
+ # :nodoc:
484
+ def add_click(z_index, action)
485
+ return if @click && @click[:z_index] > z_index
486
+
487
+ @click = { z_index: z_index, action: action }
488
+ end
477
489
  end
478
490
  end
479
491
 
@@ -66,6 +66,10 @@ module MiniGL
66
66
  # from left to right when +false+).
67
67
  attr_reader :left
68
68
 
69
+ # Whether the ramp is vertically inverted, i.e., the face that is parallel
70
+ # to the x-axis faces up and the sloped face faces down.
71
+ attr_reader :inverted
72
+
69
73
  attr_reader :ratio # :nodoc:
70
74
  attr_reader :factor # :nodoc:
71
75
 
@@ -85,12 +89,16 @@ module MiniGL
85
89
  # highest).
86
90
  # [left] Whether the height of the ramp increases from left to right. Use
87
91
  # +false+ for a ramp that goes down from left to right.
88
- def initialize(x, y, w, h, left)
92
+ # [inverted] Whether the ramp is vertically inverted, i.e., the face that
93
+ # is parallel to the x-axis faces up and the sloped face faces
94
+ # down.
95
+ def initialize(x, y, w, h, left, inverted = false)
89
96
  @x = x
90
97
  @y = y
91
98
  @w = w
92
99
  @h = h
93
100
  @left = left
101
+ @inverted = inverted
94
102
  @ratio = @h.to_f / @w
95
103
  @factor = @w / Math.sqrt(@w**2 + @h**2)
96
104
  end
@@ -101,6 +109,7 @@ module MiniGL
101
109
  # [obj] The object to check contact with. It must have the +x+, +y+, +w+
102
110
  # and +h+ accessible attributes determining its bounding box.
103
111
  def contact?(obj)
112
+ return false if @inverted
104
113
  obj.x + obj.w > @x && obj.x < @x + @w && obj.x.round(6) == get_x(obj).round(6) && obj.y.round(6) == get_y(obj).round(6)
105
114
  end
106
115
 
@@ -111,44 +120,44 @@ module MiniGL
111
120
  # [obj] The object to check intersection with. It must have the +x+, +y+,
112
121
  # +w+ and +h+ accessible attributes determining its bounding box.
113
122
  def intersect?(obj)
114
- obj.x + obj.w > @x && obj.x < @x + @w && obj.y > get_y(obj) && obj.y <= @y + @h - obj.h
123
+ obj.x + obj.w > @x && obj.x < @x + @w &&
124
+ (@inverted ? obj.y < get_y(obj) && obj.y + obj.h > @y : obj.y > get_y(obj) && obj.y < @y + @h)
115
125
  end
116
126
 
117
127
  # :nodoc:
118
128
  def check_can_collide(m)
119
- y = get_y(m) + m.h
129
+ y = get_y(m) + (@inverted ? 0 : m.h)
120
130
  @can_collide = m.x + m.w > @x && @x + @w > m.x && m.y < y && m.y + m.h > y
121
131
  end
122
132
 
123
133
  def check_intersection(obj)
124
- if @can_collide and intersect? obj
125
- counter = @left && obj.prev_speed.x > 0 || !@left && obj.prev_speed.x < 0
126
- if obj.prev_speed.y > 0 && counter
127
- dx = get_x(obj) - obj.x
128
- s = (obj.prev_speed.y.to_f / obj.prev_speed.x).abs
129
- dx /= s + @ratio
130
- obj.x += dx
131
- end
132
- obj.y = get_y obj
133
- if counter && obj.bottom != self
134
- obj.speed.x *= @factor
135
- end
136
- obj.speed.y = 0
134
+ return unless @can_collide && intersect?(obj)
135
+
136
+ counter = @left && obj.prev_speed.x > 0 || !@left && obj.prev_speed.x < 0
137
+ if counter && (@inverted ? obj.prev_speed.y < 0 : obj.prev_speed.y > 0)
138
+ dx = get_x(obj) - obj.x
139
+ s = (obj.prev_speed.y.to_f / obj.prev_speed.x).abs
140
+ dx /= s + @ratio
141
+ obj.x += dx
137
142
  end
143
+ if counter && obj.bottom != self
144
+ obj.speed.x *= @factor
145
+ end
146
+
147
+ obj.speed.y = 0
148
+ obj.y = get_y(obj)
138
149
  end
139
150
 
140
151
  def get_x(obj)
141
- return obj.x if @left && obj.x + obj.w > @x + @w
142
- return @x + (1.0 * (@y + @h - obj.y - obj.h) * @w / @h) - obj.w if @left
143
- return obj.x if obj.x < @x
144
- @x + (1.0 * (obj.y + obj.h - @y) * @w / @h)
152
+ return obj.x if @left && obj.x + obj.w > @x + @w || !@left && obj.x < @x
153
+ offset = (@inverted ? obj.y - @y : @y + @h - obj.y - obj.h).to_f * @w / @h
154
+ @left ? @x + offset - obj.w : @x + @w - offset
145
155
  end
146
156
 
147
157
  def get_y(obj)
148
- return @y - obj.h if @left && obj.x + obj.w > @x + @w
149
- return @y + (1.0 * (@x + @w - obj.x - obj.w) * @h / @w) - obj.h if @left
150
- return @y - obj.h if obj.x < @x
151
- @y + (1.0 * (obj.x - @x) * @h / @w) - obj.h
158
+ return @y + (@inverted ? @h : -obj.h) if @left && obj.x + obj.w > @x + @w || !@left && obj.x < @x
159
+ offset = (@left ? @x + @w - obj.x - obj.w : obj.x - @x).to_f * @h / @w
160
+ @inverted ? @y + @h - offset : @y + offset - obj.h
152
161
  end
153
162
  end
154
163
 
@@ -340,11 +349,6 @@ module MiniGL
340
349
  @x += @speed.x
341
350
  @y += @speed.y
342
351
 
343
- # Keeping contact with ramp
344
- # if @speed.y == 0 and @speed.x.abs <= G.ramp_contact_threshold and @bottom.is_a? Ramp
345
- # @y = @bottom.get_y(self)
346
- # puts 'aqui'
347
- # end
348
352
  ramps.each do |r|
349
353
  r.check_intersection self
350
354
  end
data/test/game.rb CHANGED
@@ -32,11 +32,12 @@ class MyGame < GameWindow
32
32
  @ddl = DropDownList.new(0, 10, @font1, nil, nil, ['olá amigos', 'opção 2', 'terceira'], 0, 3, 150, 25, 0, 0x808080, 0xffffff, 0xffff00, nil, 2, 2.5, :north) { |a, b|
33
33
  puts "mudou de #{a} para #{b}"
34
34
  }
35
+ @btn2 = Button.new(x: 0, y: 80, font: @font1, text: 'Below', img: :btn, anchor: :north) { puts 'Below the dropdown' }
35
36
 
36
37
  @panel = Panel.new(10, 10, 720, 520, [
37
- Button.new(x: 5, y: 5, font: @font1, text: 'Teste', img: :btn),
38
+ TextField.new(x: 5, y: 5, font: @font1, text: 'Opa', img: :text, margin_x: 5, margin_y: 5, anchor: :top_left),
39
+ Button.new(x: 5, y: 5, font: @font1, text: 'Teste', img: :btn) { puts 'top left' },
38
40
  @lbl = Label.new(0, 70, @font1, 'Teste de label', 0, 0x666666, 1, 1, :north),
39
- TextField.new(x: 5, y: 40, font: @font1, text: 'Opa', img: :text, margin_x: 5, margin_y: 5, anchor: :top_left),
40
41
  Button.new(x: 0, y: 5, font: @font1, text: 'Teste', img: :btn, anchor: :top),
41
42
  DropDownList.new(x: 0, y: 40, width: 150, height: 25, font: @font1, options: ['olá amigos', 'opção 2', 'terceira'], anchor: :north),
42
43
  Button.new(x: 5, y: 5, font: @font1, text: 'Teste', img: :btn, anchor: :northeast),
@@ -44,7 +45,7 @@ class MyGame < GameWindow
44
45
  Button.new(x: 0, y: 0, font: @font1, text: 'Teste', img: :btn, anchor: :center),
45
46
  Button.new(x: 5, y: 0, font: @font1, text: 'Teste', img: :btn, anchor: :right),
46
47
  ToggleButton.new(x: 5, y: 40, img: :check, center_x: false, margin_x: 36, anchor: :east),
47
- Button.new(x: 5, y: 5, font: @font1, text: 'Teste', img: :btn, anchor: :southwest),
48
+ Button.new(x: 5, y: 5, font: @font1, text: 'Teste', img: :btn, anchor: :southwest) { @lbl.visible = !@lbl.visible },
48
49
  Button.new(x: 0, y: 5, font: @font1, text: 'Teste', img: :btn, anchor: :south),
49
50
  ProgressBar.new(0, 40, 200, 20, :barbg, :barfg, 3456, 70, 2, 2, @font1, 0xff000080, nil, nil, 1, 1, :bottom)
50
51
  ], :text, :tiled, true, 2, 2, :bottom_right)
@@ -80,7 +81,11 @@ class MyGame < GameWindow
80
81
  @panel.enabled = !@panel.enabled if KB.key_pressed? Gosu::KbN
81
82
  @panel.visible = !@panel.visible if KB.key_pressed? Gosu::KbM
82
83
 
83
- @panel.add_component(Button.new(x: 5, y: 5, font: @font1, text: 'Teste', img: :btn, anchor: :southeast)) if KB.key_pressed?(Gosu::KbB)
84
+ if KB.key_pressed?(Gosu::KbB)
85
+ @panel.add_component(Button.new(x: 5, y: 5, font: @font1, text: 'Teste', img: :btn, anchor: :southeast) {
86
+ puts 'new button added'
87
+ })
88
+ end
84
89
  @lbl.text = 'Test of changed text' if KB.key_pressed?(Gosu::KB_C)
85
90
  @lbl2.text = 'Shorter text' if KB.key_pressed?(Gosu::KB_X)
86
91
 
@@ -112,6 +117,7 @@ class MyGame < GameWindow
112
117
  @chk.update
113
118
  @txt.update
114
119
  @ddl.update
120
+ @btn2.update
115
121
 
116
122
  @panel.update
117
123
 
@@ -145,6 +151,7 @@ class MyGame < GameWindow
145
151
  780, 450, 300, :right, 0xff0000, 255, 1
146
152
 
147
153
  @ddl.draw 0x80, 1, 0xff8080
154
+ @btn2.draw
148
155
  @btn.draw 0xcc, 1, 0x33ff33
149
156
  @chk.draw
150
157
  @txt.draw
data/test/mov_game.rb CHANGED
@@ -13,7 +13,7 @@ class MyGame < GameWindow
13
13
  Block.new(0, 600, 800, 1, false),
14
14
  Block.new(-1, 0, 1, 600, false),
15
15
  Block.new(800, 0, 1, 600, false),
16
- Block.new(300, 430, 50, 50),
16
+ Block.new(300, 430, 250, 50),
17
17
  # Block.new(375, 550, 50, 50, true),
18
18
  # Block.new(150, 200, 20, 300, false),
19
19
  # Block.new(220, 300, 100, 20, true),
@@ -26,6 +26,12 @@ class MyGame < GameWindow
26
26
  Ramp.new(500, 500, 150, 100, true),
27
27
  Ramp.new(650, 300, 150, 200, true),
28
28
  Ramp.new(650, 500, 150, 100, true),
29
+ Ramp.new(0, 100, 100, 100, false, true),
30
+ Ramp.new(100, 0, 150, 100, false, true),
31
+ Ramp.new(700, 100, 100, 100, true, true),
32
+ Ramp.new(550, 0, 150, 100, true, true),
33
+ # Ramp.new(250, 250, 75, 75, false, true),
34
+ Ramp.new(525, 250, 75, 200, true, true),
29
35
  ]
30
36
 
31
37
  # @cycle = [Vector.new(100, 530), Vector.new(650, 500)]
@@ -67,9 +73,9 @@ class MyGame < GameWindow
67
73
  o.x, o.y + o.h, 0xffffffff, 0
68
74
  end
69
75
  @ramps.each do |r|
70
- draw_triangle r.left ? r.x + r.w : r.x, r.y, 0xffffffff,
71
- r.x + r.w, r.y + r.h, 0xffffffff,
72
- r.x, r.y + r.h, 0xffffffff, 0
76
+ draw_triangle r.left ? r.x + r.w : r.x, r.inverted ? r.y + r.h : r.y, 0xffffffff,
77
+ r.x + r.w, r.inverted ? r.y : r.y + r.h, 0xffffffff,
78
+ r.x, r.inverted ? r.y : r.y + r.h, 0xffffffff, 0
73
79
  end
74
80
  end
75
81
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minigl
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.3
4
+ version: 2.3.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: 2020-08-31 00:00:00.000000000 Z
11
+ date: 2021-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gosu
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.11'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0.11'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
27
33
  description: A minimal 2D Game Library built on top of the Gosu gem.
28
34
  email: victordavidsantos@gmail.com
29
35
  executables: []
@@ -84,7 +90,7 @@ require_paths:
84
90
  - lib
85
91
  required_ruby_version: !ruby/object:Gem::Requirement
86
92
  requirements:
87
- - - "~>"
93
+ - - ">="
88
94
  - !ruby/object:Gem::Version
89
95
  version: '2.0'
90
96
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -93,42 +99,42 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
99
  - !ruby/object:Gem::Version
94
100
  version: '0'
95
101
  requirements: []
96
- rubygems_version: 3.1.2
102
+ rubygems_version: 3.2.15
97
103
  signing_key:
98
104
  specification_version: 4
99
105
  summary: MiniGL
100
106
  test_files:
101
- - test/vector_tests.rb
102
- - test/res_tests.rb
107
+ - test/game.rb
108
+ - test/game_object_tests.rb
109
+ - test/iso_game.rb
110
+ - test/map_tests.rb
103
111
  - test/mov_game.rb
104
112
  - test/movement_tests.rb
105
- - test/map_tests.rb
106
- - test/iso_game.rb
107
- - test/game_object_tests.rb
108
- - test/game.rb
113
+ - test/res_tests.rb
114
+ - test/vector_tests.rb
109
115
  - test/test.png
110
- - test/data/tileset/tileset1.png
111
116
  - test/data/font/font1.ttf
112
- - test/data/sound/1.wav
113
- - test/data/img/check.png
114
- - test/data/img/square.svg
115
- - test/data/img/tile2.svg
117
+ - test/data/img/barbg.png
118
+ - test/data/img/barbg.svg
116
119
  - test/data/img/barfg.png
117
- - test/data/img/tile2.png
118
- - test/data/img/tile1.svg
119
- - test/data/img/square3.svg
120
- - test/data/img/text.png
121
- - test/data/img/square2.svg
120
+ - test/data/img/barfg.svg
121
+ - test/data/img/btn.png
122
+ - test/data/img/check.png
122
123
  - test/data/img/image.png
123
124
  - test/data/img/img1.png
124
- - test/data/img/square2.png
125
- - test/data/img/barbg.svg
126
- - test/data/img/barfg.svg
127
- - test/data/img/tile1b.png
128
- - test/data/img/barbg.png
129
125
  - test/data/img/square.png
130
- - test/data/img/btn.png
126
+ - test/data/img/square.svg
127
+ - test/data/img/square2.png
128
+ - test/data/img/square2.svg
131
129
  - test/data/img/square3.png
132
- - test/data/img/tile2b.png
130
+ - test/data/img/square3.svg
131
+ - test/data/img/text.png
133
132
  - test/data/img/tile1.png
133
+ - test/data/img/tile1.svg
134
+ - test/data/img/tile1b.png
135
+ - test/data/img/tile2.png
136
+ - test/data/img/tile2.svg
137
+ - test/data/img/tile2b.png
138
+ - test/data/sound/1.wav
139
+ - test/data/tileset/tileset1.png
134
140
  - test/data/img/sub/image.png