1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 1998-2000, Matthes Bender
5  * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
6  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
7  *
8  * Distributed under the terms of the ISC license; see accompanying file
9  * "COPYING" for details.
10  *
11  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
12  * See accompanying file "TRADEMARK" for details.
13  *
14  * To redistribute this file separately, substitute the full license texts
15  * for the above references.
16  */
17 
18 /* Operates viewports, message board and draws the game */
19 
20 #ifndef INC_C4GraphicsSystem
21 #define INC_C4GraphicsSystem
22 
23 #include "gui/C4MessageBoard.h"
24 #include "gui/C4UpperBoard.h"
25 
26 class C4GraphicsSystem
27 {
28 public:
29 	C4GraphicsSystem();
30 	~C4GraphicsSystem();
31 	std::unique_ptr<C4MessageBoard> MessageBoard;
32 	C4UpperBoard UpperBoard;
33 	int32_t iRedrawBackground;
34 	bool ShowHelp;
35 	bool ShowVertices;
36 	bool ShowAction;
37 	bool ShowCommand;
38 	bool ShowEntrance;
39 	bool ShowPathfinder;
40 	bool ShowNetstatus;
41 	int Show8BitSurface; // 0 normal, 1 foreground mats, 2 background mats
42 	bool ShowLights;
43 	bool ShowMenuInfo;
44 	C4LoaderScreen *pLoaderScreen;
45 	void Default();
46 	void Clear();
47 	bool StartDrawing();
48 	void FinishDrawing();
49 	void Execute();
50 	void FlashMessage(const char *szMessage);
51 	void FlashMessageOnOff(const char *strWhat, bool fOn);
52 	void DeactivateDebugOutput();
53 	bool Init();
54 	bool InitLoaderScreen(const char *szLoaderSpec);
55 	void EnableLoaderDrawing(); // reset black screen loader flag
SaveScreenshotKey(bool fSaveAll)56 	bool SaveScreenshotKey(bool fSaveAll) { return SaveScreenshot(fSaveAll, 2.0f); } // keyboard callback for creating screenshot. create at default zoom.
57 	bool SaveScreenshot(bool fSaveAll, float fSaveAllZoom);
58 	bool DoSaveScreenshot(bool fSaveAll, const char *szFilename, float fSaveAllZoom);
InvalidateBg()59 	inline void InvalidateBg() { iRedrawBackground=2; }
OverwriteBg()60 	inline void OverwriteBg() { InvalidateBg(); }
61 
62 private:
63 	char FlashMessageText[C4MaxTitle+1];
64 	int32_t FlashMessageTime,FlashMessageX,FlashMessageY;
65 	void DrawHelp();
66 	void DrawFlashMessage();
67 	void DrawHoldMessages();
68 	void ClearFullscreenBackground();
69 
70 	C4TimeMilliseconds lastFrame;
71 
72 public:
73 	bool ToggleShow8BitSurface();
74 	bool ToggleShowNetStatus();
75 	bool ToggleShowVertices();
76 	bool ToggleShowAction();
77 	bool ToggleShowHelp();
78 	friend class C4FullScreen;
79 };
80 
81 extern C4GraphicsSystem GraphicsSystem;
82 #endif
83