mirror of
https://github.com/moparisthebest/minetest
synced 2024-11-17 14:55:13 -05:00
Change screenshot colorformat properly
This commit is contained in:
parent
b2102bfe49
commit
8948907431
33
src/game.cpp
33
src/game.cpp
@ -2068,22 +2068,29 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
|
|||||||
}
|
}
|
||||||
else if(input->wasKeyDown(getKeySetting("keymap_screenshot")))
|
else if(input->wasKeyDown(getKeySetting("keymap_screenshot")))
|
||||||
{
|
{
|
||||||
irr::video::IImage* const image = driver->createScreenShot(video::ECF_R8G8B8);
|
irr::video::IImage* const raw_image = driver->createScreenShot();
|
||||||
if (image) {
|
if (raw_image) {
|
||||||
irr::c8 filename[256];
|
irr::video::IImage* const image = driver->createImage(video::ECF_R8G8B8,
|
||||||
snprintf(filename, 256, "%s" DIR_DELIM "screenshot_%u.png",
|
raw_image->getDimension());
|
||||||
|
|
||||||
|
if (image) {
|
||||||
|
raw_image->copyTo(image);
|
||||||
|
irr::c8 filename[256];
|
||||||
|
snprintf(filename, sizeof(filename), "%s" DIR_DELIM "screenshot_%u.png",
|
||||||
g_settings->get("screenshot_path").c_str(),
|
g_settings->get("screenshot_path").c_str(),
|
||||||
device->getTimer()->getRealTime());
|
device->getTimer()->getRealTime());
|
||||||
if (driver->writeImageToFile(image, filename)) {
|
if (driver->writeImageToFile(image, filename)) {
|
||||||
std::wstringstream sstr;
|
std::wstringstream sstr;
|
||||||
sstr<<"Saved screenshot to '"<<filename<<"'";
|
sstr << "Saved screenshot to '" << filename << "'";
|
||||||
infostream<<"Saved screenshot to '"<<filename<<"'"<<std::endl;
|
infostream << "Saved screenshot to '" << filename << "'" << std::endl;
|
||||||
statustext = sstr.str();
|
statustext = sstr.str();
|
||||||
statustext_time = 0;
|
statustext_time = 0;
|
||||||
} else{
|
} else {
|
||||||
infostream<<"Failed to save screenshot '"<<filename<<"'"<<std::endl;
|
infostream << "Failed to save screenshot '" << filename << "'" << std::endl;
|
||||||
|
}
|
||||||
|
image->drop();
|
||||||
}
|
}
|
||||||
image->drop();
|
raw_image->drop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(input->wasKeyDown(getKeySetting("keymap_toggle_hud")))
|
else if(input->wasKeyDown(getKeySetting("keymap_toggle_hud")))
|
||||||
|
Loading…
Reference in New Issue
Block a user