OpenClonk
C4GameOverDlg.h
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2008-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 // game over dialog showing winners and losers
17 
18 #ifndef INC_C4GameOverDlg
19 #define INC_C4GameOverDlg
20 
21 #include "gui/C4Gui.h"
22 #include "control/C4RoundResults.h"
23 
24 // horizontal display of goal symbols; filfilled goals marked
25 // maybe to be reused for a game goal dialog?
27 {
28 private:
29  // element that draws one goal
30  class GoalPicture : public C4GUI::Window
31  {
32  private:
33  C4ID idGoal;
34  bool fFulfilled;
35  C4FacetSurface Picture;
36 
37  public:
38  GoalPicture(const C4Rect &rcBounds, C4ID idGoal, bool fFulfilled);
39 
40  protected:
41  void DrawElement(C4TargetFacet &cgo) override;
42  };
43 
44 public:
46  ~C4GoalDisplay() override = default;
47 
48  void SetGoals(const C4IDList &rAllGoals, const C4IDList &rFulfilledGoals, int32_t iGoalSymbolHeight);
49 };
50 
52 {
53 private:
54  static bool is_shown;
55  int32_t iPlrListCount;
56  class C4PlayerInfoListBox **ppPlayerLists;
57  C4GUI::Label *pNetResultLabel{nullptr}; // label showing league result, disconnect, etc.
58  C4GUI::Button *pBtnExit, *pBtnContinue;
59  bool fIsNetDone{false}; // set if league is evaluated and round results arrived
60  bool fIsQuitBtnVisible; // quit button available? set if not host or when fIsNetDone
61  bool fHasNextMissionButton{false}; // continue button replaced by "next mission"-button?
62 
63 private:
64  void OnExitBtn(C4GUI::Control *btn); // callback: exit button pressed
65  void OnContinueBtn(C4GUI::Control *btn); // callback: continue button pressed
66 
67  void Update();
68  void SetNetResult(const char *szResultString, C4RoundResults::NetResult eResultType, size_t iPendingStreamingData, bool fIsStreaming);
69 
70 protected:
71  void OnShown() override;
72  void OnClosed(bool fOK) override;
73 
74  bool OnEnter() override { if (fIsQuitBtnVisible) OnExitBtn(nullptr); return true; } // enter on non-button: Always quit
75  bool OnEscape() override { if (fIsQuitBtnVisible) UserClose(false); return true; } // escape ignored if still streaming
76 
77  // true for dialogs that should span the whole screen
78  // not just the mouse-viewport
79  bool IsFreePlaceDialog() override { return true; }
80 
81  // true for dialogs that receive full keyboard and mouse input even in shared mode
82  bool IsExclusiveDialog() override { return true; }
83 
84  // sec1 timer
85  void OnSec1Timer() override { Update(); }
86 
87 public:
88  C4GameOverDlg();
89  ~C4GameOverDlg() override;
90 
91  static bool IsShown() { return is_shown; }
92 };
93 
94 
95 #endif // INC_C4GameOverDlg
virtual void UserClose(bool fOK)
Definition: C4Gui.h:2207
bool fOK
Definition: C4Gui.h:2083
virtual void DrawElement(C4TargetFacet &cgo)
Definition: C4Gui.h:388
C4Rect rcBounds
Definition: C4Gui.h:385
void SetBounds(const C4Rect &rcNewBound)
Definition: C4Gui.h:446
static bool IsShown()
Definition: C4GameOverDlg.h:91
bool IsExclusiveDialog() override
Definition: C4GameOverDlg.h:82
bool OnEscape() override
Definition: C4GameOverDlg.h:75
~C4GameOverDlg() override
void OnClosed(bool fOK) override
void OnSec1Timer() override
Definition: C4GameOverDlg.h:85
bool OnEnter() override
Definition: C4GameOverDlg.h:74
bool IsFreePlaceDialog() override
Definition: C4GameOverDlg.h:79
void OnShown() override
C4GoalDisplay(const C4Rect &rcBounds)
Definition: C4GameOverDlg.h:45
~C4GoalDisplay() override=default
void SetGoals(const C4IDList &rAllGoals, const C4IDList &rFulfilledGoals, int32_t iGoalSymbolHeight)
Definition: C4Id.h:26
Definition: C4Rect.h:28