ScreenMesh.lua 1.3 KB

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