summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b4b66ea)
raw | patch | inline | side by side (parent: b4b66ea)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 2 Nov 2019 19:47:05 +0000 (22:47 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 2 Nov 2019 19:47:05 +0000 (22:47 +0300) |
src/game/g_game.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index ec7f8f29831e03151a1da5bf2f1227a134d51964..63fc317b1a3718b5258c9cd0cd3a566f45e03a6b 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
end;
procedure g_TakeScreenShot;
- var s: TStream; t: TDateTime; date, name: String;
+ var s: TStream; t: TDateTime; dir, date, name: String;
begin
if e_NoGraphics then Exit;
- t := Now;
- DateTimeToString(date, 'yyyy-mm-dd-hh-nn-ss', t);
- name := 'screenshot-' + date + '.png';
try
- s := e_CreateResource(ScreenshotDirs, name);
- e_MakeScreenshot(s, gScreenWidth, gScreenHeight);
- g_Console_Add(Format(_lc[I_CONSOLE_SCREENSHOT], [name]))
+ t := Now;
+ dir := e_GetWriteableDir(ScreenshotDirs);
+ DateTimeToString(date, 'yyyy-mm-dd-hh-nn-ss', t);
+ name := e_CatPath(dir, 'screenshot-' + date + '.png');
+ s := createDiskFile(name);
+ try
+ e_MakeScreenshot(s, gScreenWidth, gScreenHeight);
+ s.Free;
+ g_Console_Add(Format(_lc[I_CONSOLE_SCREENSHOT], [name]))
+ except
+ g_Console_Add(Format(_lc[I_CONSOLE_ERROR_WRITE], [name]));
+ s.Free;
+ DeleteFile(name)
+ end
except
g_Console_Add('oh shit, i can''t create screenshot!')
end