Add steam screenshot api.

This commit is contained in:
Nemirtingas 2020-10-09 13:48:09 +02:00
parent ef35271a38
commit c8e9a162ea
5 changed files with 177 additions and 6 deletions

View file

@ -22,6 +22,25 @@
#define MAX_FILENAME_LENGTH 300
union image_pixel_t
{
uint32_t pixel;
struct pixel_channels_t
{
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
} channels;
};
struct image_t
{
size_t width;
size_t height;
std::vector<image_pixel_t> pix_map;
};
class Local_Storage {
public:
static constexpr auto inventory_storage_folder = "inventory";
@ -29,6 +48,7 @@ public:
static constexpr auto remote_storage_folder = "remote";
static constexpr auto stats_storage_folder = "stats";
static constexpr auto user_data_storage = "local";
static constexpr auto screenshots_folder = "screenshots";
static constexpr auto game_settings_folder = "steam_settings";
private:
@ -62,6 +82,9 @@ public:
bool load_json(std::string full_path, nlohmann::json& json);
bool load_json_file(std::string folder, std::string const& file, nlohmann::json& json);
bool write_json_file(std::string folder, std::string const& file, nlohmann::json const& json);
std::vector<image_pixel_t> load_image(std::string const& image_path);
bool save_screenshot(std::string const& image_path, uint8_t* img_ptr, int32_t width, int32_t height, int32_t channels);
};
#endif