summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 97c3057)
raw | patch | inline | side by side (parent: 97c3057)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Mon, 17 Jan 2022 17:29:32 +0000 (20:29 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 9 Jun 2023 07:53:57 +0000 (10:53 +0300) |
src/game/g_game.pas | patch | blob | history | |
src/game/opengl/r_render.pas | patch | blob | history |
diff --git a/src/game/g_game.pas b/src/game/g_game.pas
index 70321ddf707b89127dca6ab97bf6eaaa7e4cf719..11defaef712db172c478ce77c413ca20cb30725f 100644 (file)
--- a/src/game/g_game.pas
+++ b/src/game/g_game.pas
-(* Copyright (C) Doom 2D: Forever Developers
+ (* Copyright (C) Doom 2D: Forever Developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
end;
procedure g_TakeScreenShot(Filename: string = '');
- var s: TStream; t: TDateTime; dir, date, name: String;
+ var t: TDateTime; dir, date, name: String;
begin
- if e_NoGraphics then Exit;
- try
- dir := e_GetWriteableDir(ScreenshotDirs);
+ if e_NoGraphics then
+ Exit;
- if Filename = '' then
- begin
- t := Now;
- DateTimeToString(date, 'yyyy-mm-dd-hh-nn-ss', t);
- Filename := 'screenshot-' + date;
- end;
-
- name := e_CatPath(dir, Filename + '.png');
- s := createDiskFile(name);
- try
- e_MakeScreenshot(s, gWinSizeX, gWinSizeY);
- 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
+ dir := e_GetWriteableDir(ScreenshotDirs);
+ if Filename = '' then
+ begin
+ t := Now;
+ DateTimeToString(date, 'yyyy-mm-dd-hh-nn-ss', t);
+ Filename := 'screenshot-' + date;
+ end;
+
+ name := e_CatPath(dir, Filename + '.png');
+ if r_Render_WriteScreenShot(name) then
+ g_Console_Add(Format(_lc[I_CONSOLE_SCREENSHOT], [name]))
+ else
+ g_Console_Add(Format(_lc[I_CONSOLE_ERROR_WRITE], [name]));
end;
procedure g_Game_InGameMenu(Show: Boolean);
index 90bda3b04a230a27abceb3ad4e651b518a5fad7e..3535a2d2969b02b4559b2fdef0bf5e870aa4259c 100644 (file)
procedure r_Render_LoadTextures;
procedure r_Render_FreeTextures;
- procedure r_Render_Resize (w, h: Integer);
-
procedure r_Render_Update;
+ procedure r_Render_Resize (w, h: Integer);
procedure r_Render_Apply;
+ function r_Render_WriteScreenShot (filename: String): Boolean;
+
implementation
uses
{$INCLUDE ../../nogl/noGLuses.inc}
SysUtils, Classes, Math,
- e_log, g_system,
+ e_log, g_system, utils,
g_game, g_options, g_console,
r_window, r_graphics, r_console, r_playermodel, r_textures, r_animations,
r_weapons, r_items, r_gfx, r_monsters, r_map, r_player, r_game
sys_EnableVSync(gVSync)
end;
+ function r_Render_WriteScreenShot (filename: String): Boolean;
+ var s: TStream;
+ begin
+ Result := False;
+ try
+ s := CreateDiskFile(filename);
+ try
+ e_MakeScreenshot(s, gWinSizeX, gWinSizeX);
+ Result := True;
+ except
+ DeleteFile(filename)
+ end;
+ s.Free;
+ finally
+ end
+ end;
+
end.