diff 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
line wrap: on
line diff
--- a/examples/E10_pong.nim	Sat Apr 29 05:40:11 2023 -0700
+++ b/examples/E10_pong.nim	Sat Apr 29 21:38:52 2023 +0700
@@ -66,7 +66,15 @@
     height = float32(winsize[1]) / float32(winsize[0])
     width = 1'f
     currentTime = cpuTime()
+    showSystemCursor = true
   while myengine.updateInputs() == Running and not myengine.keyWasPressed(Escape):
+    if myengine.keyWasPressed(C):
+      if showSystemCursor:
+        myengine.hideSystemCursor()
+      else:
+        myengine.showSystemCursor()
+      showSystemCursor = not showSystemCursor
+
     let dt: float32 = cpuTime() - currentTime
     currentTime = cpuTime()
     if myengine.windowWasResized():