OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
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  virtual void DrawElement(C4TargetFacet &cgo);
42  };
43 
44 public:
45  C4GoalDisplay(const C4Rect &rcBounds) : C4GUI::Window() { SetBounds(rcBounds); }
46  virtual ~C4GoalDisplay() {}
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  C4GoalDisplay *pGoalDisplay;
58  C4GUI::Label *pNetResultLabel; // label showing league result, disconnect, etc.
59  C4GUI::Button *pBtnExit, *pBtnContinue;
60  bool fIsNetDone; // set if league is evaluated and round results arrived
61  bool fIsQuitBtnVisible; // quit button available? set if not host or when fIsNetDone
62  bool fHasNextMissionButton; // continue button replaced by "next mission"-button?
63 
64 private:
65  void OnExitBtn(C4GUI::Control *btn); // callback: exit button pressed
66  void OnContinueBtn(C4GUI::Control *btn); // callback: continue button pressed
67 
68  void Update();
69  void SetNetResult(const char *szResultString, C4RoundResults::NetResult eResultType, size_t iPendingStreamingData, bool fIsStreaming);
70 
71 protected:
72  virtual void OnShown();
73  virtual void OnClosed(bool fOK);
74 
75  virtual bool OnEnter() { if (fIsQuitBtnVisible) OnExitBtn(nullptr); return true; } // enter on non-button: Always quit
76  virtual bool OnEscape() { if (fIsQuitBtnVisible) UserClose(false); return true; } // escape ignored if still streaming
77 
78  // true for dialogs that should span the whole screen
79  // not just the mouse-viewport
80  virtual bool IsFreePlaceDialog() { return true; }
81 
82  // true for dialogs that receive full keyboard and mouse input even in shared mode
83  virtual bool IsExclusiveDialog() { return true; }
84 
85  // sec1 timer
86  virtual void OnSec1Timer() { Update(); }
87 
88 public:
89  C4GameOverDlg();
91 
92  static bool IsShown() { return is_shown; }
93 };
94 
95 
96 #endif // INC_C4GameOverDlg
Definition: C4Rect.h:29
virtual void OnShown()
virtual bool OnEscape()
Definition: C4GameOverDlg.h:76
void SetGoals(const C4IDList &rAllGoals, const C4IDList &rFulfilledGoals, int32_t iGoalSymbolHeight)
bool fOK
Definition: C4Gui.h:2082
virtual bool IsExclusiveDialog()
Definition: C4GameOverDlg.h:83
C4Rect rcBounds
Definition: C4Gui.h:385
static bool IsShown()
Definition: C4GameOverDlg.h:92
virtual bool OnEnter()
Definition: C4GameOverDlg.h:75
Definition: C4Id.h:28
void SetBounds(const C4Rect &rcNewBound)
Definition: C4Gui.h:446
virtual ~C4GoalDisplay()
Definition: C4GameOverDlg.h:46
virtual void DrawElement(C4TargetFacet &cgo)
Definition: C4Gui.h:388
virtual void UserClose(bool fOK)
Definition: C4Gui.h:2206
virtual bool IsFreePlaceDialog()
Definition: C4GameOverDlg.h:80
virtual void OnClosed(bool fOK)
virtual void OnSec1Timer()
Definition: C4GameOverDlg.h:86
C4GoalDisplay(const C4Rect &rcBounds)
Definition: C4GameOverDlg.h:45