ScreenParticleEmitter.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. require "Polycode/ScreenEntity"
  2. class "ScreenParticleEmitter" (ScreenEntity)
  3. function ScreenParticleEmitter:ScreenParticleEmitter(...)
  4. if type(arg[1]) == "table" and count(arg) == 1 then
  5. if ""..arg[1]:class() == "ScreenEntity" then
  6. self.__ptr = arg[1].__ptr
  7. return
  8. end
  9. end
  10. for k,v in pairs(arg) do
  11. if type(v) == "table" then
  12. if v.__ptr ~= nil then
  13. arg[k] = v.__ptr
  14. end
  15. end
  16. end
  17. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  18. self.__ptr = Polycore.ScreenParticleEmitter(unpack(arg))
  19. Polycore.__ptr_lookup[self.__ptr] = self
  20. end
  21. end
  22. function ScreenParticleEmitter:getEmitter()
  23. local retVal = Polycore.ScreenParticleEmitter_getEmitter(self.__ptr)
  24. if retVal == nil then return nil end
  25. if Polycore.__ptr_lookup[retVal] ~= nil then
  26. return Polycore.__ptr_lookup[retVal]
  27. else
  28. Polycore.__ptr_lookup[retVal] = ParticleEmitter("__skip_ptr__")
  29. Polycore.__ptr_lookup[retVal].__ptr = retVal
  30. return Polycore.__ptr_lookup[retVal]
  31. end
  32. end
  33. function ScreenParticleEmitter:addParticleBody(particleBody)
  34. local retVal = Polycore.ScreenParticleEmitter_addParticleBody(self.__ptr, particleBody.__ptr)
  35. end
  36. function ScreenParticleEmitter:getBaseMatrix()
  37. local retVal = Polycore.ScreenParticleEmitter_getBaseMatrix(self.__ptr)
  38. if retVal == nil then return nil end
  39. if Polycore.__ptr_lookup[retVal] ~= nil then
  40. return Polycore.__ptr_lookup[retVal]
  41. else
  42. Polycore.__ptr_lookup[retVal] = Matrix4("__skip_ptr__")
  43. Polycore.__ptr_lookup[retVal].__ptr = retVal
  44. return Polycore.__ptr_lookup[retVal]
  45. end
  46. end
  47. function ScreenParticleEmitter:Update()
  48. local retVal = Polycore.ScreenParticleEmitter_Update(self.__ptr)
  49. end
  50. function ScreenParticleEmitter:__delete()
  51. Polycore.__ptr_lookup[self.__ptr] = nil
  52. Polycore.delete_ScreenParticleEmitter(self.__ptr)
  53. end