Code: Select all
void Game::makeScreenshot() const
{
//get video::IImage from the last rendered frame
irr::video::IImage* const image = this->videoDriver->createScreenShot();
if (image) //should always be true, but you never know. ;)
{
//construct a filename, consisting of local time and file extension
irr::c8 filename[64];
snprintf(filename, 64, "capture/screenshot_%u.png", this->timer->getRealTime());
//write screenshot to file
if (this->videoDriver->writeImageToFile(image, filename))
this->device->getLogger()->log(L"Screenshot taken.");
else
this->device->getLogger()->log(L"Failed to take screenshot. Maybe you need to create the capture folder.");
//Don't forget to drop image since we don't need it anymore.
image->drop();
}
}
Could anyone please confirm?
Btw.: OpenGL, Windows XP, mingw, latest SVN trunk