diff tests/test_text.nim @ 1281:c09cdff9a97e

merge
author sam <sam@basx.dev>
date Mon, 29 Jul 2024 15:53:03 +0700
parents 4cf9872f7bb6
children 3308b88e53a6
line wrap: on
line diff
--- a/tests/test_text.nim	Mon Jul 29 15:49:37 2024 +0700
+++ b/tests/test_text.nim	Mon Jul 29 15:53:03 2024 +0700
@@ -20,7 +20,7 @@
     pipeline.descriptorSetLayouts[0],
     font,
     "Hello semicongine!",
-    color = NewVec4f(1, 1, 1, 1),
+    color = vec4(1, 1, 1, 1),
     scale = 0.0005,
   )
 
@@ -28,7 +28,7 @@
   while ((getMonoTime() - start).inMilliseconds().int / 1000) < time:
     label1.Refresh()
     WithNextFrame(framebuffer, commandbuffer):
-      WithRenderPass(vulkan.swapchain.renderPass, framebuffer, commandbuffer, vulkan.swapchain.width, vulkan.swapchain.height, NewVec4f(0, 0, 0, 0)):
+      WithRenderPass(vulkan.swapchain.renderPass, framebuffer, commandbuffer, vulkan.swapchain.width, vulkan.swapchain.height, vec4(0, 0, 0, 0)):
         WithPipeline(commandbuffer, pipeline):
           Render(label1, commandbuffer, pipeline)
 
@@ -51,27 +51,27 @@
       pipeline.descriptorSetLayouts[0],
       font1,
       "  0",
-      color = NewVec4f(0, 1, 1, 1),
+      color = vec4(0, 1, 1, 1),
       scale = 0.004,
-      position = NewVec3f(-0.3, 0.5)
+      position = vec3(-0.3, 0.5)
     ),
     InitTextbox(
       renderdata,
       pipeline.descriptorSetLayouts[0],
       font2,
       "  1",
-      color = NewVec4f(1, 0, 1, 1),
+      color = vec4(1, 0, 1, 1),
       scale = 0.001,
-      position = NewVec3f(0, 0)
+      position = vec3(0, 0)
     ),
     InitTextbox(
       renderdata,
       pipeline.descriptorSetLayouts[0],
       font3,
       "  2",
-      color = NewVec4f(1, 1, 0, 1),
+      color = vec4(1, 1, 0, 1),
       scale = 0.001,
-      position = NewVec3f(0.3, -0.5)
+      position = vec3(0.3, -0.5)
     )
   ]
 
@@ -84,12 +84,12 @@
       c[i] = progress
       labels[i].Color = c
       labels[i].Scale = labels[i].Scale * (1.0 + (i + 1).float * 0.001)
-      labels[i].Position = labels[i].Position + NewVec3f(0.001 * (i.float - 1'f))
+      labels[i].Position = labels[i].Position + vec3(0.001 * (i.float - 1'f))
       labels[i].text = $(p + i)
       labels[i].Refresh()
     inc p
     WithNextFrame(framebuffer, commandbuffer):
-      WithRenderPass(vulkan.swapchain.renderPass, framebuffer, commandbuffer, vulkan.swapchain.width, vulkan.swapchain.height, NewVec4f(0, 0, 0, 0)):
+      WithRenderPass(vulkan.swapchain.renderPass, framebuffer, commandbuffer, vulkan.swapchain.width, vulkan.swapchain.height, vec4(0, 0, 0, 0)):
         WithPipeline(commandbuffer, pipeline):
           for label in labels:
             Render(label, commandbuffer, pipeline)
@@ -113,9 +113,9 @@
       pipeline.descriptorSetLayouts[0],
       font,
       $horizontal & " aligned",
-      color = NewVec4f(1, 1, 1, 1),
+      color = vec4(1, 1, 1, 1),
       scale = 0.001,
-      position = NewVec3f(0, 0.9 - (horizontal.float * 0.15)),
+      position = vec3(0, 0.9 - (horizontal.float * 0.15)),
       horizontalAlignment = horizontal,
     )
   for vertical in VerticalAlignment:
@@ -124,9 +124,9 @@
       pipeline.descriptorSetLayouts[0],
       font,
       $vertical & " aligned",
-      color = NewVec4f(1, 1, 1, 1),
+      color = vec4(1, 1, 1, 1),
       scale = 0.001,
-      position = NewVec3f(-0.35 + (vertical.float * 0.35), 0.3),
+      position = vec3(-0.35 + (vertical.float * 0.35), 0.3),
       verticalAlignment = vertical,
     )
   labels.add InitTextbox(
@@ -138,9 +138,9 @@
 
 It should display with some space above and have a pleasing appearance overall! :)""",
     maxWidth = 0.6,
-    color = NewVec4f(1, 1, 1, 1),
+    color = vec4(1, 1, 1, 1),
     scale = 0.001,
-    position = NewVec3f(-0.9, 0.1),
+    position = vec3(-0.9, 0.1),
     verticalAlignment = Top,
     horizontalAlignment = Left,
   )
@@ -150,7 +150,7 @@
   while ((getMonoTime() - start).inMilliseconds().int / 1000) < time:
     let progress = ((getMonoTime() - start).inMilliseconds().int / 1000) / time
     WithNextFrame(framebuffer, commandbuffer):
-      WithRenderPass(vulkan.swapchain.renderPass, framebuffer, commandbuffer, vulkan.swapchain.width, vulkan.swapchain.height, NewVec4f(0, 0, 0, 0)):
+      WithRenderPass(vulkan.swapchain.renderPass, framebuffer, commandbuffer, vulkan.swapchain.width, vulkan.swapchain.height, vec4(0, 0, 0, 0)):
         WithPipeline(commandbuffer, pipeline):
           for label in labels:
             Render(label, commandbuffer, pipeline)
@@ -173,9 +173,9 @@
       pipeline.descriptorSetLayouts[0],
       font,
       $i,
-      color = NewVec4f(rand(0.5 .. 1.0), rand(0.5 .. 1.0), rand(0.5 .. 1.0), rand(0.5 .. 1.0)),
+      color = vec4(rand(0.5 .. 1.0), rand(0.5 .. 1.0), rand(0.5 .. 1.0), rand(0.5 .. 1.0)),
       scale = rand(0.0002 .. 0.002),
-      position = NewVec3f(rand(-0.5 .. 0.5), rand(-0.5 .. 0.5), rand(-0.1 .. 0.1))
+      position = vec3(rand(-0.5 .. 0.5), rand(-0.5 .. 0.5), rand(-0.1 .. 0.1))
     )
   labels = labels.sortedByIt(-it.Position.z)
 
@@ -184,7 +184,7 @@
     for l in labels.mitems:
       l.Refresh()
     WithNextFrame(framebuffer, commandbuffer):
-      WithRenderPass(vulkan.swapchain.renderPass, framebuffer, commandbuffer, vulkan.swapchain.width, vulkan.swapchain.height, NewVec4f(0, 0, 0, 0)):
+      WithRenderPass(vulkan.swapchain.renderPass, framebuffer, commandbuffer, vulkan.swapchain.width, vulkan.swapchain.height, vec4(0, 0, 0, 0)):
         WithPipeline(commandbuffer, pipeline):
           for l in labels:
             Render(l, commandbuffer, pipeline)