mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-22 15:02:20 +00:00
[CHG] Added a timestamp to the screenshot function in the TTF example
This commit is contained in:
parent
d58f2d2c76
commit
f229e1b581
1 changed files with 16 additions and 2 deletions
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
// Prototype
|
// Prototype
|
||||||
static u8 CalculateFrameRate();
|
static u8 CalculateFrameRate();
|
||||||
|
static bool ScreenShot();
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
char FPS[255] = "";
|
char FPS[255] = "";
|
||||||
|
@ -77,12 +78,12 @@ int main(int argc, char **argv) {
|
||||||
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A) {
|
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_A) {
|
||||||
GRRLIB_Screen2Texture(0, 0, CopiedImg, false);
|
GRRLIB_Screen2Texture(0, 0, CopiedImg, false);
|
||||||
}
|
}
|
||||||
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_1) {
|
if (WPAD_ButtonsDown(0) & WPAD_BUTTON_B) {
|
||||||
ShowFPS = !ShowFPS;
|
ShowFPS = !ShowFPS;
|
||||||
}
|
}
|
||||||
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_1 && WPAD_ButtonsHeld(0) & WPAD_BUTTON_2) {
|
if(WPAD_ButtonsHeld(0) & WPAD_BUTTON_1 && WPAD_ButtonsHeld(0) & WPAD_BUTTON_2) {
|
||||||
WPAD_Rumble(0, true); // Rumble on
|
WPAD_Rumble(0, true); // Rumble on
|
||||||
GRRLIB_ScrShot("sd:/grrlib_ttf.png"); // Needs to be after GRRLIB_Render()
|
ScreenShot(); // Needs to be after GRRLIB_Render()
|
||||||
WPAD_Rumble(0, false); // Rumble off
|
WPAD_Rumble(0, false); // Rumble off
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,3 +113,16 @@ static u8 CalculateFrameRate() {
|
||||||
}
|
}
|
||||||
return FPS;
|
return FPS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a PNG screenshot on the root of the SD card with a timestamp.
|
||||||
|
* @return bool true=everything worked, false=problems occurred.
|
||||||
|
*/
|
||||||
|
static bool ScreenShot() {
|
||||||
|
char path[255];
|
||||||
|
time_t now = time(NULL);
|
||||||
|
struct tm *ti = localtime(&now);
|
||||||
|
sprintf(path, "sd:/grrlib_ttf_%d%02d%02d%02d%02d%02d.png",
|
||||||
|
ti->tm_year + 1900, ti->tm_mon + 1, ti->tm_mday, ti->tm_hour, ti->tm_min, ti->tm_sec);
|
||||||
|
return GRRLIB_ScrShot(path);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue