Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

75 строки
1.8 KiB

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright © 2016—2017 Sam Hocevar <sam@hocevar.net>
  5. // Copyright © 2016—2017 Benjamin “Touky” Huet <huet.benjamin@gmail.com>
  6. //
  7. // Lol Engine is free software. It comes without any warranty, to
  8. // the extent permitted by applicable law. You can redistribute it
  9. // and/or modify it under the terms of the Do What the Fuck You Want
  10. // to Public License, Version 2, as published by the WTFPL Task Force.
  11. // See http://www.wtfpl.net/ for more details.
  12. //
  13. #pragma once
  14. //
  15. // The Resource class
  16. // ---------------
  17. //
  18. #include <lol/math/arraynd.h>
  19. #include <lol/math/vector.h>
  20. #include <lol/math/geometry.h>
  21. #include <lol/image/pixel.h>
  22. namespace lol
  23. {
  24. //ResourceCodecData -----------------------------------------------------------
  25. class ResourceCodecData
  26. {
  27. public:
  28. ResourceCodecData() { }
  29. virtual ~ResourceCodecData() { }
  30. };
  31. //ResourceImageData -----------------------------------------------------------
  32. class ResourceImageData : public ResourceCodecData
  33. {
  34. public:
  35. ResourceImageData(Image* image)
  36. {
  37. m_image = image;
  38. }
  39. virtual ~ResourceImageData()
  40. {
  41. if (m_image)
  42. delete m_image;
  43. }
  44. Image* m_image = nullptr;
  45. };
  46. //ResourceImageData -----------------------------------------------------------
  47. class ResourceTilesetData : public ResourceImageData
  48. {
  49. public:
  50. ResourceTilesetData(Image* image)
  51. : ResourceImageData(image)
  52. { }
  53. array<ivec2, ivec2> m_tiles;
  54. };
  55. //ResourceLoader --------------------------------------------------------------
  56. class ResourceLoader
  57. {
  58. public:
  59. static ResourceCodecData* Load(char const *path);
  60. static bool Save(char const *path, ResourceCodecData* data);
  61. };
  62. } /* namespace lol */