Mercurial > games > semicongine
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_panel.nim Mon Feb 05 23:11:22 2024 +0700 @@ -0,0 +1,28 @@ +import std/unicode + +import semicongine + + +proc main() = + # setup engine + var engine = initEngine("Test panels") + engine.initRenderer([]) + + # build scene + var scene = Scene(name: "main") + var panel = initPanel(position: newVec2f(0, 0), size: newVec2f(0.1, 0.1)) + + scene.add panel + engine.loadScene(scene) + + while engine.updateInputs() == Running and not engine.keyIsDown(Escape): + if engine.windowWasResized(): + var winSize = engine.getWindow().size + panel.aspect_ratio = winSize[0] / winSize[1] + + engine.renderScene(scene) + engine.destroy() + + +when isMainModule: + main()