SceneLabel.lua 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. require "Polycode/SceneEntity"
  2. class "SceneLabel" (SceneEntity)
  3. function SceneLabel:SceneLabel(...)
  4. for k,v in pairs(arg) do
  5. if type(v) == "table" then
  6. if v.__ptr ~= nil then
  7. arg[k] = v.__ptr
  8. end
  9. end
  10. end
  11. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  12. self.__ptr = Polycore.SceneLabel(unpack(arg))
  13. Polycore.__ptr_lookup[self.__ptr] = self
  14. end
  15. end
  16. function SceneLabel:testMouseCollision(x, y)
  17. local retVal = Polycore.SceneLabel_testMouseCollision(self.__ptr, x, y)
  18. return retVal
  19. end
  20. function SceneLabel:setText(newText)
  21. local retVal = Polycore.SceneLabel_setText(self.__ptr, newText)
  22. end
  23. function SceneLabel:getLabel()
  24. local retVal = Polycore.SceneLabel_getLabel(self.__ptr)
  25. if Polycore.__ptr_lookup[retVal] ~= nil then
  26. return Polycore.__ptr_lookup[retVal]
  27. else
  28. Polycore.__ptr_lookup[retVal] = Label("__skip_ptr__")
  29. Polycore.__ptr_lookup[retVal].__ptr = retVal
  30. return Polycore.__ptr_lookup[retVal]
  31. end
  32. end
  33. function SceneLabel:Render()
  34. local retVal = Polycore.SceneLabel_Render(self.__ptr)
  35. end