SkeletonAnimation.lua 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. class "SkeletonAnimation"
  2. function SkeletonAnimation:SkeletonAnimation(...)
  3. for k,v in pairs(arg) do
  4. if type(v) == "table" then
  5. if v.__ptr ~= nil then
  6. arg[k] = v.__ptr
  7. end
  8. end
  9. end
  10. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  11. self.__ptr = Polycore.SkeletonAnimation(unpack(arg))
  12. Polycore.__ptr_lookup[self.__ptr] = self
  13. end
  14. end
  15. function SkeletonAnimation:addBoneTrack(boneTrack)
  16. local retVal = Polycore.SkeletonAnimation_addBoneTrack(self.__ptr, boneTrack.__ptr)
  17. end
  18. function SkeletonAnimation:getName()
  19. local retVal = Polycore.SkeletonAnimation_getName(self.__ptr)
  20. if retVal == nil then return nil end
  21. if Polycore.__ptr_lookup[retVal] ~= nil then
  22. return Polycore.__ptr_lookup[retVal]
  23. else
  24. Polycore.__ptr_lookup[retVal] = String("__skip_ptr__")
  25. Polycore.__ptr_lookup[retVal].__ptr = retVal
  26. return Polycore.__ptr_lookup[retVal]
  27. end
  28. end
  29. function SkeletonAnimation:Play()
  30. local retVal = Polycore.SkeletonAnimation_Play(self.__ptr)
  31. end
  32. function SkeletonAnimation:Stop()
  33. local retVal = Polycore.SkeletonAnimation_Stop(self.__ptr)
  34. end
  35. function SkeletonAnimation:Update()
  36. local retVal = Polycore.SkeletonAnimation_Update(self.__ptr)
  37. end
  38. function SkeletonAnimation:setSpeed(speed)
  39. local retVal = Polycore.SkeletonAnimation_setSpeed(self.__ptr, speed)
  40. end
  41. function SkeletonAnimation:__delete()
  42. Polycore.__ptr_lookup[self.__ptr] = nil
  43. Polycore.delete_SkeletonAnimation(self.__ptr)
  44. end