gosu_more_drawables 0.2.3 → 0.3.0

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: fe43ec2d12a661b9733a13c8fa19fdf98c6922ffc61bbb743585e4f3421c0bd4
4
- data.tar.gz: 4fb4ace0322049b2e467fad3cca63fa625c6d5bf4a5d1242b7d8d5c5ebec71c6
3
+ metadata.gz: fe63f06c363f79203302cc314c1ae3574a18dbcf85ade8e0a0e357fdc6d29320
4
+ data.tar.gz: 748e4620a90dbbb2ce472e976b9330cee28bcbc3e3545e06dc204adead63beaf
5
5
  SHA512:
6
- metadata.gz: 1db976e5668d8552254d237d765283e4dde40a7140275091d68c74bd6c3c1cffefa2484f51c5b178dd93c4a070795ead16065c8e92501f3315fadc9eb9b31098
7
- data.tar.gz: 96e47b8998db6c3d93548c07bf351e9a4d03b6245dcc5d7e4432353fa36b939b5c01634fd462c89ebda44c7fa26dfb624c498c86cd74978a12b3254250633e7e
6
+ metadata.gz: f19e7aa2e40e91756da69843eb7821b613dc624914447054a10ac22fb0723043fb644740ab408c73620c36370146d6b0faf65c75cf1a1f4ae7cc1ff1ea2c7b1f
7
+ data.tar.gz: 2ed37524409aa8662c86a003d56a430b7f853d76742c969aa8a1d46d30da1f78518d632c178bfaa8f4b931cf53117b69c3b4d5e501aca500333046af7d07af6c
@@ -12,4 +12,4 @@ class DemoWindow < Gosu::Window
12
12
  end
13
13
  end
14
14
 
15
- DemoWindow.new.show
15
+ DemoWindow.new.show
@@ -0,0 +1,33 @@
1
+ require "gosu"
2
+ require "gosu_more_drawables"
3
+
4
+ class DemoWindow < Gosu::Window
5
+ def initialize
6
+ super(500, 500, false)
7
+
8
+ @nodes = []
9
+ end
10
+
11
+ def draw
12
+ sine = Math.sin(Gosu.milliseconds / 1000.0)
13
+ c = (255 * sine).to_i.clamp(10, 255)
14
+ color = Gosu::Color.rgb(c, 255, c / 2)
15
+
16
+ Gosu.draw_path(@nodes, color)
17
+
18
+ @nodes.each do |node|
19
+ Gosu.draw_circle(node.x, node.y, 4, 4, color)
20
+ end
21
+ end
22
+
23
+ def update
24
+ x = 20
25
+ @nodes.clear
26
+ 20.times do |i|
27
+ @nodes << Gosu::PathNode.new(x + i, Math.cos(Gosu.milliseconds / 100.0 + i.to_f) * 10 + self.height / 2)
28
+ x += 20
29
+ end
30
+ end
31
+ end
32
+
33
+ DemoWindow.new.show
@@ -1,3 +1,4 @@
1
1
  require_relative "gosu_more_drawables/draw_arc"
2
+ require_relative "gosu_more_drawables/draw_path"
2
3
  require_relative "gosu_more_drawables/draw_circle"
3
4
  require_relative "gosu_more_drawables/version"
@@ -0,0 +1,17 @@
1
+ module Gosu
2
+ PathNode = Struct.new(:x, :y)
3
+
4
+ def self.draw_path(nodes, color = Gosu::Color::WHITE, z = 0, mode = :default)
5
+ last_node = nodes.first
6
+
7
+ nodes[1..nodes.size - 1].each do |current_node|
8
+ Gosu.draw_line(
9
+ last_node.x, last_node.y, color,
10
+ current_node.x, current_node.y, color,
11
+ z, mode
12
+ )
13
+
14
+ last_node = current_node
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module GosuMoreDrawables
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gosu_more_drawables
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyberarm
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-26 00:00:00.000000000 Z
11
+ date: 2020-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,10 +67,12 @@ files:
67
67
  - bin/console
68
68
  - bin/setup
69
69
  - examples/circle_with_arc_border.rb
70
+ - examples/path_with_circles.rb
70
71
  - gosu_more_drawables.gemspec
71
72
  - lib/gosu_more_drawables.rb
72
73
  - lib/gosu_more_drawables/draw_arc.rb
73
74
  - lib/gosu_more_drawables/draw_circle.rb
75
+ - lib/gosu_more_drawables/draw_path.rb
74
76
  - lib/gosu_more_drawables/version.rb
75
77
  - media/screenshot.png
76
78
  homepage: https://github.com/cyberarm/gosu_more_drawables