# HG changeset patch # User Sam # Date 1682159682 -25200 # Node ID 7e54bbbcffba5ec4e28a0ecda835b475c4a1e7bc # Parent 177bfb85adb1f4c3d936ca530b4c59b790c27499 add: some helper functions diff -r 177bfb85adb1 -r 7e54bbbcffba src/semicongine/engine.nim --- a/src/semicongine/engine.nim Sat Apr 22 16:52:55 2023 +0700 +++ b/src/semicongine/engine.nim Sat Apr 22 17:34:42 2023 +0700 @@ -90,6 +90,7 @@ engine.renderer.setupDrawableBuffers(entity, vertexInput) proc renderScene*(engine: var Engine, entity: Entity) = + assert engine.renderer.valid if engine.running: engine.renderer.render(entity) @@ -144,3 +145,4 @@ func eventsProcessed*(engine: Engine): auto = engine.input.eventsProcessed func framesRendered*(engine: Engine): auto = engine.renderer.framesRendered func gpuDevice*(engine: Engine): Device = engine.device +func getWindow*(engine: Engine): auto = engine.window diff -r 177bfb85adb1 -r 7e54bbbcffba src/semicongine/renderer.nim --- a/src/semicongine/renderer.nim Sat Apr 22 16:52:55 2023 +0700 +++ b/src/semicongine/renderer.nim Sat Apr 22 17:34:42 2023 +0700 @@ -181,6 +181,9 @@ func framesRendered*(renderer: Renderer): uint64 = renderer.swapchain.framesRendered +func valid*(renderer: Renderer): bool = + renderer.device.vk.valid + proc destroy*(renderer: var Renderer) = for data in renderer.scenedata.mvalues: for buffer in data.vertexBuffers.mvalues: