Mercurial > games > semicongine
changeset 1009:8b0a91fa2210
add: better error messages
author | sam <sam@basx.dev> |
---|---|
date | Tue, 16 Apr 2024 00:47:01 +0700 |
parents | 443e8090614c |
children | 34be258400a6 |
files | semicongine/engine.nim semicongine/renderer.nim |
diffstat | 2 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/semicongine/engine.nim Tue Apr 16 00:36:39 2024 +0700 +++ b/semicongine/engine.nim Tue Apr 16 00:47:01 2024 +0700 @@ -182,7 +182,8 @@ proc renderScene*(engine: var Engine, scene: var Scene) = assert engine.state == Running - assert engine.renderer.isSome + assert engine.renderer.isSome, "Renderer has not yet been initialized, call 'engine.initRenderer' first" + assert engine.renderer.get.hasScene(scene), &"Scene '{scene.name}' has not been loaded yet" let t0 = getMonoTime() engine.renderer.get.startNewFrame()
--- a/semicongine/renderer.nim Tue Apr 16 00:36:39 2024 +0700 +++ b/semicongine/renderer.nim Tue Apr 16 00:47:01 2024 +0700 @@ -49,6 +49,9 @@ proc currentFrameCommandBuffer(renderer: Renderer): VkCommandBuffer = renderer.commandBufferPool.buffers[renderer.swapchain.currentInFlight] +proc hasScene*(renderer: Renderer, scene: Scene): bool = + scene in renderer.scenedata + proc initRenderer*( device: Device, shaders: openArray[(MaterialType, ShaderConfiguration)],