diff tests/test_resources.nim @ 674:496b328faa43

add: resource packaging and loading for different resource types, simplify build commands, update readme
author Sam <sam@basx.dev>
date Wed, 10 May 2023 22:36:59 +0700
parents a02d503ffa53
children 5f6d3511ef79
line wrap: on
line diff
--- a/tests/test_resources.nim	Tue May 09 20:39:49 2023 +0700
+++ b/tests/test_resources.nim	Wed May 10 22:36:59 2023 +0700
@@ -3,30 +3,12 @@
 import semicongine
 
 proc main() =
-  var scene = newScene("main", root=newEntity("rect", rect()))
-  var engine = initEngine("Test materials")
-  const
-    vertexInput = @[
-      attr[Vec3f]("position", memoryPerformanceHint=PreferFastRead),
-    ]
-    fragOutput = @[attr[Vec4f]("color")]
-    vertexCode = compileGlslShader(
-      stage=VK_SHADER_STAGE_VERTEX_BIT,
-      inputs=vertexInput,
-      main="""gl_Position = vec4(position, 1.0);"""
-    )
-    fragmentCode = compileGlslShader(
-      stage=VK_SHADER_STAGE_FRAGMENT_BIT,
-      outputs=fragOutput,
-      main="""color = vec4(1, 0, 0, 1);"""
-    )
-  engine.setRenderer(engine.gpuDevice.simpleForwardRenderPass(vertexCode, fragmentCode))
-  engine.addScene(scene, vertexInput)
-  var t = cpuTime()
-  while engine.updateInputs() == Running and not engine.keyIsDown(Escape):
-    engine.renderScene(scene)
-  engine.destroy()
-
+  echo "Mods available: ", modList()
+  for modName in modList():
+    echo modName, ":"
+    selectedMod = modName
+    for i in walkResources():
+      echo "  ", i, ": ", loadResource(i)[]
 
 when isMainModule:
   main()