diff examples/E10_pong.nim @ 302:da0bd61abe91

did: change API for ECS
author Sam <sam@basx.dev>
date Tue, 27 Jun 2023 00:17:40 +0700
parents 95281f2db400
children b145a05c2459
line wrap: on
line diff
--- a/examples/E10_pong.nim	Tue Jun 27 00:01:36 2023 +0700
+++ b/examples/E10_pong.nim	Tue Jun 27 00:17:40 2023 +0700
@@ -19,14 +19,14 @@
   var myengine = initEngine("Pong")
   level = newScene("scene", newEntity("Level"))
   var playerbarmesh = rect(color=barcolor)
-  var playerbar = newEntity("playerbar", playerbarmesh)
+  var playerbar = newEntity("playerbar", {"mesh": Component(playerbarmesh)})
   playerbar.transform = scale3d(barWidth, barSize, 1'f) * translate3d(0.5'f, 0'f, 0'f)
-  var player = newEntity("player", playerbar)
+  var player = newEntity("player", [], playerbar)
   player.transform = translate3d(0'f, 0.3'f, 0'f)
   level.root.add player
 
   var ballmesh = circle(color=ballcolor)
-  var ball = newEntity("ball", ballmesh)
+  var ball = newEntity("ball", {"mesh": Component(ballmesh)})
   ball.transform = scale3d(ballSize, ballSize, 1'f) * translate3d(10'f, 10'f, 0'f)
   level.root.add ball