Mercurial > games > semicongine
diff examples/E10_pong.nim @ 166:5b0e27e448cb
add: support for showing/hiding cursur, X11 fullscreen (win32 still missing)
author | Sam <sam@basx.dev> |
---|---|
date | Sun, 30 Apr 2023 01:02:33 +0700 |
parents | 0644308904da |
children | 84fd522fdf3f |
line wrap: on
line diff
--- a/examples/E10_pong.nim Sat Apr 29 21:38:52 2023 +0700 +++ b/examples/E10_pong.nim Sun Apr 30 01:02:33 2023 +0700 @@ -67,13 +67,17 @@ width = 1'f currentTime = cpuTime() showSystemCursor = true - while myengine.updateInputs() == Running and not myengine.keyWasPressed(Escape): + fullscreen = false + while myengine.updateInputs() == Running and not myengine.keyIsDown(Escape): if myengine.keyWasPressed(C): if showSystemCursor: myengine.hideSystemCursor() else: myengine.showSystemCursor() showSystemCursor = not showSystemCursor + if myengine.keyWasPressed(F): + fullscreen = not fullscreen + myengine.fullscreen(fullscreen) let dt: float32 = cpuTime() - currentTime currentTime = cpuTime() @@ -97,7 +101,8 @@ # loose if ball.transform.col(3).x - ballSize/2 <= 0: - break + ball.transform = scale3d(ballSize, ballSize, 1'f) * translate3d(30'f, 30'f, 0'f) + ballVelocity = newVec2f(1, 1).normalized * ballSpeed # bar if ball.transform.col(3).x - ballSize/2 <= barWidth: