comparison tests/test_font.nim @ 1138:02e1d2658ff5

did: more renaming
author sam <sam@basx.dev>
date Tue, 04 Jun 2024 22:08:48 +0700
parents a4aa9f374d44
children 114f395b9144
comparison
equal deleted inserted replaced
1137:a4aa9f374d44 1138:02e1d2658ff5
4 import semicongine 4 import semicongine
5 5
6 6
7 proc main() = 7 proc main() =
8 # setup engine 8 # setup engine
9 var engine = initEngine("Test fonts") 9 var engine = InitEngine("Test fonts")
10 engine.initRenderer([]) 10 engine.InitRenderer([])
11 11
12 # build scene 12 # build scene
13 var scene = Scene(name: "main") 13 var scene = Scene(name: "main")
14 var font = loadFont("DejaVuSans.ttf", lineHeightPixels = 210'f32) 14 var font = loadFont("DejaVuSans.ttf", lineHeightPixels = 210'f32)
15 var origin = initPanel(transform = Scale(0.01, 0.01)) 15 var origin = initPanel(transform = Scale(0.01, 0.01))
25 F5: Center 25 F5: Center
26 F6: Bottom""".toRunes, horizontalAlignment = Left, verticalAlignment = Top, transform = Translate(-0.9, -0.9) * Scale(0.0002, 0.0002)) 26 F6: Bottom""".toRunes, horizontalAlignment = Left, verticalAlignment = Top, transform = Translate(-0.9, -0.9) * Scale(0.0002, 0.0002))
27 scene.add origin 27 scene.add origin
28 scene.add main_text 28 scene.add main_text
29 scene.add help_text 29 scene.add help_text
30 engine.loadScene(scene) 30 engine.LoadScene(scene)
31 mixer[].LoadSound("key", "key.ogg") 31 mixer[].LoadSound("key", "key.ogg")
32 mixer[].SetLevel(0.5) 32 mixer[].SetLevel(0.5)
33 33
34 while engine.UpdateInputs() and not KeyIsDown(Escape): 34 while engine.UpdateInputs() and not KeyIsDown(Escape):
35 var t = cpuTime() 35 var t = cpuTime()
69 origin.refresh() 69 origin.refresh()
70 main_text.text = main_text.text & Rune('_') 70 main_text.text = main_text.text & Rune('_')
71 main_text.refresh() 71 main_text.refresh()
72 main_text.text = main_text.text[0 ..< ^1] 72 main_text.text = main_text.text[0 ..< ^1]
73 help_text.refresh() 73 help_text.refresh()
74 engine.renderScene(scene) 74 engine.RenderScene(scene)
75 engine.destroy() 75 engine.Destroy()
76 76
77 77
78 when isMainModule: 78 when isMainModule:
79 main() 79 main()