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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe63f06c363f79203302cc314c1ae3574a18dbcf85ade8e0a0e357fdc6d29320
|
4
|
+
data.tar.gz: 748e4620a90dbbb2ce472e976b9330cee28bcbc3e3545e06dc204adead63beaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f19e7aa2e40e91756da69843eb7821b613dc624914447054a10ac22fb0723043fb644740ab408c73620c36370146d6b0faf65c75cf1a1f4ae7cc1ff1ea2c7b1f
|
7
|
+
data.tar.gz: 2ed37524409aa8662c86a003d56a430b7f853d76742c969aa8a1d46d30da1f78518d632c178bfaa8f4b931cf53117b69c3b4d5e501aca500333046af7d07af6c
|
@@ -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
|
data/lib/gosu_more_drawables.rb
CHANGED
@@ -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
|
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.
|
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-
|
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
|