view tests/test_panel.nim @ 431:e13b75bff00c

intermediate commit :P
author Sam <sam@basx.dev>
date Fri, 09 Feb 2024 20:02:55 +0700
parents c5999345f42c
children 08b8facaf3b7
line wrap: on
line source

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 = Panel(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()