SceneLabel.lua 1009 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. end
  14. end
  15. function SceneLabel:testMouseCollision(x, y)
  16. local retVal = Polycore.SceneLabel_testMouseCollision(self.__ptr, x, y)
  17. return retVal
  18. end
  19. function SceneLabel:setText(newText)
  20. local retVal = Polycore.SceneLabel_setText(self.__ptr, newText)
  21. end
  22. function SceneLabel:getLabel()
  23. local retVal = Polycore.SceneLabel_getLabel(self.__ptr)
  24. if Polycore.__ptr_lookup[retVal] ~= nil then
  25. return Polycore.__ptr_lookup[retVal]
  26. else
  27. Polycore.__ptr_lookup[retVal] = Label("__skip_ptr__")
  28. Polycore.__ptr_lookup[retVal].__ptr = retVal
  29. return Polycore.__ptr_lookup[retVal]
  30. end
  31. end
  32. function SceneLabel:Render()
  33. local retVal = Polycore.SceneLabel_Render(self.__ptr)
  34. end