/src/C4GraphicsSystem.h
C Header | 125 lines | 95 code | 9 blank | 21 comment | 0 complexity | 0d3f255f40adf13be9665c1e5cf92cd1 MD5 | raw file
Possible License(s): WTFPL, 0BSD, LGPL-2.1, CC-BY-3.0
1/*
2 * OpenClonk, http://www.openclonk.org
3 *
4 * Copyright (c) 1998-2000, 2008 Matthes Bender
5 * Copyright (c) 2001, 2005, 2008 Sven Eberhardt
6 * Copyright (c) 2005 G?nther Brammer
7 * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
8 *
9 * Portions might be copyrighted by other authors who have contributed
10 * to OpenClonk.
11 *
12 * Permission to use, copy, modify, and/or distribute this software for any
13 * purpose with or without fee is hereby granted, provided that the above
14 * copyright notice and this permission notice appear in all copies.
15 * See isc_license.txt for full license and disclaimer.
16 *
17 * "Clonk" is a registered trademark of Matthes Bender.
18 * See clonk_trademark_license.txt for full license.
19 */
20
21/* Operates viewports, message board and draws the game */
22
23#ifndef INC_C4GraphicsSystem
24#define INC_C4GraphicsSystem
25
26#include <C4FacetEx.h>
27#include <C4MessageBoard.h>
28#include <C4UpperBoard.h>
29#include <C4Video.h>
30#include <C4Shape.h>
31
32class C4Game;
33class C4LoaderScreen;
34extern C4Game Game;
35
36const float C4GFX_ZoomStep = 1.1040895f;
37
38class C4GraphicsSystem
39 {
40 public:
41 C4GraphicsSystem();
42 ~C4GraphicsSystem();
43 C4MessageBoard MessageBoard;
44 C4UpperBoard UpperBoard;
45 int32_t iRedrawBackground;
46 bool ShowHelp;
47 bool ShowVertices;
48 bool ShowAction;
49 bool ShowCommand;
50 bool ShowEntrance;
51 bool ShowPathfinder;
52 bool ShowNetstatus;
53 bool ShowSolidMask;
54 BYTE DarkColorTable[256];
55 bool fSetPalette;
56 uint32_t dwGamma[C4MaxGammaRamps*3]; // gamma ramps
57 bool fSetGamma; // must gamma ramp be reassigned?
58 C4Video Video;
59 C4LoaderScreen *pLoaderScreen;
60 void Default();
61 void Clear();
62 bool StartDrawing();
63 void FinishDrawing();
64 void Execute();
65 void FlashMessage(const char *szMessage);
66 void FlashMessageOnOff(const char *strWhat, bool fOn);
67 void SetDarkColorTable();
68 void DeactivateDebugOutput();
69 void MouseMove(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam, class C4Viewport *pVP); // pVP specified for console mode viewports only
70 void SetMouseInGUI(bool fInGUI, bool fByMouse);
71 void SortViewportsByPlayerControl();
72 void ClearPointers(C4Object *pObj);
73 //void UpdateMouse(HWND hwnd, int32_t iX, int32_t iY, int32_t iB);
74 void RecalculateViewports();
75 bool Init();
76 bool InitLoaderScreen(const char *szLoaderSpec, bool fDrawBlackScreenFirst);
77 void EnableLoaderDrawing(); // reset black screen loader flag
78 bool SaveScreenshot(bool fSaveAll);
79 bool DoSaveScreenshot(bool fSaveAll, const char *szFilename);
80 bool SetPalette();
81 bool CreateViewport(int32_t iPlayer, bool fSilent);
82 bool CloseViewport(int32_t iPlayer, bool fSilent);
83 int32_t GetAudibility(int32_t iX, int32_t iY, int32_t *iPan, int32_t iAudibilityRadius=0);
84 int32_t GetViewportCount();
85 C4Viewport* GetViewport(int32_t iPlayer);
86 C4Viewport* GetFirstViewport() { return FirstViewport; }
87 inline void InvalidateBg() { iRedrawBackground=2; }
88 inline void OverwriteBg() { InvalidateBg(); }
89 void SetGamma(DWORD dwClr1, DWORD dwClr2, DWORD dwClr3, int32_t iRampIndex); // set gamma ramp
90 void ApplyGamma(); // apply gamma ramp to ddraw
91 bool CloseViewport(C4Viewport * cvp);
92#ifdef _WIN32
93 C4Viewport* GetViewport(HWND hwnd);
94 BOOL RegisterViewportClass(HINSTANCE hInst);
95#endif
96 protected:
97 C4Viewport *FirstViewport;
98 bool fViewportClassRegistered;
99 C4Facet ViewportArea;
100 C4RectList BackgroundAreas; // rectangles covering background without viewports in fullscreen
101 char FlashMessageText[C4MaxTitle+1];
102 int32_t FlashMessageTime,FlashMessageX,FlashMessageY;
103 void DrawHelp();
104 void DrawFlashMessage();
105 void DrawHoldMessages();
106 void DrawFullscreenBackground();
107 void ClearFullscreenBackground();
108 int32_t SeekLoaderScreens(C4Group &rFromGrp, const char *szWildcard, int32_t iLoaderCount, char *szDstName, C4Group **ppDestGrp);
109 void MouseMoveToViewport(int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam);
110
111 public:
112 bool ToggleShowSolidMask();
113 bool ToggleShowNetStatus();
114 bool ToggleShowVertices();
115 bool ToggleShowAction();
116 bool ViewportNextPlayer();
117 bool ToggleShowHelp();
118
119 bool FreeScroll(C4Vec2D vScrollBy); // key callback: Scroll ownerless viewport by some offset
120 bool ViewportZoomOut();
121 bool ViewportZoomIn();
122 };
123
124extern C4GraphicsSystem GraphicsSystem;
125#endif