Mercurial > games > semicongine
comparison tests/test_font.nim @ 429:740d2f0d1264
did: small fix with materials & cleanup
author | Sam <sam@basx.dev> |
---|---|
date | Mon, 05 Feb 2024 00:23:30 +0700 |
parents | b1c9374c7080 |
children | 2b373a03cf64 |
comparison
equal
deleted
inserted
replaced
428:545b4c58601f | 429:740d2f0d1264 |
---|---|
1 import std/times | |
1 import std/unicode | 2 import std/unicode |
2 | 3 |
3 import semicongine | 4 import semicongine |
4 | 5 |
5 | 6 |
24 F6: Bottom""", scale = 0.0002, position = newVec2f(0, 0), horizontalAlignment = Left, verticalAlignment = Top) | 25 F6: Bottom""", scale = 0.0002, position = newVec2f(0, 0), horizontalAlignment = Left, verticalAlignment = Top) |
25 scene.add main_text | 26 scene.add main_text |
26 scene.add help_text | 27 scene.add help_text |
27 engine.loadScene(scene) | 28 engine.loadScene(scene) |
28 mixer[].loadSound("key", "key.ogg") | 29 mixer[].loadSound("key", "key.ogg") |
30 mixer[].setLevel(0.5) | |
29 | 31 |
30 while engine.updateInputs() == Running and not engine.keyIsDown(Escape): | 32 while engine.updateInputs() == Running and not engine.keyIsDown(Escape): |
33 var t = cpuTime() | |
34 main_text.color = newVec4f(sin(t) * 0.5 + 0.5, 0.15, 0.15, 1) | |
31 if engine.windowWasResized(): | 35 if engine.windowWasResized(): |
32 var winSize = engine.getWindow().size | 36 var winSize = engine.getWindow().size |
33 main_text.aspect_ratio = winSize[0] / winSize[1] | 37 main_text.aspect_ratio = winSize[0] / winSize[1] |
34 help_text.aspect_ratio = winSize[0] / winSize[1] | 38 help_text.aspect_ratio = winSize[0] / winSize[1] |
35 help_text.position = newVec2f(-0.99, -0.99) | |
36 | 39 |
37 # add character | 40 # add character |
38 if main_text.text.len < main_text.maxLen - 1: | 41 if main_text.text.len < main_text.maxLen - 1: |
39 for c in [Key.A, Key.B, Key.C, Key.D, Key.E, Key.F, Key.G, Key.H, Key.I, | 42 for c in [Key.A, Key.B, Key.C, Key.D, Key.E, Key.F, Key.G, Key.H, Key.I, |
40 Key.J, Key.K, Key.L, Key.M, Key.N, Key.O, Key.P, Key.Q, Key.R, Key.S, | 43 Key.J, Key.K, Key.L, Key.M, Key.N, Key.O, Key.P, Key.Q, Key.R, Key.S, |