SceneImage.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. require "Polycode/ScenePrimitive"
  2. class "SceneImage" (ScenePrimitive)
  3. function SceneImage:SceneImage(...)
  4. local arg = {...}
  5. if type(arg[1]) == "table" and count(arg) == 1 then
  6. if ""..arg[1].__classname == "ScenePrimitive" then
  7. self.__ptr = arg[1].__ptr
  8. return
  9. end
  10. end
  11. for k,v in pairs(arg) do
  12. if type(v) == "table" then
  13. if v.__ptr ~= nil then
  14. arg[k] = v.__ptr
  15. end
  16. end
  17. end
  18. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  19. self.__ptr = Polycore.SceneImage(unpack(arg))
  20. end
  21. end
  22. function SceneImage.SceneImageWithImage(image)
  23. local retVal = Polycore.SceneImage_SceneImageWithImage(image.__ptr)
  24. if retVal == nil then return nil end
  25. local __c = _G["SceneImage"]("__skip_ptr__")
  26. __c.__ptr = retVal
  27. return __c
  28. end
  29. function SceneImage.SceneImageWithTexture(texture)
  30. local retVal = Polycore.SceneImage_SceneImageWithTexture(texture.__ptr)
  31. if retVal == nil then return nil end
  32. local __c = _G["SceneImage"]("__skip_ptr__")
  33. __c.__ptr = retVal
  34. return __c
  35. end
  36. function SceneImage:Clone(deepClone, ignoreEditorOnly)
  37. local retVal = Polycore.SceneImage_Clone(self.__ptr, deepClone, ignoreEditorOnly)
  38. if retVal == nil then return nil end
  39. local __c = _G["Entity"]("__skip_ptr__")
  40. __c.__ptr = retVal
  41. return __c
  42. end
  43. function SceneImage:applyClone(clone, deepClone, ignoreEditorOnly)
  44. local retVal = Polycore.SceneImage_applyClone(self.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
  45. end
  46. function SceneImage:setImageCoordinates(x, y, width, height, realWidth, realHeight)
  47. local retVal = Polycore.SceneImage_setImageCoordinates(self.__ptr, x, y, width, height, realWidth, realHeight)
  48. end
  49. function SceneImage:getImageWidth()
  50. local retVal = Polycore.SceneImage_getImageWidth(self.__ptr)
  51. return retVal
  52. end
  53. function SceneImage:getImageHeight()
  54. local retVal = Polycore.SceneImage_getImageHeight(self.__ptr)
  55. return retVal
  56. end
  57. function SceneImage:__delete()
  58. if self then Polycore.delete_SceneImage(self.__ptr) end
  59. end