Screenshot save path update.

This commit is contained in:
Steve 2016-03-06 09:48:09 +00:00
parent 922b39c0ea
commit c14b687209
7 changed files with 18 additions and 2 deletions

View File

@ -14,4 +14,4 @@ to access some (rather crude) debugging and development stuff, activated by pres
* [6] - Immediately complete the current mission * [6] - Immediately complete the current mission
* [9] - Show the current frames per second * [9] - Show the current frames per second
* [0] - Take a screenshot once per second. Assumes the existance of dev/screenshots/tmp relative to the game's binary * [0] - Take a screenshot once per second, saving to /tmp/tbftss on Linux.

View File

@ -189,7 +189,7 @@ void saveScreenshot(void)
char filename[MAX_NAME_LENGTH]; char filename[MAX_NAME_LENGTH];
SDL_Surface *sshot; SDL_Surface *sshot;
sprintf(filename, "dev/screenshots/tmp/%d.bmp", ++i); sprintf(filename, "/tmp/tbftss/%d.bmp", ++i);
sshot = SDL_CreateRGBSurface(0, SCREEN_WIDTH, SCREEN_HEIGHT, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); sshot = SDL_CreateRGBSurface(0, SCREEN_WIDTH, SCREEN_HEIGHT, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
SDL_RenderReadPixels(app.renderer, NULL, SDL_PIXELFORMAT_ARGB8888, sshot->pixels, sshot->pitch); SDL_RenderReadPixels(app.renderer, NULL, SDL_PIXELFORMAT_ARGB8888, sshot->pixels, sshot->pitch);

View File

@ -167,6 +167,8 @@ static void handleArguments(int argc, char *argv[])
if (strcmp(argv[i], "-debug") == 0) if (strcmp(argv[i], "-debug") == 0)
{ {
dev.debug = 1; dev.debug = 1;
createScreenshotFolder();
} }
} }
} }

View File

@ -48,6 +48,7 @@ extern void initLookups(void);
extern void initGame(void); extern void initGame(void);
extern void doKeyDown(SDL_KeyboardEvent *event); extern void doKeyDown(SDL_KeyboardEvent *event);
extern void doKeyUp(SDL_KeyboardEvent *event); extern void doKeyUp(SDL_KeyboardEvent *event);
extern void createScreenshotFolder(void);
App app; App app;
Colors colors; Colors colors;

View File

@ -44,3 +44,10 @@ void createSaveFolder(void)
STRNCPY(app.saveDir, dir, MAX_FILENAME_LENGTH); STRNCPY(app.saveDir, dir, MAX_FILENAME_LENGTH);
} }
void createScreenshotFolder(void)
{
mkdir("/tmp/tbftss", S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH);
dev.screenshotFolder = "/tmp/tbftss";
}

View File

@ -26,3 +26,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../common.h" #include "../../common.h"
extern App app; extern App app;
extern Dev dev;

View File

@ -44,3 +44,8 @@ void createSaveFolder(void)
STRNCPY(app.saveDir, dir, MAX_FILENAME_LENGTH); STRNCPY(app.saveDir, dir, MAX_FILENAME_LENGTH);
} }
void createScreenshotFolder(void)
{
dev.screenshotFolder = "./";
}