ScreenMesh.lua 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. require "Polycode/ScreenEntity"
  2. class "ScreenMesh" (ScreenEntity)
  3. function ScreenMesh:ScreenMesh(...)
  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 = Polycore.ScreenMesh(unpack(arg))
  13. end
  14. end
  15. function ScreenMesh:Render()
  16. local retVal = Polycore.ScreenMesh_Render(self.__ptr)
  17. end
  18. function ScreenMesh:getMesh()
  19. local retVal = Polycore.ScreenMesh_getMesh(self.__ptr)
  20. if Polycore.__ptr_lookup[retVal] ~= nil then
  21. return Polycore.__ptr_lookup[retVal]
  22. else
  23. Polycore.__ptr_lookup[retVal] = Mesh("__skip_ptr__")
  24. Polycore.__ptr_lookup[retVal].__ptr = retVal
  25. return Polycore.__ptr_lookup[retVal]
  26. end
  27. end
  28. function ScreenMesh:getTexture()
  29. local retVal = Polycore.ScreenMesh_getTexture(self.__ptr)
  30. if Polycore.__ptr_lookup[retVal] ~= nil then
  31. return Polycore.__ptr_lookup[retVal]
  32. else
  33. Polycore.__ptr_lookup[retVal] = Texture("__skip_ptr__")
  34. Polycore.__ptr_lookup[retVal].__ptr = retVal
  35. return Polycore.__ptr_lookup[retVal]
  36. end
  37. end
  38. function ScreenMesh:loadTexture(fileName)
  39. local retVal = Polycore.ScreenMesh_loadTexture(self.__ptr, fileName)
  40. end
  41. function ScreenMesh:setTexture(texture)
  42. local retVal = Polycore.ScreenMesh_setTexture(self.__ptr, texture.__ptr)
  43. end