Mercurial > games > semicongine
comparison examples/E10_pong.nim @ 248:952428f04ffc
did: few fixes
author | Sam <sam@basx.dev> |
---|---|
date | Tue, 23 May 2023 16:24:15 +0700 |
parents | f3912838cd69 |
children | ad078e26a1c7 |
comparison
equal
deleted
inserted
replaced
247:beb41c93aa3f | 248:952428f04ffc |
---|---|
81 currentTime = cpuTime() | 81 currentTime = cpuTime() |
82 if myengine.windowWasResized(): | 82 if myengine.windowWasResized(): |
83 winsize = myengine.getWindow().size | 83 winsize = myengine.getWindow().size |
84 height = float32(winsize[1]) / float32(winsize[0]) | 84 height = float32(winsize[1]) / float32(winsize[0]) |
85 width = 1'f | 85 width = 1'f |
86 setShaderGlobal(level, "projection", ortho[float32](0'f, width, 0'f, height, 0'f, 1'f)) | 86 setShaderGlobal(level, "projection", ortho(0, width, 0, height, 0, 1)) |
87 var player = level.root.firstWithName("player") | 87 var player = level.root.firstWithName("player") |
88 if myengine.keyIsDown(Down) and (player.transform.col(3).y + barSize/2) < height: | 88 if myengine.keyIsDown(Down) and (player.transform.col(3).y + barSize/2) < height: |
89 player.transform = player.transform * translate3d(0'f, 1'f * dt, 0'f) | 89 player.transform = player.transform * translate3d(0'f, 1'f * dt, 0'f) |
90 if myengine.keyIsDown(Up) and (player.transform.col(3).y - barSize/2) > 0: | 90 if myengine.keyIsDown(Up) and (player.transform.col(3).y - barSize/2) > 0: |
91 player.transform = player.transform * translate3d(0'f, -1'f * dt, 0'f) | 91 player.transform = player.transform * translate3d(0'f, -1'f * dt, 0'f) |