test8.nim 489 B

123456789101112131415161718192021222324
  1. # --- Test 8. Use TextureRect node. --- #
  2. import nodesnim
  3. Window("hello world")
  4. var
  5. mainobj: SceneObj
  6. main = Scene("Main", mainobj)
  7. texturerectobj: TextureRectObj
  8. texturerect = TextureRect(texturerectobj)
  9. main.addChild(texturerect)
  10. texturerect.loadTexture("assets/sharp.jpg") # Load image from file.
  11. texturerect.resize(256, 256)
  12. texturerect.texture_mode = TEXTURE_CROP
  13. texturerect.texture_anchor = Anchor(0.5, 1, 0.5, 1)
  14. addScene(main)
  15. setMainScene("Main")
  16. windowLaunch()