Commit c6ed42f7 authored by nanahira's avatar nanahira

add screenshot

parent bdbbdb0c
...@@ -1889,6 +1889,13 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1889,6 +1889,13 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; 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; default: break;
} }
break; break;
......
...@@ -1422,6 +1422,17 @@ void Game::FlashWindow() { ...@@ -1422,6 +1422,17 @@ void Game::FlashWindow() {
FlashWindowEx(&fi); FlashWindowEx(&fi);
#endif #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) { void Game::SetCursor(ECURSOR_ICON icon) {
ICursorControl* cursor = mainGame->device->getCursorControl(); ICursorControl* cursor = mainGame->device->getCursorControl();
if(cursor->getActiveIcon() != icon) { if(cursor->getActiveIcon() != icon) {
......
...@@ -146,6 +146,7 @@ public: ...@@ -146,6 +146,7 @@ public:
void SetWindowsIcon(); void SetWindowsIcon();
void FlashWindow(); void FlashWindow();
void takeScreenshot();
void SetCursor(ECURSOR_ICON icon); void SetCursor(ECURSOR_ICON icon);
Mutex gMutex; 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