Commit d0f5852d authored by nanahira's avatar nanahira

first one - record to file

parent 7af7ae23
......@@ -882,6 +882,9 @@ bool Game::Initialize() {
}
hideChat = false;
hideChatTimer = 0;
screenshotSequence = 0;
sprintf(screenshotDirectory, "screenshots/ygopro_%u", device->getTimer()->getRealTime());
FileSystem::MakeDir(screenshotDirectory);
return true;
}
void Game::MainLoop() {
......@@ -980,6 +983,7 @@ void Game::MainLoop() {
DuelClient::try_needed = false;
DuelClient::StartClient(DuelClient::temp_ip, DuelClient::temp_port, false);
}
takeScreenshotLoop();
}
DuelClient::StopClient(true);
if(dInfo.isSingleMode)
......@@ -2200,6 +2204,17 @@ void Game::takeScreenshot() {
} else
device->getLogger()->log(L"Failed to take screenshot.", irr::ELL_WARNING);
}
void Game::takeScreenshotLoop() {
irr::video::IImage* const image = driver->createScreenShot();
const unsigned int currentSequence = ++screenshotSequence;
if(image) {
irr::c8 filename[64];
snprintf(filename, 64, "%s/%u.bmp", screenshotDirectory, currentSequence);
driver->writeImageToFile(image, filename);
image->drop();
} else
device->getLogger()->log(L"Failed to take loop screenshot.", irr::ELL_WARNING);
}
bool Game::CheckRegEx(const std::wstring& text, const std::wstring& exp, bool exact) {
if(!gameConf.search_regex)
return false;
......
......@@ -214,6 +214,7 @@ public:
void SetWindowsScale(float scale);
void FlashWindow();
void takeScreenshot();
void takeScreenshotLoop();
void SetCursor(ECURSOR_ICON icon);
std::mutex gMutex;
......@@ -259,6 +260,8 @@ public:
bool always_chain;
bool ignore_chain;
bool chain_when_avail;
unsigned int screenshotSequence;
char screenshotDirectory[64];
bool is_building;
bool is_siding;
......
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