OpenClonk
C4GraphicsResource.h
Go to the documentation of this file.
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 /* Loads all standard graphics from Graphics.ocg */
19 
20 #ifndef INC_C4GraphicsResource
21 #define INC_C4GraphicsResource
22 
23 #include "c4group/C4GroupSet.h"
24 #include "graphics/C4Surface.h"
25 #include "graphics/C4FacetEx.h"
26 #include "gui/C4Gui.h"
27 #include "player/C4Achievement.h"
28 
30 {
31 private:
32  bool fInitialized;
33 public:
36 protected:
41  int32_t idSfcControl; // id of source group of control surface
42  // ID of last group in main group set that was already registered into the Files-set
43  // used to avoid doubled entries by subsequent calls to RegisterMainGroups
45 public:
53  int32_t iNumRanks;
77  C4FacetID fctCrewClr; // ColorByOwner-surface of fctCrew
78  C4FacetID fctFlagClr; // ColorByOwner-surface of fctFlag
79  C4FacetID fctPlayerClr; // ColorByOwner-surface of fctPlayer
80 
92 
93  // fonts
94  CStdFont &CaptionFont; // small, bold font
95  CStdFont &TitleFont; // large, bold font
96  CStdFont &TextFont; // font for normal text
97  CStdFont &MiniFont; // tiny font (logfont)
98  CStdFont &TooltipFont; // same as BookFont
99  CStdFont FontTiny; // used for logs
100  CStdFont FontRegular; // normal font - just refed from graphics system
101  CStdFont FontCaption; // used for title bars
102  CStdFont FontTitle; // huge font for titles
103  CStdFont FontTooltip; // normal, non-shadowed font (same as BookFont)
104 
105  // achievement graphics
107 public:
108  CStdFont &GetFontByHeight(int32_t iHgt, float *pfZoom=nullptr); // get optimal font for given control size
109  void Default();
110  void Clear();
111  bool InitFonts();
112  void ClearFonts(); // clear fonts ()
113  bool Init();
114 
115  bool IsInitialized() { return fInitialized; } // return whether any gfx are loaded (so dlgs can be shown)
116 
117  bool RegisterGlobalGraphics(); // register global Graphics.ocg into own group set
118  bool RegisterMainGroups(); // register new groups of Game.GroupSet into own group set
119  void CloseFiles(); // free group set
120 
121  bool ReloadResolutionDependantFiles(); // reload any files that depend on the current resolution
122 
123 protected:
124  bool LoadFile(C4FacetID& fct, const char *szName, C4GroupSet &rGfxSet, int32_t iWdt, int32_t iHgt, bool fNoWarnIfNotFound, int iFlags);
125  bool LoadFile(C4Surface& sfc, const char *szName, C4GroupSet &rGfxSet, int32_t &ridCurrSfc, int iFlags);
126  bool FindLoadRes(C4Group *pSecondFile, const char *szName);
127  bool LoadCursorGfx();
128 
129  friend class C4StartupGraphics;
130 };
131 
133 #define GfxR (&(::GraphicsResource))
134 #endif
C4GraphicsResource GraphicsResource
int32_t idRegisteredMainGroupSetFiles
CStdFont & GetFontByHeight(int32_t iHgt, float *pfZoom=nullptr)
C4AchievementGraphics Achievements
C4GUI::DynBarFacet barButton
bool FindLoadRes(C4Group *pSecondFile, const char *szName)
C4FacetID fctButtonHighlightRound
bool LoadFile(C4FacetID &fct, const char *szName, C4GroupSet &rGfxSet, int32_t iWdt, int32_t iHgt, bool fNoWarnIfNotFound, int iFlags)
C4GUI::ScrollBarFacets sfctScroll
C4GUI::DynBarFacet barButtonD
C4GUI::DynBarFacet barCaption