# HG changeset patch # User Sam # Date 1682159682 -25200 # Node ID 29f0109c5222bf5f011ff249d2a95fedd941b320 # Parent 34112bf5abf8446416e49faf0e3f42b1f4a88f90 add: some helper functions diff -r 34112bf5abf8 -r 29f0109c5222 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 34112bf5abf8 -r 29f0109c5222 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: