ScreenLabel.lua 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. require "Polycode/ScreenShape"
  2. class "ScreenLabel" (ScreenShape)
  3. function ScreenLabel:ScreenLabel(...)
  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.ScreenLabel(unpack(arg))
  13. Polycore.__ptr_lookup[self.__ptr] = self
  14. end
  15. end
  16. function ScreenLabel:addDropShadow(color, size, offsetX, offsetY)
  17. local retVal = Polycore.ScreenLabel_addDropShadow(self.__ptr, color.__ptr, size, offsetX, offsetY)
  18. end
  19. function ScreenLabel:setText(newText)
  20. local retVal = Polycore.ScreenLabel_setText(self.__ptr, newText)
  21. end
  22. function ScreenLabel:getText()
  23. local retVal = Polycore.ScreenLabel_getText(self.__ptr)
  24. return retVal
  25. end
  26. function ScreenLabel:getLabel()
  27. local retVal = Polycore.ScreenLabel_getLabel(self.__ptr)
  28. if Polycore.__ptr_lookup[retVal] ~= nil then
  29. return Polycore.__ptr_lookup[retVal]
  30. else
  31. Polycore.__ptr_lookup[retVal] = Label("__skip_ptr__")
  32. Polycore.__ptr_lookup[retVal].__ptr = retVal
  33. return Polycore.__ptr_lookup[retVal]
  34. end
  35. end