SceneLabel.lua 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. require "Polycode/ScenePrimitive"
  2. class "SceneLabel" (ScenePrimitive)
  3. function SceneLabel:__getvar(name)
  4. if name == "positionAtBaseline" then
  5. return Polycode.SceneLabel_get_positionAtBaseline(self.__ptr)
  6. end
  7. if ScenePrimitive["__getvar"] ~= nil then
  8. return ScenePrimitive.__getvar(self, name)
  9. end
  10. end
  11. function SceneLabel:__setvar(name,value)
  12. if name == "positionAtBaseline" then
  13. Polycode.SceneLabel_set_positionAtBaseline(self.__ptr, value)
  14. return true
  15. end
  16. if ScenePrimitive["__setvar"] ~= nil then
  17. return ScenePrimitive.__setvar(self, name, value)
  18. else
  19. return false
  20. end
  21. end
  22. function SceneLabel:SceneLabel(...)
  23. local arg = {...}
  24. if type(arg[1]) == "table" and count(arg) == 1 then
  25. if ""..arg[1].__classname == "ScenePrimitive" then
  26. self.__ptr = arg[1].__ptr
  27. return
  28. end
  29. end
  30. for k,v in pairs(arg) do
  31. if type(v) == "table" then
  32. if v.__ptr ~= nil then
  33. arg[k] = v.__ptr
  34. end
  35. end
  36. end
  37. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  38. self.__ptr = Polycode.SceneLabel(unpack(arg))
  39. end
  40. end
  41. function SceneLabel:getText()
  42. local retVal = Polycode.SceneLabel_getText(self.__ptr)
  43. return retVal
  44. end
  45. function SceneLabel:setLabelActualHeight(actualHeight)
  46. local retVal = Polycode.SceneLabel_setLabelActualHeight(self.__ptr, actualHeight)
  47. end
  48. function SceneLabel:getLabelActualHeight()
  49. local retVal = Polycode.SceneLabel_getLabelActualHeight(self.__ptr)
  50. return retVal
  51. end
  52. function SceneLabel:Render(buffer)
  53. local retVal = Polycode.SceneLabel_Render(self.__ptr, buffer.__ptr)
  54. end
  55. function SceneLabel:getTextWidthForString(text)
  56. local retVal = Polycode.SceneLabel_getTextWidthForString(self.__ptr, text)
  57. return retVal
  58. end
  59. function SceneLabel:setText(newText)
  60. local retVal = Polycode.SceneLabel_setText(self.__ptr, newText)
  61. end
  62. function SceneLabel:Clone(deepClone, ignoreEditorOnly)
  63. local retVal = Polycode.SceneLabel_Clone(self.__ptr, deepClone, ignoreEditorOnly)
  64. if retVal == nil then return nil end
  65. local __c = _G["Entity"]("__skip_ptr__")
  66. __c.__ptr = retVal
  67. return __c
  68. end
  69. function SceneLabel:applyClone(clone, deepClone, ignoreEditorOnly)
  70. local retVal = Polycode.SceneLabel_applyClone(self.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
  71. end
  72. function SceneLabel:updateFromLabel()
  73. local retVal = Polycode.SceneLabel_updateFromLabel(self.__ptr)
  74. end
  75. function SceneLabel:getLabel()
  76. local retVal = Polycode.SceneLabel_getLabel(self.__ptr)
  77. if retVal == nil then return nil end
  78. local __c = _G["Label"]("__skip_ptr__")
  79. __c.__ptr = retVal
  80. return __c
  81. end
  82. function SceneLabel:__delete()
  83. if self then Polycode.delete_SceneLabel(self.__ptr) end
  84. end