ImageLoader.h 665 B

123456789101112131415161718192021222324
  1. #include <map>
  2. #include <optional>
  3. #include "../../gui/GuiDefinitions.h"
  4. #include "../../includes.h"
  5. extern ID3D11Device* pDevice;
  6. class ImageLoader {
  7. public:
  8. struct ImageData {
  9. ImTextureID textureID;
  10. ImVec2 size;
  11. };
  12. static std::optional<ImageData> GetImage(const std::string& imageName, const char* imageType = "PNG");
  13. private:
  14. inline static std::map<std::string, ImageData> s_Textures{};
  15. };
  16. bool LoadEx(const char* name, const char* type, LPBYTE& pDest, DWORD& size);
  17. bool LoadTextureFromMemory(LPBYTE image_data, int image_width, int image_height, ID3D11ShaderResourceView** out_srv, int* out_width, int* out_height);