comparison tests/test_panel.nim @ 430:c5999345f42c

add: panels
author Sam <sam@basx.dev>
date Mon, 05 Feb 2024 23:11:22 +0700
parents
children e13b75bff00c
comparison
equal deleted inserted replaced
429:740d2f0d1264 430:c5999345f42c
1 import std/unicode
2
3 import semicongine
4
5
6 proc main() =
7 # setup engine
8 var engine = initEngine("Test panels")
9 engine.initRenderer([])
10
11 # build scene
12 var scene = Scene(name: "main")
13 var panel = initPanel(position: newVec2f(0, 0), size: newVec2f(0.1, 0.1))
14
15 scene.add panel
16 engine.loadScene(scene)
17
18 while engine.updateInputs() == Running and not engine.keyIsDown(Escape):
19 if engine.windowWasResized():
20 var winSize = engine.getWindow().size
21 panel.aspect_ratio = winSize[0] / winSize[1]
22
23 engine.renderScene(scene)
24 engine.destroy()
25
26
27 when isMainModule:
28 main()