changeset 859:a55410a08c63

add: better api for fullscreen management
author sam <sam@basx.dev>
date Wed, 27 Dec 2023 14:29:15 +0700
parents 869cecde0a22
children 3586266ba74e
files semicongine/engine.nim
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/semicongine/engine.nim	Tue Dec 26 21:12:14 2023 +0700
+++ b/semicongine/engine.nim	Wed Dec 27 14:29:15 2023 +0700
@@ -45,6 +45,7 @@
     exitHandler: proc(engine: var Engine)
     resizeHandler: proc(engine: var Engine)
     eventHandler: proc(engine: var Engine, event: Event)
+    fullscreen: bool
 
 
 proc destroy*(engine: var Engine) =
@@ -207,4 +208,7 @@
 func windowWasResized*(engine: Engine): auto = engine.input.windowWasResized
 func showSystemCursor*(engine: Engine) = engine.window.showSystemCursor()
 func hideSystemCursor*(engine: Engine) = engine.window.hideSystemCursor()
-proc fullscreen*(engine: var Engine, enable: bool) = engine.window.fullscreen(enable)
+func fullscreen*(engine: Engine): bool = engine.fullscreen
+proc `fullscreen=`*(engine: var Engine, enable: bool) =
+  engine.fullscreen = enable
+  engine.window.fullscreen(engine.fullscreen)