OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4FullScreen Class Reference

#include <C4FullScreen.h>

Inheritance diagram for C4FullScreen:
[legend]
Collaboration diagram for C4FullScreen:
[legend]

Public Types

enum  WindowKind {
  W_GuiWindow, W_Console, W_Viewport, W_Fullscreen,
  W_Control
}
 

Public Member Functions

 C4FullScreen ()
 
 ~C4FullScreen () override
 
void Execute ()
 
bool ViewportCheck ()
 
bool ShowAbortDlg ()
 
bool ActivateMenuMain ()
 
void CloseMenu ()
 
bool MenuKeyControl (BYTE byCom)
 
C4WindowInit (C4AbstractApp *pApp)
 
void Close () override
 
void Clear () override
 
void CharIn (const char *c) override
 
void PerformUpdate () override
 
virtual bool ReInit (C4AbstractApp *pApp)
 
virtual void EnumerateMultiSamples (std::vector< int > &samples) const
 
bool StorePosition (const char *szWindowName, const char *szSubKey, bool fStoreSize=true)
 
bool RestorePosition (const char *szWindowName, const char *szSubKey, bool fHidden=false)
 
bool GetSize (C4Rect *pRect)
 
void SetSize (unsigned int cx, unsigned int cy)
 
void SetTitle (const char *Title)
 
void FlashWindow ()
 
void GrabMouse (bool grab)
 
virtual void RequestUpdate ()
 

Public Attributes

C4MainMenupMenu
 
bool Active {false}
 
C4SurfacepSurface {nullptr}
 
WindowKind eKind
 

Protected Member Functions

virtual C4WindowInit (WindowKind windowKind, C4AbstractApp *pApp, const char *Title, const C4Rect *size)
 

Detailed Description

Definition at line 27 of file C4FullScreen.h.

Member Enumeration Documentation

enum C4Window::WindowKind
inherited
Enumerator
W_GuiWindow 
W_Console 
W_Viewport 
W_Fullscreen 
W_Control 

Definition at line 262 of file C4Window.h.

263  {
264  W_GuiWindow,
265  W_Console,
266  W_Viewport,
267  W_Fullscreen,
268  W_Control // wrapper to a render target control inside a window
269  };

Constructor & Destructor Documentation

C4FullScreen::C4FullScreen ( )

Definition at line 36 of file C4FullScreen.cpp.

References pMenu.

37 {
38  pMenu = nullptr;
39 }
C4MainMenu * pMenu
Definition: C4FullScreen.h:30
C4FullScreen::~C4FullScreen ( )
override

Definition at line 41 of file C4FullScreen.cpp.

References pMenu, and C4Window::pSurface.

42 {
43  if (pMenu) delete pMenu;
44  if (pSurface) delete pSurface;
45 }
C4MainMenu * pMenu
Definition: C4FullScreen.h:30
C4Surface * pSurface
Definition: C4Window.h:274

Member Function Documentation

bool C4FullScreen::ActivateMenuMain ( )

Definition at line 145 of file C4FullScreen.cpp.

References C4MainMenu::ActivateMain(), CloseMenu(), C4GameOverDlg::IsShown(), NO_OWNER, and pMenu.

Referenced by C4Game::InitKeyboard().

146 {
147  // Not during game over dialog
148  if (C4GameOverDlg::IsShown()) return false;
149  // Close previous
150  CloseMenu();
151  // Open menu
152  pMenu = new C4MainMenu();
153  return pMenu->ActivateMain(NO_OWNER);
154 }
C4MainMenu * pMenu
Definition: C4FullScreen.h:30
static bool IsShown()
Definition: C4GameOverDlg.h:92
const int NO_OWNER
Definition: C4Constants.h:137
bool ActivateMain(int32_t iPlayer)
Definition: C4MainMenu.cpp:566

Here is the call graph for this function:

Here is the caller graph for this function:

void C4FullScreen::CharIn ( const char *  c)
overridevirtual

Reimplemented from C4Window.

Definition at line 34 of file C4FullScreen.cpp.

References C4GUI::Screen::CharIn(), and pGUI.

34 { ::pGUI->CharIn(c); }
C4GUIScreen * pGUI
Definition: C4Gui.cpp:1191
virtual bool CharIn(const char *c)
Definition: C4Gui.cpp:779

Here is the call graph for this function:

void C4FullScreen::Clear ( )
overridevirtual

Reimplemented from C4Window.

Definition at line 62 of file C4FullScreen.cpp.

References C4Window::Clear(), and C4Window::pSurface.

Referenced by C4Application::Clear().

63 {
64  if (pSurface) delete pSurface;
65  pSurface = nullptr;
67 }
C4Surface * pSurface
Definition: C4Window.h:274
virtual void Clear()
Definition: C4AppT.cpp:99

Here is the call graph for this function:

Here is the caller graph for this function:

void C4FullScreen::Close ( )
overridevirtual

Implements C4Window.

Definition at line 54 of file C4FullScreen.cpp.

References Application, Game, C4Game::IsRunning, C4Application::Quit(), and ShowAbortDlg().

Referenced by FullScreenWinProc().

55 {
56  if (Game.IsRunning)
57  ShowAbortDlg();
58  else
59  Application.Quit();
60 }
bool IsRunning
Definition: C4Game.h:139
C4Game Game
Definition: C4Globals.cpp:52
void Quit() override
bool ShowAbortDlg()
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

Here is the caller graph for this function:

void C4FullScreen::CloseMenu ( )

Definition at line 156 of file C4FullScreen.cpp.

References C4GUI::Dialog::Close(), C4Menu::IsActive(), and pMenu.

Referenced by ActivateMenuMain(), C4Game::Clear(), C4Game::Init(), C4GameOverDlg::OnShown(), and ViewportCheck().

157 {
158  if (pMenu)
159  {
160  if (pMenu->IsActive()) pMenu->Close(false);
161  delete pMenu;
162  pMenu = nullptr;
163  }
164 }
C4MainMenu * pMenu
Definition: C4FullScreen.h:30
void Close(bool fOK)
bool IsActive()
Definition: C4Menu.cpp:480

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Window::EnumerateMultiSamples ( std::vector< int > &  samples) const
virtualinherited

Definition at line 102 of file C4AppT.cpp.

Referenced by C4StartupOptionsDlg::C4StartupOptionsDlg().

102 {}

Here is the caller graph for this function:

void C4FullScreen::Execute ( )

Definition at line 69 of file C4FullScreen.cpp.

References C4Menu::Execute(), pMenu, and C4Window::RequestUpdate().

Referenced by C4Application::Draw().

70 {
71  // Execute menu
72  if (pMenu) pMenu->Execute();
73  // Draw
74  RequestUpdate();
75 }
C4MainMenu * pMenu
Definition: C4FullScreen.h:30
virtual void RequestUpdate()
Definition: C4AppT.cpp:109
void Execute()
Definition: C4Menu.cpp:903

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Window::FlashWindow ( )
inherited

Definition at line 74 of file C4AppMac.mm.

Referenced by C4AbstractApp::NotifyUserIfInactive().

75 {
76  [NSApp requestUserAttention:NSCriticalRequest];
77 }

Here is the caller graph for this function:

bool C4Window::GetSize ( C4Rect pRect)
inherited

Definition at line 105 of file C4AppT.cpp.

Referenced by C4Application::OnResolutionChanged(), C4GUI::DialogWindow::PerformUpdate(), and C4Game::PreInit().

105 {return false;}

Here is the caller graph for this function:

void C4Window::GrabMouse ( bool  grab)
inherited

Definition at line 104 of file C4AppT.cpp.

Referenced by C4Application::GameTick().

104 {}

Here is the caller graph for this function:

C4Window * C4FullScreen::Init ( C4AbstractApp pApp)

Definition at line 48 of file C4FullScreen.cpp.

References Application, C4Application::GetConfigHeight(), C4Application::GetConfigWidth(), and C4Window::W_Fullscreen.

Referenced by C4Application::DoInit().

49 {
51  return Init(C4Window::W_Fullscreen, pApp, C4ENGINECAPTION, &r);
52 }
Definition: C4Rect.h:27
int GetConfigWidth()
Definition: C4Application.h:82
int GetConfigHeight()
Definition: C4Application.h:83
C4Window * Init(C4AbstractApp *pApp)
C4Application Application
Definition: C4Globals.cpp:44

Here is the call graph for this function:

Here is the caller graph for this function:

C4Window * C4Window::Init ( C4Window::WindowKind  windowKind,
C4AbstractApp pApp,
const char *  Title,
const C4Rect size 
)
protectedvirtualinherited

Definition at line 106 of file C4AppT.cpp.

Referenced by C4ConsoleGUIPreviewWindow::C4ConsoleGUIPreviewWindow(), C4ConsoleGUI::CreateConsoleWindow(), C4ViewportWindow::Init(), and C4GUI::DialogWindow::Init().

106 {return this;}

Here is the caller graph for this function:

bool C4FullScreen::MenuKeyControl ( BYTE  byCom)

Definition at line 171 of file C4FullScreen.cpp.

References C4Menu::KeyControl(), and pMenu.

Referenced by C4Game::InitKeyboard().

172 {
173  if (pMenu) return pMenu->KeyControl(byCom);
174  return false;
175 }
bool KeyControl(BYTE byCom)
Definition: C4Menu.cpp:473
C4MainMenu * pMenu
Definition: C4FullScreen.h:30

Here is the call graph for this function:

Here is the caller graph for this function:

void C4FullScreen::PerformUpdate ( )
overridevirtual

Reimplemented from C4Window.

Definition at line 166 of file C4FullScreen.cpp.

References C4GraphicsSystem::Execute(), and GraphicsSystem.

167 {
169 }
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51

Here is the call graph for this function:

bool C4Window::ReInit ( C4AbstractApp pApp)
virtualinherited

Definition at line 107 of file C4AppT.cpp.

107 {return false;}
void C4Window::RequestUpdate ( )
virtualinherited

Definition at line 109 of file C4AppT.cpp.

Referenced by Execute().

109 {}

Here is the caller graph for this function:

bool C4Window::RestorePosition ( const char *  szWindowName,
const char *  szSubKey,
bool  fHidden = false 
)
inherited

Definition at line 108 of file C4AppT.cpp.

Referenced by C4ViewportWindow::Init(), and C4GUI::DialogWindow::Init().

108 {return false;}

Here is the caller graph for this function:

void C4Window::SetSize ( unsigned int  cx,
unsigned int  cy 
)
inherited

Definition at line 110 of file C4AppT.cpp.

Referenced by C4Application::DoInit(), C4GUI::DialogWindow::Init(), C4AbstractApp::SetVideoMode(), and C4GUI::Dialog::UpdateSize().

110 {}

Here is the caller graph for this function:

void C4Window::SetTitle ( const char *  Title)
inherited

Definition at line 111 of file C4AppT.cpp.

Referenced by C4Console::CloseGame(), C4Console::SetCaptionToFilename(), and C4GUI::Dialog::SetTitle().

111 {}

Here is the caller graph for this function:

bool C4FullScreen::ShowAbortDlg ( )

Definition at line 135 of file C4FullScreen.cpp.

References C4AbortGameDialog::IsShown(), C4GameOverDlg::IsShown(), pGUI, and C4GUI::Screen::ShowRemoveDlg().

Referenced by Close(), C4Game::InitKeyboard(), and C4MainMenu::MenuCommand().

136 {
137  // abort dialog already shown
138  if (C4AbortGameDialog::IsShown()) return false;
139  // not while game over dialog is open
140  if (C4GameOverDlg::IsShown()) return false;
141  // show abort dialog
143 }
bool ShowRemoveDlg(Dialog *pDlg)
C4GUIScreen * pGUI
Definition: C4Gui.cpp:1191
static bool IsShown()
Definition: C4GameOverDlg.h:92
static bool IsShown()
Definition: C4GameDialogs.h:47

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4Window::StorePosition ( const char *  szWindowName,
const char *  szSubKey,
bool  fStoreSize = true 
)
inherited

Definition at line 139 of file C4WindowSDL.cpp.

139 { return true; }
bool C4FullScreen::ViewportCheck ( )

Definition at line 77 of file C4FullScreen.cpp.

References C4Window::Active, C4Game::C4S, CloseMenu(), C4ViewportList::CloseViewport(), C4ViewportList::CreateViewport(), C4SHead::Film, C4PlayerList::First, C4GraphicsSystem::FlashMessage(), StdStrBuf::Format(), FormatString(), Game, StdStrBuf::getData(), C4KeyboardInput::GetKeyCodeNameByKeyName(), C4ViewportList::GetViewport(), C4ViewportList::GetViewportCount(), GraphicsSystem, C4Scenario::Head, C4Viewport::Init(), C4MouseControl::Init(), C4Game::KeyboardInput, LoadResStr(), MouseControl, NO_OWNER, C4Player::Number, Players, C4SHead::Replay, and Viewports.

Referenced by C4Game::InitGameFinal(), C4Game::JoinPlayer(), and C4PlayerList::Remove().

78 {
79  int iPlrNum; C4Player *pPlr;
80  // Not active
81  if (!Active) return false;
82  // Determine film mode
83  bool fFilm = (Game.C4S.Head.Replay && Game.C4S.Head.Film);
84  // Check viewports
85  switch (::Viewports.GetViewportCount())
86  {
87  // No viewports: create no-owner viewport
88  case 0:
89  iPlrNum = NO_OWNER;
90  // Film mode: create viewport for first player (instead of no-owner)
91  if (fFilm)
92  if ((pPlr = ::Players.First))
93  iPlrNum = pPlr->Number;
94  // Create viewport
95  ::Viewports.CreateViewport(iPlrNum, iPlrNum==NO_OWNER);
96  // Non-film (observer mode)
97  if (!fFilm)
98  {
99  // Activate mouse control
100  ::MouseControl.Init(iPlrNum);
101  // Display message for how to open observer menu (this message will be cleared if any owned viewport opens)
102  StdStrBuf sKey;
103  sKey.Format("<c ffff00><%s></c>", Game.KeyboardInput.GetKeyCodeNameByKeyName("FullscreenMenuOpen", false).getData());
104  ::GraphicsSystem.FlashMessage(FormatString(LoadResStr("IDS_MSG_PRESSORPUSHANYGAMEPADBUTT"), sKey.getData()).getData());
105  }
106  break;
107  // One viewport: do nothing
108  case 1:
109  break;
110  // More than one viewport: remove all no-owner viewports
111  default:
113  break;
114  }
115  // Look for no-owner viewport
117  // No no-owner viewport found
118  if (!pNoOwnerVp)
119  {
120  // Close any open fullscreen menu
121  CloseMenu();
122  }
123  // No-owner viewport present
124  else
125  {
126  // movie mode: player present, and no valid viewport assigned?
127  if (Game.C4S.Head.Replay && Game.C4S.Head.Film && (pPlr = ::Players.First))
128  // assign viewport to joined player
129  pNoOwnerVp->Init(pPlr->Number, true);
130  }
131  // Done
132  return true;
133 }
const char * getData() const
Definition: StdBuf.h:442
C4Game Game
Definition: C4Globals.cpp:52
int32_t Number
Definition: C4Player.h:86
C4Scenario C4S
Definition: C4Game.h:74
bool Replay
Definition: C4Scenario.h:72
C4Player * First
Definition: C4PlayerList.h:31
void Format(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
Definition: StdBuf.cpp:174
C4Viewport * GetViewport(int32_t iPlayer, C4Viewport *pPrev=nullptr)
C4MouseControl MouseControl
Definition: C4Globals.cpp:47
const char * LoadResStr(const char *id)
Definition: C4Language.h:83
StdStrBuf GetKeyCodeNameByKeyName(const char *szKeyName, bool fShort=false, int32_t iIndex=0)
C4KeyboardInput & KeyboardInput
Definition: C4Game.h:96
C4GraphicsSystem GraphicsSystem
Definition: C4Globals.cpp:51
C4PlayerList Players
const int NO_OWNER
Definition: C4Constants.h:137
bool CreateViewport(int32_t iPlayer, bool fSilent=false)
Definition: C4Viewport.cpp:917
bool Init(int32_t iPlayer, bool fSetTempOnly)
Definition: C4Viewport.cpp:658
C4ViewportList Viewports
Definition: C4Viewport.cpp:841
void FlashMessage(const char *szMessage)
bool Init(int32_t iPlayer)
bool Active
Definition: C4Window.h:273
bool CloseViewport(int32_t iPlayer, bool fSilent)
Definition: C4Viewport.cpp:961
int32_t GetViewportCount()
C4SHead Head
Definition: C4Scenario.h:230
int32_t Film
Definition: C4Scenario.h:73
StdStrBuf FormatString(const char *szFmt,...)
Definition: StdBuf.cpp:270

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

WindowKind C4Window::eKind
inherited

Definition at line 275 of file C4Window.h.


The documentation for this class was generated from the following files: