Mercurial > games > semicongine
diff tests/test_font.nim @ 331:05fb85ba97dd
did: undid using meshes as values, ref is much better, fix a few things, fix a few huge performance issues
author | Sam <sam@basx.dev> |
---|---|
date | Sun, 03 Sep 2023 17:34:29 +0700 |
parents | 04531bec3583 |
children | 6cc16b62e497 |
line wrap: on
line diff
--- a/tests/test_font.nim Sat Sep 02 23:51:02 2023 +0700 +++ b/tests/test_font.nim Sun Sep 03 17:34:29 2023 +0700 @@ -7,16 +7,19 @@ var font = loadFont("DejaVuSans.ttf", color=newVec4f(1, 0.5, 0.5, 1), resolution=20) var textbox = initTextbox(32, font, "".toRunes) - var scene = Scene(name: "main", meshes: @[textbox.mesh]) + var scene = Scene(name: "main") + scene.add textbox + textbox.mesh.transform = scale(0.01, 0.01) var engine = initEngine("Test fonts") engine.initRenderer() + scene.addShaderGlobal("perspective", Unit4F32) engine.addScene(scene) - scene.addShaderGlobal("perspective", Unit4F32) while engine.updateInputs() == Running and not engine.keyIsDown(Escape): if engine.windowWasResized(): var winSize = engine.getWindow().size scene.setShaderGlobal("perspective", orthoWindowAspect(winSize[1] / winSize[0])) + textbox.mesh.transform = scale(0.01 * (winSize[1] / winSize[0]), 0.01) 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 engine.keyWasPressed(c): if engine.keyIsDown(ShiftL) or engine.keyIsDown(ShiftR):