Mercurial > games > semicongine
comparison examples/E10_pong.nim @ 626:bf2f4a9cd962
add: option to show/hide cursor
author | Sam <sam@basx.dev> |
---|---|
date | Sat, 29 Apr 2023 21:38:52 +0700 |
parents | c48ceb622b27 |
children | 5b0e27e448cb |
comparison
equal
deleted
inserted
replaced
625:c48ceb622b27 | 626:bf2f4a9cd962 |
---|---|
64 var | 64 var |
65 winsize = myengine.getWindow().size | 65 winsize = myengine.getWindow().size |
66 height = float32(winsize[1]) / float32(winsize[0]) | 66 height = float32(winsize[1]) / float32(winsize[0]) |
67 width = 1'f | 67 width = 1'f |
68 currentTime = cpuTime() | 68 currentTime = cpuTime() |
69 showSystemCursor = true | |
69 while myengine.updateInputs() == Running and not myengine.keyWasPressed(Escape): | 70 while myengine.updateInputs() == Running and not myengine.keyWasPressed(Escape): |
71 if myengine.keyWasPressed(C): | |
72 if showSystemCursor: | |
73 myengine.hideSystemCursor() | |
74 else: | |
75 myengine.showSystemCursor() | |
76 showSystemCursor = not showSystemCursor | |
77 | |
70 let dt: float32 = cpuTime() - currentTime | 78 let dt: float32 = cpuTime() - currentTime |
71 currentTime = cpuTime() | 79 currentTime = cpuTime() |
72 if myengine.windowWasResized(): | 80 if myengine.windowWasResized(): |
73 winsize = myengine.getWindow().size | 81 winsize = myengine.getWindow().size |
74 height = float32(winsize[1]) / float32(winsize[0]) | 82 height = float32(winsize[1]) / float32(winsize[0]) |