PhysFSFile.lua 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. class "PhysFSFile"
  2. function PhysFSFile:__getvar(name)
  3. if name == "physFSFile" then
  4. local retVal = Polycode.PhysFSFile_get_physFSFile(self.__ptr)
  5. if retVal == nil then return nil end
  6. local __c = _G["PHYSFS_File"]("__skip_ptr__")
  7. __c.__ptr = retVal
  8. return __c
  9. end
  10. end
  11. function PhysFSFile:__setvar(name,value)
  12. if name == "physFSFile" then
  13. Polycode.PhysFSFile_set_physFSFile(self.__ptr, value.__ptr)
  14. return true
  15. end
  16. return false
  17. end
  18. function PhysFSFile:read(ptr, size, count)
  19. local retVal = Polycode.PhysFSFile_read(self.__ptr, ptr.__ptr, size.__ptr, count.__ptr)
  20. return retVal
  21. end
  22. function PhysFSFile:write(ptr, size, count)
  23. local retVal = Polycode.PhysFSFile_write(self.__ptr, ptr.__ptr, size.__ptr, count.__ptr)
  24. return retVal
  25. end
  26. function PhysFSFile:seek(offset, origin)
  27. local retVal = Polycode.PhysFSFile_seek(self.__ptr, offset, origin)
  28. return retVal
  29. end
  30. function PhysFSFile:tell()
  31. local retVal = Polycode.PhysFSFile_tell(self.__ptr)
  32. return retVal
  33. end
  34. function PhysFSFile:__delete()
  35. if self then Polycode.delete_PhysFSFile(self.__ptr) end
  36. end