comparison tests/test_panel.nim @ 436:36b907544820

fix: text-alignment, a few smaller fixes
author Sam <sam@basx.dev>
date Sun, 11 Feb 2024 18:47:13 +0700
parents 30cc1deda4c1
children f9d25bc331b3
comparison
equal deleted inserted replaced
435:065854cdba52 436:36b907544820
27 # 27 #
28 var 28 var
29 font = loadFont("DejaVuSans.ttf", lineHeightPixels = 210'f32) 29 font = loadFont("DejaVuSans.ttf", lineHeightPixels = 210'f32)
30 scene = Scene(name: "main") 30 scene = Scene(name: "main")
31 origin = initPanel( 31 origin = initPanel(
32 size = newVec2f(0.02, 0.02), 32 size = newVec2f(0.005, 0.005),
33 color = newVec4f(1, 1, 1, 1), 33 color = newVec4f(1, 1, 1, 1),
34 texture = Texture(isGrayscale: false, colorImage: newImage[RGBAPixel](3, 3, [T, B, T, B, B, B, T, B, T]), sampler: NEAREST_SAMPLER), 34 texture = Texture(isGrayscale: false, colorImage: newImage[RGBAPixel](3, 3, [T, B, T, B, B, B, T, B, T]), sampler: NEAREST_SAMPLER),
35 ) 35 )
36 panel = initPanel( 36 panel = initPanel(
37 size = newVec2f(0.2, 0.2), 37 size = newVec2f(0.2, 0.2),
47 F2: Center 47 F2: Center
48 F3: Right 48 F3: Right
49 Vertical alignment: 49 Vertical alignment:
50 F4: Top 50 F4: Top
51 F5: Center 51 F5: Center
52 F6: Bottom""", scale = 0.0002, position = newVec2f(-0.9, -0.9), horizontalAlignment = Left, verticalAlignment = Top) 52 F6: Bottom
53 Mouse:
54 Left click: Increase counter
55 Right click: Decrease counter""", scale = 0.0002, position = newVec2f(-0.9, -0.9), horizontalAlignment = Left, verticalAlignment = Top)
53 56
54 counterText = font.initText($counter, maxLen = 99, scale = 0.0004) 57 counterText = font.initText($counter, maxLen = 99, scale = 0.0004)
55 58
56 scene.add counterText 59 scene.add counterText
57 scene.add panel 60 scene.add panel