OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4Startup.h
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2005-2009, RedWolf Design GmbH, http://www.clonk.de/
5  * Copyright (c) 2009-2016, The OpenClonk Team and contributors
6  *
7  * Distributed under the terms of the ISC license; see accompanying file
8  * "COPYING" for details.
9  *
10  * "Clonk" is a registered trademark of Matthes Bender, used with permission.
11  * See accompanying file "TRADEMARK" for details.
12  *
13  * To redistribute this file separately, substitute the full license texts
14  * for the above references.
15  */
16 // Startup screen for non-parameterized engine start
17 
18 #ifndef INC_C4Startup
19 #define INC_C4Startup
20 
21 #include "gui/C4Gui.h"
22 
23 #define C4CFN_StartupBackgroundMain "StartupMainMenuBG"
24 
25 // special colors for startup designs
26 const int32_t
27  C4StartupFontClr = 0xff000000,
29  C4StartupEditBGColor = 0x00000000,
31  C4StartupBtnFontClr = 0xff202020,
34 
35 // graphics needed only by startup
37 {
38 private:
39  bool LoadFile(C4FacetID &rToFct, const char *szFilename);
40 
41 public:
42  // backgrounds
43  C4FacetID fctPlrPropBG; // for player property subpage
44  C4FacetID fctAboutBG; // for about screen
46 
48 
49  // big buttons used in main menu
52 
53  // scroll bars in book
56 
57  // color preview
58  C4FacetID fctCrew, fctCrewClr; // ColorByOwner-surface of fctCrew
59 
60  // scenario selection: Scenario and folder icons
62  // scenario selection: Title overlay
64  // scenario selection and player selection book fonts
66 
67  // context button for combo boxes on white
69 
70  // options dlg gfx
72 
73  // net dlg gfx
75 
76  bool Init();
77  bool InitFonts();
78 
79  CStdFont &GetBlackFontByHeight(int32_t iHgt, float *pfZoom); // get optimal font for given control size
80 };
81 
82 // base class for all startup dialogs
84 {
85 public:
86  C4StartupDlg(const char *szTitle) : C4GUI::FullscreenDialog(szTitle, nullptr) {}
87 
88  virtual bool SetSubscreen(const char *szToScreen) { return false; } // go to specified subdialog, e.g. a specific property sheet in the options dlg
89  virtual void OnKeyboardLayoutChanged() {}
90  virtual void OnLeagueOptionChanged() {}
91 };
92 
93 class C4Startup
94 {
95 public:
96  C4Startup();
97  ~C4Startup();
98 
99 public:
101 
103 
104 private:
105  bool fInStartup, fLastDlgWasBack;
106  static C4Startup *pInstance; // singleton instance
107  static DialogID eLastDlgID;
108  static StdCopyStrBuf sSubDialog; // subdialog to go into (e.g.: property sheet in options dialog)
109 
110  C4StartupDlg *pLastDlg, *pCurrDlg; // startup dlg that is currently shown, and dialog that was last shown
111 
112 protected:
113  void DoStartup(); // create main dlg
114  void DontStartup(); // close main dlg
115  class C4StartupDlg *SwitchDialog(DialogID eToDlg, bool fFade=true, const char *szSubDialog=nullptr); // do transition to another dialog
116 
117  friend class C4StartupMainDlg;
118  friend class C4StartupNetDlg;
119  friend class C4StartupScenSelDlg;
120  friend class C4StartupOptionsDlg;
121  friend class C4StartupAboutDlg;
122  friend class C4StartupPlrSelDlg;
123 
124 public:
125  static C4Startup *EnsureLoaded(); // create and load startup data if not done yet
126  static void Unload(); // make sure startup data is destroyed
127  static void InitStartup();
128  static void CloseStartup();
129  static bool SetStartScreen(const char *szScreen); // set screen that is shown first by case insensitive identifier
131  void OnLeagueOptionChanged(); // callback from network options dialogue: Updates settings in scenario selction
132 
133  static C4Startup *Get() { assert(pInstance); return pInstance; }
134 
135 };
136 
137 #endif // INC_C4Startup
C4FacetID fctStartupLogo
Definition: C4Startup.h:47
CStdFont BookFontTitle
Definition: C4Startup.h:65
C4GUI::DynBarFacet barMainButtonsDown
Definition: C4Startup.h:51
const int32_t C4StartupBtnFontClr
Definition: C4Startup.h:31
C4FacetID fctDlgPaper
Definition: C4Startup.h:45
C4GUI::ScrollBarFacets sfctBookScrollB
Definition: C4Startup.h:55
C4FacetID fctScenSelTitleOverlay
Definition: C4Startup.h:63
static void Unload()
Definition: C4Startup.cpp:303
C4FacetID fctPlrPropBG
Definition: C4Startup.h:43
virtual void OnKeyboardLayoutChanged()
Definition: C4Startup.h:89
void OnKeyboardLayoutChanged()
Definition: C4Startup.cpp:350
static bool SetStartScreen(const char *szScreen)
Definition: C4Startup.cpp:322
const int32_t C4StartupEditBorderColor
Definition: C4Startup.h:30
const int32_t C4StartupFontClrDisabled
Definition: C4Startup.h:28
const int32_t C4StartupBtnBorderColor2
Definition: C4Startup.h:33
const int32_t C4StartupFontClr
Definition: C4Startup.h:27
C4FacetID fctScenSelIcons
Definition: C4Startup.h:61
C4GUI::ScrollBarFacets sfctBookScrollG
Definition: C4Startup.h:55
void OnLeagueOptionChanged()
Definition: C4Startup.cpp:356
void DoStartup()
Definition: C4Startup.cpp:221
CStdFont BookSmallFont
Definition: C4Startup.h:65
C4GUI::ScrollBarFacets sfctBookScrollR
Definition: C4Startup.h:55
C4FacetID fctOptionsIcons
Definition: C4Startup.h:71
C4FacetID fctMainButtonsDown
Definition: C4Startup.h:50
class C4StartupDlg * SwitchDialog(DialogID eToDlg, bool fFade=true, const char *szSubDialog=nullptr)
Definition: C4Startup.cpp:139
C4GUI::ScrollBarFacets sfctBookScroll
Definition: C4Startup.h:55
CStdFont BookFont
Definition: C4Startup.h:65
C4FacetID fctBookScroll
Definition: C4Startup.h:54
static void InitStartup()
Definition: C4Startup.cpp:309
void DontStartup()
Definition: C4Startup.cpp:260
C4StartupDlg(const char *szTitle)
Definition: C4Startup.h:86
FullscreenDialog(const char *szTitle, const char *szSubtitle)
const int32_t C4StartupEditBGColor
Definition: C4Startup.h:29
const int32_t C4StartupBtnBorderColor1
Definition: C4Startup.h:32
virtual void OnLeagueOptionChanged()
Definition: C4Startup.h:90
C4FacetID fctContext
Definition: C4Startup.h:68
static C4Startup * Get()
Definition: C4Startup.h:133
CStdFont & GetBlackFontByHeight(int32_t iHgt, float *pfZoom)
Definition: C4Startup.cpp:98
static void CloseStartup()
Definition: C4Startup.cpp:282
C4FacetID fctCrew
Definition: C4Startup.h:58
static C4Startup * EnsureLoaded()
Definition: C4Startup.cpp:287
C4FacetID fctNetGetRef
Definition: C4Startup.h:74
CStdFont BookFontCapt
Definition: C4Startup.h:65
C4FacetID fctOptionsTabClip
Definition: C4Startup.h:71
C4FacetID fctAboutBG
Definition: C4Startup.h:44
C4FacetID fctCrewClr
Definition: C4Startup.h:58
C4GUI::DynBarFacet barMainButtons
Definition: C4Startup.h:51
C4StartupGraphics Graphics
Definition: C4Startup.h:100
C4FacetID fctMainButtons
Definition: C4Startup.h:50
virtual bool SetSubscreen(const char *szToScreen)
Definition: C4Startup.h:88