Remove screenshot functionality
It was only meant for debugging and brought with it unneeded platform dependant issues.
This commit is contained in:
parent
1ef6e04520
commit
f11cc182df
|
@ -35,7 +35,6 @@ namespace po = boost::program_options;
|
||||||
|
|
||||||
Config::Config()
|
Config::Config()
|
||||||
: debugMode(false),
|
: debugMode(false),
|
||||||
screenshots(false),
|
|
||||||
winResizable(false),
|
winResizable(false),
|
||||||
fullscreen(false),
|
fullscreen(false),
|
||||||
fixedAspectRatio(true),
|
fixedAspectRatio(true),
|
||||||
|
@ -56,7 +55,6 @@ void Config::read(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#define PO_DESC_ALL \
|
#define PO_DESC_ALL \
|
||||||
PO_DESC(debugMode, bool) \
|
PO_DESC(debugMode, bool) \
|
||||||
PO_DESC(screenshots, bool) \
|
|
||||||
PO_DESC(winResizable, bool) \
|
PO_DESC(winResizable, bool) \
|
||||||
PO_DESC(fullscreen, bool) \
|
PO_DESC(fullscreen, bool) \
|
||||||
PO_DESC(fixedAspectRatio, bool) \
|
PO_DESC(fixedAspectRatio, bool) \
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
struct Config
|
struct Config
|
||||||
{
|
{
|
||||||
bool debugMode;
|
bool debugMode;
|
||||||
bool screenshots;
|
|
||||||
|
|
||||||
bool winResizable;
|
bool winResizable;
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
|
|
|
@ -209,9 +209,6 @@ void EventThread::process(RGSSThreadData &rtData)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.key.keysym.scancode == SDL_SCANCODE_F3 && rtData.config.screenshots)
|
|
||||||
rtData.rqScreenshot = true;
|
|
||||||
|
|
||||||
keyStates[event.key.keysym.scancode] = true;
|
keyStates[event.key.keysym.scancode] = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -178,8 +178,6 @@ struct RGSSThreadData
|
||||||
|
|
||||||
std::string rgssErrorMsg;
|
std::string rgssErrorMsg;
|
||||||
|
|
||||||
volatile bool rqScreenshot;
|
|
||||||
|
|
||||||
RGSSThreadData(EventThread *ethread,
|
RGSSThreadData(EventThread *ethread,
|
||||||
const char *argv0,
|
const char *argv0,
|
||||||
SDL_Window *window,
|
SDL_Window *window,
|
||||||
|
@ -190,8 +188,7 @@ struct RGSSThreadData
|
||||||
argv0(argv0),
|
argv0(argv0),
|
||||||
window(window),
|
window(window),
|
||||||
sizeResoRatio(1, 1),
|
sizeResoRatio(1, 1),
|
||||||
config(newconf),
|
config(newconf)
|
||||||
rqScreenshot(false)
|
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -507,44 +507,6 @@ struct GraphicsPrivate
|
||||||
|
|
||||||
swapGLBuffer();
|
swapGLBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeScreenshot(const char *filename)
|
|
||||||
{
|
|
||||||
int bpp;
|
|
||||||
uint32_t rm, gm, bm, am;
|
|
||||||
SDL_PixelFormatEnumToMasks(SDL_PIXELFORMAT_ABGR8888, &bpp, &rm, &gm, &bm, &am);
|
|
||||||
|
|
||||||
/* Discard alpha channel because it might have bogus values */
|
|
||||||
SDL_Surface *screenshot =
|
|
||||||
SDL_CreateRGBSurface(0, scRes.x, scRes.y, bpp, rm, gm, bm, 0);
|
|
||||||
|
|
||||||
screen.getPP().bindLastBuffer();
|
|
||||||
|
|
||||||
glReadPixels(0, 0, scRes.x, scRes.y, GL_RGBA, GL_UNSIGNED_BYTE, screenshot->pixels);
|
|
||||||
|
|
||||||
IMG_SavePNG(screenshot, filename);
|
|
||||||
|
|
||||||
SDL_FreeSurface(screenshot);
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkScreenshotRq()
|
|
||||||
{
|
|
||||||
if (!threadData->rqScreenshot)
|
|
||||||
return;
|
|
||||||
|
|
||||||
threadData->rqScreenshot = false;
|
|
||||||
|
|
||||||
struct timeval tv;
|
|
||||||
gettimeofday(&tv, 0);
|
|
||||||
struct tm tm = *localtime(&tv.tv_sec);
|
|
||||||
|
|
||||||
char filename[32];
|
|
||||||
|
|
||||||
snprintf(filename, sizeof(filename), "%d%02d%02d-%02d%02d%02d.png",
|
|
||||||
tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
|
|
||||||
|
|
||||||
writeScreenshot(filename);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Graphics::Graphics(RGSSThreadData *data)
|
Graphics::Graphics(RGSSThreadData *data)
|
||||||
|
@ -568,8 +530,6 @@ void Graphics::update()
|
||||||
// p->cpuTimer->endTiming();
|
// p->cpuTimer->endTiming();
|
||||||
// p->gpuTimer->startTiming();
|
// p->gpuTimer->startTiming();
|
||||||
|
|
||||||
p->checkScreenshotRq();
|
|
||||||
|
|
||||||
if (p->frozen)
|
if (p->frozen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue