summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--test/render.rb39
-rw-r--r--test/triangle.rb64
2 files changed, 47 insertions, 56 deletions
diff --git a/test/render.rb b/test/render.rb
new file mode 100644
index 0000000..909227a
--- /dev/null
+++ b/test/render.rb
@@ -0,0 +1,39 @@
+require 'ruby2d'
+
+set width: 1280, height: 770
+
+# # 9,600 objects, Runs at 11 fps (30 with VBO)
+# 128.times do |i|
+# 75.times do |j|
+# Square.new(x: i*10, y: j*10 + 20, size: 10, color: 'random')
+# end
+# end
+
+# # Runs at 27 fps and takes about 6 seconds to start up
+# 10000.times do
+# Quad.new(x1: 50, y1: 50)
+# end
+
+fps = Text.new 'fps'
+
+update do
+ fps.text = Window.fps
+end
+
+render do
+
+ # 9,600 objects, runs at 60 fps
+ 128.times do |i|
+ 75.times do |j|
+ Quad.draw(i*10, j*10 + 20, rand)
+ end
+ end
+
+ # # Runs at 60 fps, max objects before dip
+ # 50000.times do
+ # Quad.draw(50, 50, 1)
+ # end
+
+end
+
+show
diff --git a/test/triangle.rb b/test/triangle.rb
index b45e03e..df5cad0 100644
--- a/test/triangle.rb
+++ b/test/triangle.rb
@@ -1,60 +1,12 @@
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 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
+set title: "Hello Triangle"
+
+Triangle.new(
+ x1: 320, y1: 50,
+ x2: 540, y2: 430,
+ x3: 100, y3: 430,
+ color: ['red', 'green', 'blue']
+)
show