ScreenLabel.lua 1.0 KB

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