24 lines
543 B
C++
24 lines
543 B
C++
|
#pragma once
|
||
|
|
||
|
#include <paradiso/bitmap.hpp>
|
||
|
|
||
|
#include <optional>
|
||
|
#include <string>
|
||
|
#include <unordered_map>
|
||
|
|
||
|
class image_loader {
|
||
|
public:
|
||
|
/**
|
||
|
* @brief loads an Image from a file
|
||
|
* @param[in] filename path to file
|
||
|
* @return bitmap from file
|
||
|
*/
|
||
|
static paradiso::Bitmap load(const std::string& filename);
|
||
|
|
||
|
private:
|
||
|
static inline const std::string ASSET_PATH = "assets/";
|
||
|
|
||
|
static std::unordered_map<std::string, paradiso::Bitmap> image_cache;
|
||
|
|
||
|
static paradiso::Bitmap readBMP(std::string& filename);
|
||
|
};
|