comparison tests/test_font.nim @ 412:262e771e2573

add: packed textures for font-atlas
author Sam <sam@basx.dev>
date Sat, 20 Jan 2024 21:28:17 +0700
parents e50c57423567
children 8fb4387b2ea1
comparison
equal deleted inserted replaced
411:e50c57423567 412:262e771e2573
8 engine.initRenderer([]) 8 engine.initRenderer([])
9 9
10 # build scene 10 # build scene
11 var scene = Scene(name: "main") 11 var scene = Scene(name: "main")
12 # var font = loadFont("DejaVuSans.ttf", lineHeightPixels=90'f32, charset="abcdefghijklmnopqrstuvwxyz ".toRunes) 12 # var font = loadFont("DejaVuSans.ttf", lineHeightPixels=90'f32, charset="abcdefghijklmnopqrstuvwxyz ".toRunes)
13 var font = loadFont("DejaVuSans.ttf", lineHeightPixels=90'f32) 13 var font = loadFont("DejaVuSans.ttf", lineHeightPixels=180'f32)
14 var textbox = initText(32, font, "", color=newVec4f(1, 0, 0, 1)) 14 var textbox = initText(32, font, "", color=newVec4f(1, 0, 0, 1))
15 let fontscale = 0.005 15 let fontscale = 0.001
16 scene.add textbox 16 scene.add textbox
17 textbox.mesh.transform = scale(fontscale, fontscale) 17 textbox.mesh.transform = scale(fontscale, fontscale)
18 engine.loadScene(scene) 18 engine.loadScene(scene)
19 19
20 while engine.updateInputs() == Running and not engine.keyIsDown(Escape): 20 while engine.updateInputs() == Running and not engine.keyIsDown(Escape):