SceneSound.lua 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. require "Polycode/SceneEntity"
  2. class "SceneSound" (SceneEntity)
  3. function SceneSound:SceneSound(...)
  4. if type(arg[1]) == "table" and count(arg) == 1 then
  5. if ""..arg[1]:class() == "SceneEntity" 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.SceneSound(unpack(arg))
  19. Polycore.__ptr_lookup[self.__ptr] = self
  20. end
  21. end
  22. function SceneSound:Update()
  23. local retVal = Polycore.SceneSound_Update(self.__ptr)
  24. end
  25. function SceneSound:getSound()
  26. local retVal = Polycore.SceneSound_getSound(self.__ptr)
  27. if Polycore.__ptr_lookup[retVal] ~= nil then
  28. return Polycore.__ptr_lookup[retVal]
  29. else
  30. Polycore.__ptr_lookup[retVal] = Sound("__skip_ptr__")
  31. Polycore.__ptr_lookup[retVal].__ptr = retVal
  32. return Polycore.__ptr_lookup[retVal]
  33. end
  34. end
  35. function SceneSound:__delete()
  36. Polycore.__ptr_lookup[self.__ptr] = nil
  37. Polycore.delete_SceneSound(self.__ptr)
  38. end