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 ()
 
void Execute ()
 
bool ViewportCheck ()
 
bool ShowAbortDlg ()
 
bool ActivateMenuMain ()
 
void CloseMenu ()
 
bool MenuKeyControl (BYTE byCom)
 
C4WindowInit (C4AbstractApp *pApp)
 
virtual void Close ()
 
virtual void Clear ()
 
virtual void CharIn (const char *c)
 
virtual void PerformUpdate ()
 
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
 
C4SurfacepSurface
 
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 267 of file C4Window.h.

268  {
269  W_GuiWindow,
270  W_Console,
271  W_Viewport,
272  W_Fullscreen,
273  W_Control // wrapper to a render target control inside a window
274  };

Constructor & Destructor Documentation

C4FullScreen::C4FullScreen ( )

Definition at line 38 of file C4FullScreen.cpp.

References pMenu.

39 {
40  pMenu = nullptr;
41 }
C4MainMenu * pMenu
Definition: C4FullScreen.h:30
C4FullScreen::~C4FullScreen ( )

Definition at line 43 of file C4FullScreen.cpp.

References pMenu, and C4Window::pSurface.

44 {
45  if (pMenu) delete pMenu;
46  if (pSurface) delete pSurface;
47 }
C4MainMenu * pMenu
Definition: C4FullScreen.h:30
C4Surface * pSurface
Definition: C4Window.h:279

Member Function Documentation

bool C4FullScreen::ActivateMenuMain ( )

Definition at line 147 of file C4FullScreen.cpp.

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

Referenced by C4Game::InitKeyboard().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from C4Window.

Definition at line 36 of file C4FullScreen.cpp.

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

36 { ::pGUI->CharIn(c); }
C4GUIScreen * pGUI
Definition: C4Gui.cpp:1194
virtual bool CharIn(const char *c)
Definition: C4Gui.cpp:782

Here is the call graph for this function:

void C4FullScreen::Clear ( )
virtual

Reimplemented from C4Window.

Definition at line 64 of file C4FullScreen.cpp.

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

Referenced by C4Application::Clear().

65 {
66  if (pSurface) delete pSurface;
67  pSurface = 0;
69 }
C4Surface * pSurface
Definition: C4Window.h:279
virtual void Clear()
Definition: C4AppT.cpp:100

Here is the call graph for this function:

Here is the caller graph for this function:

void C4FullScreen::Close ( )
virtual

Implements C4Window.

Definition at line 56 of file C4FullScreen.cpp.

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

Referenced by FullScreenWinProc().

57 {
58  if (Game.IsRunning)
59  ShowAbortDlg();
60  else
61  Application.Quit();
62 }
bool IsRunning
Definition: C4Game.h:141
C4Game Game
Definition: C4Globals.cpp:52
virtual void Quit()
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 158 of file C4FullScreen.cpp.

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

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

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

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 103 of file C4AppT.cpp.

Referenced by C4StartupOptionsDlg::C4StartupOptionsDlg().

103 {}

Here is the caller graph for this function:

void C4FullScreen::Execute ( )

Definition at line 71 of file C4FullScreen.cpp.

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

Referenced by C4Application::Draw().

72 {
73  // Execute menu
74  if (pMenu) pMenu->Execute();
75  // Draw
76  RequestUpdate();
77 }
C4MainMenu * pMenu
Definition: C4FullScreen.h:30
virtual void RequestUpdate()
Definition: C4AppT.cpp:110
void Execute()
Definition: C4Menu.cpp:906

Here is the call graph for this function:

Here is the caller graph for this function:

void C4Window::FlashWindow ( )
inherited

Definition at line 75 of file C4AppMac.mm.

Referenced by C4AbstractApp::NotifyUserIfInactive().

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

Here is the caller graph for this function:

bool C4Window::GetSize ( C4Rect pRect)
inherited

Definition at line 106 of file C4AppT.cpp.

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

106 {return 0;}

Here is the caller graph for this function:

void C4Window::GrabMouse ( bool  grab)
inherited

Definition at line 105 of file C4AppT.cpp.

Referenced by C4Application::GameTick().

105 {}

Here is the caller graph for this function:

C4Window * C4FullScreen::Init ( C4AbstractApp pApp)

Definition at line 50 of file C4FullScreen.cpp.

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

Referenced by C4Application::DoInit().

51 {
53  return Init(C4Window::W_Fullscreen, pApp, C4ENGINECAPTION, &r);
54 }
Definition: C4Rect.h:29
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 107 of file C4AppT.cpp.

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

107 {return this;}

Here is the caller graph for this function:

bool C4FullScreen::MenuKeyControl ( BYTE  byCom)

Definition at line 173 of file C4FullScreen.cpp.

References C4Menu::KeyControl(), and pMenu.

Referenced by C4Game::InitKeyboard().

174 {
175  if (pMenu) return pMenu->KeyControl(byCom);
176  return false;
177 }
bool KeyControl(BYTE byCom)
Definition: C4Menu.cpp:476
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 ( )
virtual

Reimplemented from C4Window.

Definition at line 168 of file C4FullScreen.cpp.

References C4GraphicsSystem::Execute(), and GraphicsSystem.

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

Here is the call graph for this function:

bool C4Window::ReInit ( C4AbstractApp pApp)
virtualinherited

Definition at line 108 of file C4AppT.cpp.

108 {return 0;}
void C4Window::RequestUpdate ( )
virtualinherited

Definition at line 110 of file C4AppT.cpp.

Referenced by Execute().

110 {}

Here is the caller graph for this function:

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

Definition at line 109 of file C4AppT.cpp.

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

109 {return 0;}

Here is the caller graph for this function:

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

Definition at line 111 of file C4AppT.cpp.

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

111 {}

Here is the caller graph for this function:

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

Definition at line 112 of file C4AppT.cpp.

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

112 {}

Here is the caller graph for this function:

bool C4FullScreen::ShowAbortDlg ( )

Definition at line 137 of file C4FullScreen.cpp.

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

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

138 {
139  // abort dialog already shown
140  if (C4AbortGameDialog::IsShown()) return false;
141  // not while game over dialog is open
142  if (C4GameOverDlg::IsShown()) return false;
143  // show abort dialog
145 }
bool ShowRemoveDlg(Dialog *pDlg)
C4GUIScreen * pGUI
Definition: C4Gui.cpp:1194
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 143 of file C4WindowSDL.cpp.

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

Definition at line 79 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().

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

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 280 of file C4Window.h.


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