summaryrefslogtreecommitdiffhomepage
path: root/test/triangle.rb
diff options
context:
space:
mode:
authorTom Black <[email protected]>2018-12-11 23:34:37 -0800
committerTom Black <[email protected]>2021-04-12 11:30:39 -0500
commit31d4065684102b18b619c7e1f4496a97ed15e806 (patch)
treef048b54279f70ca1df20180d4b075890b25ebce4 /test/triangle.rb
parentbd45d89611aff095a65e22b64a3eb987bdda51b1 (diff)
downloadruby2d-31d4065684102b18b619c7e1f4496a97ed15e806.tar.gz
ruby2d-31d4065684102b18b619c7e1f4496a97ed15e806.zip
Create direct draw class methods
Diffstat (limited to 'test/triangle.rb')
-rw-r--r--test/triangle.rb64
1 files changed, 56 insertions, 8 deletions
diff --git a/test/triangle.rb b/test/triangle.rb
index df5cad0..b45e03e 100644
--- a/test/triangle.rb
+++ b/test/triangle.rb
@@ -1,12 +1,60 @@
require 'ruby2d'
-set title: "Hello Triangle"
-
-Triangle.new(
- x1: 320, y1: 50,
- x2: 540, y2: 430,
- x3: 100, y3: 430,
- color: ['red', 'green', 'blue']
-)
+# set title: "Hello Triangle"
+#
+# Triangle.new(
+# x1: 320, y1: 50,
+# x2: 540, y2: 430,
+# x3: 100, y3: 430,
+# color: ['red', 'green', 'blue']
+# )
+
+set width: 1280, height: 770
+
+# # Runs at 6 fps
+# 120.times do |i|
+# 160.times do |j|
+# s = Square.new(x: j*10, y: i*10, size: 10, color: 'random')
+# end
+# end
+
+# Runs at 11 fps
+# 128.times do |i|
+# 77.times do |j|
+# s = Square.new(x: i*10, y: j*10, size: 10, color: 'random')
+# end
+# end
+
+fps = Text.new 'fps'
+
+update do
+ fps.text = Window.fps
+end
+
+render do
+# # 120.times do |i|
+# # 160.times do |j|
+# # Quad.draw(j*10, i*10)
+# # end
+# # end
+#
+# # 19200.times do
+# # Quad.draw(0, 0)
+# # end
+#
+# 120.times do |i|
+# 20.times do |j|
+# Quad.draw(j*10, i*10 + 20, rand)
+# end
+# end
+#
+
+ 128.times do |i|
+ 77.times do |j|
+ Quad.draw(i*10, j*10 + 20, rand)
+ end
+ end
+
+end
show