comparison tests/test_font.nim @ 874:a91219ef6ef9

add: packed textures for font-atlas
author Sam <sam@basx.dev>
date Sat, 20 Jan 2024 21:36:41 +0700
parents 1ed09c1bc79c
children 25db1fa56cb7
comparison
equal deleted inserted replaced
873:1ed09c1bc79c 874:a91219ef6ef9
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=180'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.001 15 let fontscale = 0.002
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):