From 3d6ca447a7104c499e92fc954affdaf4bf011388 Mon Sep 17 00:00:00 2001 From: Frederico Linhares Date: Fri, 16 Sep 2022 12:03:04 -0300 Subject: feat Create View --- test/config/init.yaml | 3 --- test/src/main.rb | 12 +++++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/config/init.yaml b/test/config/init.yaml index 2139b75..0a7fdcf 100644 --- a/test/config/init.yaml +++ b/test/config/init.yaml @@ -1,7 +1,4 @@ name: "Candy Gear Test" -game: - width: 640 - height: 360 screen: width: 1280 height: 720 diff --git a/test/src/main.rb b/test/src/main.rb index f5c0676..67ef80c 100644 --- a/test/src/main.rb +++ b/test/src/main.rb @@ -35,8 +35,14 @@ def init() $camera_position = CandyGear::Vector3D.new(0.0, 0.0, 0.0); $camera_rotation = CandyGear::Rotation3D.new(0.0, 0.0, 0.0); - CandyGear.camera_position = $camera_position; - CandyGear.camera_rotation = $camera_rotation; + + color = CandyGear::Vector3D.new(0.12, 0.12, 0.18); + $view1 = CandyGear::View.new(CandyGear::Vector4D.new(0, 0, 1280, 360)); + $view2 = CandyGear::View.new(CandyGear::Vector4D.new(0, 360, 1280, 360)); + CandyGear.views = [$view1, $view2]; + + $view1.camera_position = $camera_position; + $view1.camera_rotation = $camera_rotation; end def key_down(key) @@ -70,7 +76,7 @@ end def quit() = CandyGear.quit(); def tick() - $sprite.draw($sprite_position); + $sprite.draw($view2, $sprite_position); $instances_rotation.rotate(0.0, BOX_ROTATION_SPEED); $instances.each do |i| $model.draw(i, $instances_rotation); -- cgit v1.2.3