SpriteState.lua 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. class "SpriteState"
  2. function SpriteState:SpriteState(...)
  3. local arg = {...}
  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 = Polycode.SpriteState(unpack(arg))
  13. end
  14. end
  15. function SpriteState:setName(name)
  16. local retVal = Polycode.SpriteState_setName(self.__ptr, name)
  17. end
  18. function SpriteState:getName()
  19. local retVal = Polycode.SpriteState_getName(self.__ptr)
  20. return retVal
  21. end
  22. function SpriteState:getNumFrameIDs()
  23. local retVal = Polycode.SpriteState_getNumFrameIDs(self.__ptr)
  24. return retVal
  25. end
  26. function SpriteState:getFrameIDAtIndex(index)
  27. local retVal = Polycode.SpriteState_getFrameIDAtIndex(self.__ptr, index)
  28. return retVal
  29. end
  30. function SpriteState:getMeshForFrameIndex(index)
  31. local retVal = Polycode.SpriteState_getMeshForFrameIndex(self.__ptr, index)
  32. if retVal == nil then return nil end
  33. local __c = _G["shared_ptr<Mesh>"]("__skip_ptr__")
  34. __c.__ptr = retVal
  35. return __c
  36. end
  37. function SpriteState:insertFrame(index, frameID)
  38. local retVal = Polycode.SpriteState_insertFrame(self.__ptr, index, frameID)
  39. end
  40. function SpriteState:removeFrameByIndex(frameIndex)
  41. local retVal = Polycode.SpriteState_removeFrameByIndex(self.__ptr, frameIndex)
  42. end
  43. function SpriteState:clearFrames()
  44. local retVal = Polycode.SpriteState_clearFrames(self.__ptr)
  45. end
  46. function SpriteState:setPixelsPerUnit(ppu)
  47. local retVal = Polycode.SpriteState_setPixelsPerUnit(self.__ptr, ppu)
  48. end
  49. function SpriteState:getPixelsPerUnit()
  50. local retVal = Polycode.SpriteState_getPixelsPerUnit(self.__ptr)
  51. return retVal
  52. end
  53. function SpriteState:rebuildStateMeshes()
  54. local retVal = Polycode.SpriteState_rebuildStateMeshes(self.__ptr)
  55. end
  56. function SpriteState:setStateFPS(fps)
  57. local retVal = Polycode.SpriteState_setStateFPS(self.__ptr, fps)
  58. end
  59. function SpriteState:getStateFPS()
  60. local retVal = Polycode.SpriteState_getStateFPS(self.__ptr)
  61. return retVal
  62. end
  63. function SpriteState:getLargestFrameBoundingBox()
  64. local retVal = Polycode.SpriteState_getLargestFrameBoundingBox(self.__ptr)
  65. if retVal == nil then return nil end
  66. local __c = _G["Vector3"]("__skip_ptr__")
  67. __c.__ptr = retVal
  68. return __c
  69. end
  70. function SpriteState:setBoundingBox(boundingBox)
  71. local retVal = Polycode.SpriteState_setBoundingBox(self.__ptr, boundingBox.__ptr)
  72. end
  73. function SpriteState:getBoundingBox()
  74. local retVal = Polycode.SpriteState_getBoundingBox(self.__ptr)
  75. if retVal == nil then return nil end
  76. local __c = _G["Vector2"]("__skip_ptr__")
  77. __c.__ptr = retVal
  78. return __c
  79. end
  80. function SpriteState:getSpriteOffset()
  81. local retVal = Polycode.SpriteState_getSpriteOffset(self.__ptr)
  82. if retVal == nil then return nil end
  83. local __c = _G["Vector2"]("__skip_ptr__")
  84. __c.__ptr = retVal
  85. return __c
  86. end
  87. function SpriteState:setSpriteOffset(offset)
  88. local retVal = Polycode.SpriteState_setSpriteOffset(self.__ptr, offset.__ptr)
  89. end
  90. function SpriteState:__delete()
  91. if self then Polycode.delete_SpriteState(self.__ptr) end
  92. end