Commit 106e564e authored by nanahira's avatar nanahira

add screenshot

parent 60b17dbc
......@@ -1919,6 +1919,13 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true;
break;
}
case irr::KEY_KEY_X:
case irr::KEY_F12: {
if(!event.KeyInput.PressedDown && !mainGame->HasFocus(EGUIET_EDIT_BOX))
mainGame->takeScreenshot();
return true;
break;
}
default: break;
}
break;
......
......@@ -1899,6 +1899,17 @@ void Game::FlashWindow() {
FlashWindowEx(&fi);
#endif
}
void Game::takeScreenshot() {
irr::video::IImage* const image = driver->createScreenShot();
if(image) {
irr::c8 filename[64];
snprintf(filename, 64, "screenshots/ygopro_%u.png", device->getTimer()->getRealTime());
if (!driver->writeImageToFile(image, filename))
device->getLogger()->log(L"Failed to take screenshot.", irr::ELL_WARNING);
image->drop();
} else
device->getLogger()->log(L"Failed to take screenshot.", irr::ELL_WARNING);
}
void Game::SetCursor(ECURSOR_ICON icon) {
ICursorControl* cursor = mainGame->device->getCursorControl();
if(cursor->getActiveIcon() != icon) {
......
......@@ -174,6 +174,7 @@ public:
void SetWindowsIcon();
void FlashWindow();
void takeScreenshot();
void SetCursor(ECURSOR_ICON icon);
Mutex gMutex;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment