diff tests/test_font.nim @ 1135:74957cbf589b

fix: update tests according to some API renaming
author sam <sam@basx.dev>
date Mon, 03 Jun 2024 16:05:17 +0700
parents 73b572f82a1f
children 71315636ba82
line wrap: on
line diff
--- a/tests/test_font.nim	Mon Jun 03 15:53:30 2024 +0700
+++ b/tests/test_font.nim	Mon Jun 03 16:05:17 2024 +0700
@@ -28,45 +28,45 @@
   scene.add main_text
   scene.add help_text
   engine.loadScene(scene)
-  mixer[].loadSound("key", "key.ogg")
-  mixer[].setLevel(0.5)
+  mixer[].LoadSound("key", "key.ogg")
+  mixer[].SetLevel(0.5)
 
-  while engine.updateInputs() and not keyIsDown(Escape):
+  while engine.UpdateInputs() and not KeyIsDown(Escape):
     var t = cpuTime()
     main_text.color = newVec4f(sin(t) * 0.5 + 0.5, 0.15, 0.15, 1)
-    if windowWasResized():
-      var winSize = engine.getWindow().size
+    if WindowWasResized():
+      var winSize = engine.GetWindow().size
 
     # add character
     if main_text.text.len < main_text.maxLen - 1:
       for c in [Key.A, Key.B, Key.C, Key.D, Key.E, Key.F, Key.G, Key.H, Key.I,
           Key.J, Key.K, Key.L, Key.M, Key.N, Key.O, Key.P, Key.Q, Key.R, Key.S,
           Key.T, Key.U, Key.V, Key.W, Key.X, Key.Y, Key.Z]:
-        if keyWasPressed(c):
-          discard mixer[].play("key")
-          if keyIsDown(ShiftL) or keyIsDown(ShiftR):
+        if KeyWasPressed(c):
+          discard mixer[].Play("key")
+          if KeyIsDown(ShiftL) or KeyIsDown(ShiftR):
             main_text.text = main_text.text & ($c).toRunes
           else:
             main_text.text = main_text.text & ($c).toRunes[0].toLower()
-      if keyWasPressed(Enter):
-        discard mixer[].play("key")
+      if KeyWasPressed(Enter):
+        discard mixer[].Play("key")
         main_text.text = main_text.text & Rune('\n')
-      if keyWasPressed(Space):
-        discard mixer[].play("key")
+      if KeyWasPressed(Space):
+        discard mixer[].Play("key")
         main_text.text = main_text.text & Rune(' ')
 
     # remove character
-    if keyWasPressed(Backspace) and main_text.text.len > 0:
-      discard mixer[].play("key")
+    if KeyWasPressed(Backspace) and main_text.text.len > 0:
+      discard mixer[].Play("key")
       main_text.text = main_text.text[0 ..< ^1]
 
     # alignemtn with F-keys
-    if keyWasPressed(F1): main_text.horizontalAlignment = Left
-    elif keyWasPressed(F2): main_text.horizontalAlignment = Center
-    elif keyWasPressed(F3): main_text.horizontalAlignment = Right
-    elif keyWasPressed(F4): main_text.verticalAlignment = Top
-    elif keyWasPressed(F5): main_text.verticalAlignment = Center
-    elif keyWasPressed(F6): main_text.verticalAlignment = Bottom
+    if KeyWasPressed(F1): main_text.horizontalAlignment = Left
+    elif KeyWasPressed(F2): main_text.horizontalAlignment = Center
+    elif KeyWasPressed(F3): main_text.horizontalAlignment = Right
+    elif KeyWasPressed(F4): main_text.verticalAlignment = Top
+    elif KeyWasPressed(F5): main_text.verticalAlignment = Center
+    elif KeyWasPressed(F6): main_text.verticalAlignment = Bottom
 
     origin.refresh()
     main_text.text = main_text.text & Rune('_')