summaryrefslogtreecommitdiffhomepage
path: root/test/render.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/render.rb')
-rw-r--r--test/render.rb92
1 files changed, 65 insertions, 27 deletions
diff --git a/test/render.rb b/test/render.rb
index 909227a..47667f0 100644
--- a/test/render.rb
+++ b/test/render.rb
@@ -1,38 +1,76 @@
require 'ruby2d'
-set width: 1280, height: 770
+# 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
+Quad.new(x3: 125, x4: 25)
+Rectangle.new(y: 125)
+Square.new(y: 250)
+Line.new(x1: 5, y1: 375, x2: 95, y2: 475, width: 5)
+Triangle.new(x1: 325, y1: 0, x2: 375, y2: 100, x3: 275, y3: 100)
+Circle.new(x: 400, y: 175)
-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
+ Quad.draw(
+ x1: 125, y1: 0,
+ x2: 225, y2: 0,
+ x3: 250, y3: 100,
+ x4: 150, y4: 100,
+ color: [
+ [0.8, 0.3, 0.7, 0.8],
+ [0.1, 0.9, 0.1, 1.0],
+ [0.8, 0.5, 0.8, 1.0],
+ [0.6, 0.4, 0.1, 1.0]
+ ]
+ )
+
+ Rectangle.draw(
+ x: 225, y: 125, width: 100, height: 100,
+ color: [
+ [0.8, 0.3, 0.7, 0.8],
+ [0.1, 0.9, 0.1, 1.0],
+ [0.8, 0.5, 0.8, 1.0],
+ [0.6, 0.4, 0.1, 1.0]
+ ]
+ )
+
+ Square.draw(
+ x: 125, y: 250, size: 100,
+ color: [
+ [0.8, 0.3, 0.7, 0.8],
+ [0.1, 0.9, 0.1, 1.0],
+ [0.8, 0.5, 0.8, 1.0],
+ [0.6, 0.4, 0.1, 1.0]
+ ]
+ )
+
+ Line.draw(
+ x1: 130, y1: 375, x2: 220, y2: 475, width: 5,
+ color: [
+ [0.8, 0.3, 0.7, 0.8],
+ [0.1, 0.9, 0.1, 1.0],
+ [0.8, 0.5, 0.8, 1.0],
+ [0.6, 0.4, 0.1, 1.0]
+ ]
+ )
+
+ Triangle.draw(
+ x1: 450, y1: 0, x2: 500, y2: 100, x3: 400, y3: 100,
+ color: [
+ [0.8, 0.3, 0.7, 0.8],
+ [0.1, 0.9, 0.1, 1.0],
+ [0.8, 0.5, 0.8, 1.0]
+ ]
+ )
+
+ Pixel.draw(x: 550, y: 50, size: 10, color: [1.0, 0.0, 0.0, 1.0])
+
+ Circle.draw(
+ x: 525, y: 175, radius: 50, sectors: 30,
+ color: [0.8, 0.3, 0.7, 0.8]
+ )
end