Mercurial > games > semicongine
comparison 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 |
comparison
equal
deleted
inserted
replaced
301:bf5982802e2c | 302:da0bd61abe91 |
---|---|
17 | 17 |
18 when isMainModule: | 18 when isMainModule: |
19 var myengine = initEngine("Pong") | 19 var myengine = initEngine("Pong") |
20 level = newScene("scene", newEntity("Level")) | 20 level = newScene("scene", newEntity("Level")) |
21 var playerbarmesh = rect(color=barcolor) | 21 var playerbarmesh = rect(color=barcolor) |
22 var playerbar = newEntity("playerbar", playerbarmesh) | 22 var playerbar = newEntity("playerbar", {"mesh": Component(playerbarmesh)}) |
23 playerbar.transform = scale3d(barWidth, barSize, 1'f) * translate3d(0.5'f, 0'f, 0'f) | 23 playerbar.transform = scale3d(barWidth, barSize, 1'f) * translate3d(0.5'f, 0'f, 0'f) |
24 var player = newEntity("player", playerbar) | 24 var player = newEntity("player", [], playerbar) |
25 player.transform = translate3d(0'f, 0.3'f, 0'f) | 25 player.transform = translate3d(0'f, 0.3'f, 0'f) |
26 level.root.add player | 26 level.root.add player |
27 | 27 |
28 var ballmesh = circle(color=ballcolor) | 28 var ballmesh = circle(color=ballcolor) |
29 var ball = newEntity("ball", ballmesh) | 29 var ball = newEntity("ball", {"mesh": Component(ballmesh)}) |
30 ball.transform = scale3d(ballSize, ballSize, 1'f) * translate3d(10'f, 10'f, 0'f) | 30 ball.transform = scale3d(ballSize, ballSize, 1'f) * translate3d(10'f, 10'f, 0'f) |
31 level.root.add ball | 31 level.root.add ball |
32 | 32 |
33 const | 33 const |
34 vertexInput = @[ | 34 vertexInput = @[ |