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