project_template.nim 913 B

1234567891011121314151617181920212223242526272829303132
  1. # author: Ethosa
  2. import nodesnim
  3. build:
  4. - ColorRect (project):
  5. call rename("Project")
  6. call setSizeAnchor(1, 0)
  7. - TextureRect project_template_icon:
  8. call rename("Icon")
  9. call resize(42, 42)
  10. texture_mode: TEXTURE_KEEP_ASPECT_RATIO
  11. - Label project_template_title:
  12. call rename("Title")
  13. call setTextColor(Color(0xf2f2f7ff'u32))
  14. call move(-2, -2)
  15. call resize(256, 20)
  16. call setTextAlign(1, 0, 1, 0)
  17. call setFont(GLUT_BITMAP_HELVETICA_18, 18)
  18. mousemode: MOUSEMODE_IGNORE
  19. project@on_process(self):
  20. var s = self.ColorRectRef
  21. if s.pressed and s.focused:
  22. s.color = Color(0x4e606eff)
  23. elif s.hovered and not mouse_pressed:
  24. s.color = Color(0x3a4652ff)
  25. else:
  26. s.color = Color(0x1d242aff)
  27. project@on_click(self, x, y):
  28. changeScene("Editor", @[(k: "title", v: self.getNode("Title").LabelRef.text)])
  29. glutReshapeWindow(1280, 720)