lua_resource.h 882 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * Copyright (c) 2012-2014 Daniele Bartolini and individual contributors.
  3. * License: https://github.com/taylor001/crown/blob/master/LICENSE
  4. */
  5. #pragma once
  6. #include "memory_types.h"
  7. #include "resource_types.h"
  8. #include "filesystem_types.h"
  9. #include "compiler_types.h"
  10. namespace crown
  11. {
  12. struct LuaResource
  13. {
  14. uint32_t version;
  15. uint32_t size; // Size of lua code
  16. };
  17. namespace lua_resource
  18. {
  19. void compile(const char* path, CompileOptions& opts);
  20. void* load(File& file, Allocator& a);
  21. void online(StringId64 /*id*/, ResourceManager& /*rm*/);
  22. void offline(StringId64 /*id*/, ResourceManager& /*rm*/);
  23. void unload(Allocator& allocator, void* resource);
  24. /// Returns the size in bytes of the lua program.
  25. uint32_t size(const LuaResource* lr);
  26. /// Returns the lua program.
  27. const char* program(const LuaResource* lr);
  28. } // namespace lua_resource
  29. } // namespace crown