OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
C4AbstractApp Class Referenceabstract

#include <C4App.h>

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

Public Member Functions

 C4AbstractApp ()
 
virtual ~C4AbstractApp ()
 
virtual void Clear ()
 
bool Init (int argc, char *argv[])
 
void Run ()
 
virtual void Quit ()
 
bool GetIndexedDisplayMode (int32_t iIndex, int32_t *piXRes, int32_t *piYRes, int32_t *piBitDepth, int32_t *piRefreshRate, uint32_t iMonitor)
 
bool SetVideoMode (int iXRes, int iYRes, unsigned int iRefreshRate, unsigned int iMonitor, bool fFullScreen)
 
void RestoreVideoMode ()
 
virtual bool DoScheduleProcs (int iTimeout)
 
bool FlushMessages ()
 
bool Copy (const std::string &text, bool fClipboard=true)
 
std::string Paste (bool fClipboard=true)
 
bool IsClipboardFull (bool fClipboard=true)
 
virtual void OnCommand (const char *szCmd)=0
 
virtual void OnResolutionChanged (unsigned int iXRes, unsigned int iYRes)=0
 
virtual void OnKeyboardLayoutChanged ()=0
 
void NotifyUserIfInactive ()
 
void MessageDialog (const char *message)
 
const char * GetLastError ()
 
void Error (const char *m)
 
bool AssertMainThread ()
 
int getProcCnt () const
 
bool hasProc (StdSchedulerProc *pProc)
 
bool IsInManualLoop ()
 
void Set (StdSchedulerProc **ppProcs, int iProcCnt)
 
void Add (StdSchedulerProc *pProc)
 
void Remove (StdSchedulerProc *pProc)
 
void Added (StdSchedulerProc *pProc)
 
void Removing (StdSchedulerProc *pProc)
 
void Changed (StdSchedulerProc *pProc)
 
void StartOnCurrentThread ()
 
C4TimeMilliseconds GetNextTick (C4TimeMilliseconds tNow)
 
bool ScheduleProcs (int iTimeout=1000/36)
 
void UnBlock ()
 

Public Attributes

bool Active
 
C4WindowpWindow
 
bool fQuitMsgReceived
 
pthread_t MainThread
 

Protected Member Functions

virtual bool DoInit (int argc, char *argv[])=0
 
virtual void OnError (StdSchedulerProc *)
 

Protected Attributes

std::string sLastError
 
bool fDspModeSet
 

Friends

class CStdGL
 
class CStdGLCtx
 
class C4Window
 
class C4GtkWindow
 

Detailed Description

Definition at line 57 of file C4App.h.

Constructor & Destructor Documentation

C4AbstractApp::C4AbstractApp ( )

Definition at line 74 of file C4AppSDL.cpp.

74  :
75  Active(false), pWindow(nullptr), fQuitMsgReceived(false),
76  // main thread
77 #ifdef HAVE_PTHREAD
78  MainThread (pthread_self()),
79 #endif
80 #ifdef _WIN32
81  idMainThread(0),
82 #endif
83  fDspModeSet(false)
84 {
85 }
pthread_t MainThread
Definition: C4App.h:128
bool Active
Definition: C4App.h:63
bool fQuitMsgReceived
Definition: C4App.h:81
bool fDspModeSet
Definition: C4App.h:157
C4Window * pWindow
Definition: C4App.h:80
C4AbstractApp::~C4AbstractApp ( )
virtual

Definition at line 87 of file C4AppSDL.cpp.

88 {
89 }

Member Function Documentation

void StdScheduler::Add ( StdSchedulerProc pProc)
inherited

Definition at line 97 of file StdScheduler.cpp.

References StdScheduler::Added().

Referenced by C4GameLobby::ScenDesc::Activate(), C4Network2ResDlg::Activate(), C4GameOptionsList::Activate(), StdSchedulerThread::Add(), C4GameOverDlg::C4GameOverDlg(), C4GameSec1Timer::C4GameSec1Timer(), C4InteractiveThread::C4InteractiveThread(), C4Network2ClientListBox::C4Network2ClientListBox(), C4Network2ClientListDlg::C4Network2ClientListDlg(), C4Network2Stats::C4Network2Stats(), C4StartupNetDlg::C4StartupNetDlg(), C4GameLobby::Countdown::Countdown(), C4Application::DoInit(), C4GUI::InfoDialog::InfoDialog(), C4Network2::InitHost(), C4Network2::InitialConnect::InitialConnect(), C4Network2::InitLeague(), C4AulDebug::Listen(), C4GameLobby::MainDlg::MainDlg(), StdScheduler::Set(), C4Network2::StartStreaming(), and StdScheduler::StdScheduler().

98 {
99  // Already added to some scheduler
100  if (pProc->scheduler)
101  return;
102  // Add
103  procs.push_back(pProc);
104  pProc->scheduler = this;
105 
106  Added(pProc);
107 }
void Added(StdSchedulerProc *pProc)

Here is the call graph for this function:

Here is the caller graph for this function:

void StdScheduler::Added ( StdSchedulerProc pProc)
inherited

Definition at line 281 of file StdSchedulerMac.mm.

References SCHAdditions::assignAdditionForProc:, and SCHAdditions::requestAdditionsForScheduler:.

Referenced by StdScheduler::Add().

282 {
283  [[SCHAdditions requestAdditionsForScheduler:this] assignAdditionForProc:pProc];
284 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4AbstractApp::AssertMainThread ( )
inline

Definition at line 123 of file C4App.h.

References MainThread.

Referenced by Log(), LogSilent(), C4Surface::PageFlip(), CStdGL::PrepareRendering(), and ShaderLog().

124  {
125  assert(MainThread == pthread_self());
126  return MainThread == pthread_self();
127  }
pthread_t MainThread
Definition: C4App.h:128

Here is the caller graph for this function:

void StdScheduler::Changed ( StdSchedulerProc pProc)
inherited

Definition at line 294 of file StdSchedulerMac.mm.

References SCHAdditions::additionForProc:, SCHAddition::changed, and SCHAdditions::requestAdditionsForScheduler:.

295 {
296  [[[SCHAdditions requestAdditionsForScheduler:this] additionForProc:pProc] changed];
297 }

Here is the call graph for this function:

void C4AbstractApp::Clear ( )
virtual

Reimplemented in C4Application.

Definition at line 109 of file C4AppSDL.cpp.

Referenced by C4Application::Clear().

110 {
111  SDL_Quit();
112 }

Here is the caller graph for this function:

bool C4AbstractApp::Copy ( const std::string &  text,
bool  fClipboard = true 
)

Definition at line 34 of file C4AppMac.mm.

References Log().

Referenced by C4GUI::MessageDialog::KeyCopy().

35 {
36  NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
37  [pasteboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
38  NSString* string = [NSString stringWithCString:text.c_str() encoding:NSUTF8StringEncoding];
39  if (![pasteboard setString:string forType:NSStringPboardType])
40  {
41  Log("Writing to Cocoa pasteboard failed");
42  return false;
43  }
44  return true;
45 }
bool Log(const char *szMessage)
Definition: C4Log.cpp:195

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool C4AbstractApp::DoInit ( int  argc,
char *  argv[] 
)
protectedpure virtual

Implemented in C4Application.

Referenced by Init().

Here is the caller graph for this function:

bool C4AbstractApp::DoScheduleProcs ( int  iTimeout)
virtual

Reimplemented from StdScheduler.

Definition at line 59 of file C4App.cpp.

References StdScheduler::DoScheduleProcs(), FlushMessages(), and fQuitMsgReceived.

60 {
61  // Always fail after quit message
63  return false;
64 #if defined(USE_SDL_MAINLOOP) || defined(USE_COCOA)
65  // Unfortunately, the SDL event loop needs to be polled
66  FlushMessages();
67 #endif
68 #ifdef WITH_QT_EDITOR
69  // Some places, for example the lobby, have a nested event processing loop.
70  // To prevent the editor from freezing, call the Qt event loop here.
71  if (iTimeout)
72  ProcessQtEvents();
73 #endif
74  return StdScheduler::DoScheduleProcs(iTimeout);
75 }
bool FlushMessages()
Definition: C4AppSDL.cpp:119
bool fQuitMsgReceived
Definition: C4App.h:81
virtual bool DoScheduleProcs(int iTimeout)

Here is the call graph for this function:

void C4AbstractApp::Error ( const char *  m)
inline

Definition at line 99 of file C4App.h.

References sLastError.

Referenced by C4Draw::Error(), and SetVideoMode().

99 { sLastError = m; }
std::string sLastError
Definition: C4App.h:156

Here is the caller graph for this function:

bool C4AbstractApp::FlushMessages ( )

Definition at line 119 of file C4AppSDL.cpp.

References fQuitMsgReceived.

Referenced by DoScheduleProcs(), C4Network2::FinalInit(), and C4Game::SetInitProgress().

120 {
121  // Always fail after quit message
122  if (fQuitMsgReceived)
123  return false;
124 
125  // Handle pending SDL messages
126  SDL_Event event;
127  while (SDL_PollEvent(&event))
128  {
129  HandleSDLEvent(event);
130  }
131  return true;
132 }
bool fQuitMsgReceived
Definition: C4App.h:81

Here is the caller graph for this function:

bool C4AbstractApp::GetIndexedDisplayMode ( int32_t  iIndex,
int32_t *  piXRes,
int32_t *  piYRes,
int32_t *  piBitDepth,
int32_t *  piRefreshRate,
uint32_t  iMonitor 
)

Definition at line 339 of file C4AppSDL.cpp.

Referenced by C4Application::ApplyResolutionConstraints().

340 {
341  if (!modeCount)
342  {
343  modeCount = SDL_GetNumDisplayModes(iMonitor);
344  }
345 
346  if (iIndex >= modeCount)
347  return false;
348 
349  SDL_DisplayMode mode;
350  SDL_GetDisplayMode(iMonitor, iIndex, &mode);
351  *piXRes = mode.w;
352  *piYRes = mode.h;
353  *piBitDepth = bits_per_pixel(mode.format);
354  if (piRefreshRate) *piRefreshRate = mode.refresh_rate;
355  return true;
356 }

Here is the caller graph for this function:

const char* C4AbstractApp::GetLastError ( )
inline

Definition at line 98 of file C4App.h.

References sLastError.

98 { return sLastError.c_str(); }
std::string sLastError
Definition: C4App.h:156
C4TimeMilliseconds StdScheduler::GetNextTick ( C4TimeMilliseconds  tNow)
inherited

Definition at line 133 of file StdScheduler.cpp.

References C4TimeMilliseconds::PositiveInfinity.

Referenced by Run(), and StdScheduler::ScheduleProcs().

134 {
136  for (auto proc : procs)
137  {
138  tProcTick = std::min(tProcTick, proc->GetNextTick(tNow));
139  }
140  return tProcTick;
141 }

Here is the caller graph for this function:

int StdScheduler::getProcCnt ( ) const
inlineinherited

Definition at line 249 of file StdScheduler.h.

Referenced by C4InteractiveThread::AddProc(), and C4InteractiveThread::RemoveProc().

249 { return procs.size()-1; } // ignore internal NoopNotifyProc

Here is the caller graph for this function:

bool StdScheduler::hasProc ( StdSchedulerProc pProc)
inlineinherited

Definition at line 250 of file StdScheduler.h.

Referenced by C4InteractiveThread::RemoveProc().

250 { return std::find(procs.begin(), procs.end(), pProc) != procs.end(); }

Here is the caller graph for this function:

bool C4AbstractApp::Init ( int  argc,
char *  argv[] 
)

Definition at line 91 of file C4AppSDL.cpp.

References DoInit(), and LogF().

Referenced by main().

92 {
93  // Set locale
94  setlocale(LC_ALL,"");
95 
96  if (SDL_Init(SDL_INIT_VIDEO) != 0)
97  {
98  LogF("SDL_Init: %s", SDL_GetError());
99  return false;
100  }
101 
102  //SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
103 
104  // Custom initialization
105  return DoInit (argc, argv);
106 }
virtual bool DoInit(int argc, char *argv[])=0
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:253

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4AbstractApp::IsClipboardFull ( bool  fClipboard = true)

Definition at line 58 of file C4AppMac.mm.

Referenced by C4GUI::Edit::OnContext().

59 {
60  return [[NSPasteboard generalPasteboard] availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]];
61 }

Here is the caller graph for this function:

bool StdScheduler::IsInManualLoop ( )
inlineinherited

Definition at line 251 of file StdScheduler.h.

251 { return isInManualLoop; }
void C4AbstractApp::MessageDialog ( const char *  message)

Definition at line 63 of file C4AppMac.mm.

Referenced by C4Application::DoInit().

64 {
65  NSAlert* alert = [NSAlert alertWithMessageText:@"Fatal Error"
66  defaultButton:nil
67  alternateButton:nil
68  otherButton:nil
69  informativeTextWithFormat:@"%@",
70  [NSString stringWithUTF8String:message]
71  ];
72  [alert runModal];
73 }

Here is the caller graph for this function:

void C4AbstractApp::NotifyUserIfInactive ( )

Definition at line 89 of file C4App.cpp.

References Active, C4Window::FlashWindow(), and pWindow.

Referenced by C4Network2::DoLobby().

90 {
91 #ifdef _WIN32
92  if (!Active && pWindow) pWindow->FlashWindow();
93 #else
94  if (pWindow) pWindow->FlashWindow();
95 #endif
96 }
void FlashWindow()
Definition: C4AppMac.mm:75
bool Active
Definition: C4App.h:63
C4Window * pWindow
Definition: C4App.h:80

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void C4AbstractApp::OnCommand ( const char *  szCmd)
pure virtual

Implemented in C4Application.

virtual void StdScheduler::OnError ( StdSchedulerProc )
inlineprotectedvirtualinherited

Definition at line 272 of file StdScheduler.h.

272 { }
virtual void C4AbstractApp::OnKeyboardLayoutChanged ( )
pure virtual

Implemented in C4Application.

virtual void C4AbstractApp::OnResolutionChanged ( unsigned int  iXRes,
unsigned int  iYRes 
)
pure virtual

Implemented in C4Application.

Referenced by SetVideoMode().

Here is the caller graph for this function:

std::string C4AbstractApp::Paste ( bool  fClipboard = true)

Definition at line 47 of file C4AppMac.mm.

Referenced by C4GUI::Edit::MouseInput().

48 {
49  if (fClipboard)
50  {
51  NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
52  const char* chars = [[pasteboard stringForType:NSStringPboardType] cStringUsingEncoding:NSUTF8StringEncoding];
53  return chars;
54  }
55  return std::string();
56 }

Here is the caller graph for this function:

void C4AbstractApp::Quit ( )
virtual

Reimplemented in C4Application.

Definition at line 114 of file C4AppSDL.cpp.

References fQuitMsgReceived.

Referenced by C4Application::Quit().

115 {
116  fQuitMsgReceived = true;
117 }
bool fQuitMsgReceived
Definition: C4App.h:81

Here is the caller graph for this function:

void StdScheduler::Remove ( StdSchedulerProc pProc)
inherited

Definition at line 109 of file StdScheduler.cpp.

References StdScheduler::Removing().

Referenced by C4Application::Clear(), C4Network2::Clear(), StdScheduler::Clear(), C4GameLobby::ScenDesc::Deactivate(), C4Network2ResDlg::Deactivate(), C4GameOptionsList::Deactivate(), C4Network2::DeinitLeague(), StdSchedulerThread::Remove(), C4Network2::StopStreaming(), C4GameOverDlg::~C4GameOverDlg(), C4GameSec1Timer::~C4GameSec1Timer(), C4InteractiveThread::~C4InteractiveThread(), C4Network2ClientListBox::~C4Network2ClientListBox(), C4Network2ClientListDlg::~C4Network2ClientListDlg(), C4Network2Stats::~C4Network2Stats(), C4StartupNetDlg::~C4StartupNetDlg(), C4GameLobby::Countdown::~Countdown(), C4GUI::InfoDialog::~InfoDialog(), and C4GameLobby::MainDlg::~MainDlg().

110 {
111  // :o ?
112  if (pProc->scheduler != this)
113  return;
114  Removing(pProc);
115  pProc->scheduler = nullptr;
116  auto pos = std::find(procs.begin(), procs.end(), pProc);
117  if (pos != procs.end())
118  procs.erase(pos);
119 }
void Removing(StdSchedulerProc *pProc)

Here is the call graph for this function:

Here is the caller graph for this function:

void StdScheduler::Removing ( StdSchedulerProc pProc)
inherited

Definition at line 286 of file StdSchedulerMac.mm.

References SCHAdditions::requestAdditionsForScheduler:.

Referenced by StdScheduler::Remove().

287 {
288  auto x = [SCHAdditions requestAdditionsForScheduler:this];
289  [x removeAdditionForProc:pProc];
290  if ([x numberOfAdditions] == 0)
291  [SCHAdditions removeAdditions:x];
292 }

Here is the call graph for this function:

Here is the caller graph for this function:

void C4AbstractApp::RestoreVideoMode ( )

Definition at line 447 of file C4AppSDL.cpp.

References pWindow.

Referenced by C4Application::Clear().

448 {
449  if (pWindow && pWindow->window)
450  SDL_SetWindowFullscreen(pWindow->window, 0);
451 }
C4Window * pWindow
Definition: C4App.h:80

Here is the caller graph for this function:

void C4AbstractApp::Run ( )

Definition at line 26 of file C4App.cpp.

References Application, Clamp(), fQuitMsgReceived, StdScheduler::GetNextTick(), C4Application::isEditor, C4TimeMilliseconds::Now(), and StdScheduler::ScheduleProcs().

Referenced by main().

27 {
28 #ifdef WITH_QT_EDITOR
30  {
31  // Qt has its own event loop. Use a timer to call our own event handling whenever Qt is done
32  // with its events. The alternative (calling Qt's event handling from
33  // C4Console::Execute) is too slow, at least on Linux.
34  // FIXME: All of this should be happening in a background thread instead of on the UI thread
35  QTimer timer;
36  QObject::connect(&timer, &QTimer::timeout, [this, &timer]() {
37  ScheduleProcs(0);
38  if (fQuitMsgReceived)
39  {
40  QApplication::quit();
41  return;
42  }
43  auto now = C4TimeMilliseconds::Now();
44  auto next_tick = GetNextTick(now);
45  timer.setInterval(Clamp(next_tick - now, 0, 1000/36));
46  });
47  timer.setTimerType(Qt::PreciseTimer);
48  timer.start();
49  QApplication::exec();
50  return;
51  }
52 #endif
53 
54  // Main message loop
55  while (!fQuitMsgReceived)
56  ScheduleProcs();
57 }
C4TimeMilliseconds GetNextTick(C4TimeMilliseconds tNow)
T Clamp(T bval, T lbound, T rbound)
Definition: Standard.h:46
bool fQuitMsgReceived
Definition: C4App.h:81
bool ScheduleProcs(int iTimeout=1000/36)
C4Application Application
Definition: C4Globals.cpp:44
static C4TimeMilliseconds Now()

Here is the call graph for this function:

Here is the caller graph for this function:

bool StdScheduler::ScheduleProcs ( int  iTimeout = 1000/36)
inherited

Definition at line 143 of file StdScheduler.cpp.

References StdScheduler::DoScheduleProcs(), StdScheduler::GetNextTick(), and C4TimeMilliseconds::Now().

Referenced by C4AulDebug::DebugStep(), C4Network2::DoLobby(), C4GUI::Dialog::DoModal(), C4ScenarioListLoader::DoProcessCallback(), C4GUI::Dialog::Execute(), C4Network2::FinalInit(), C4Game::InitNetworkFromAddress(), C4Network2::LeaguePlrAuth(), C4Network2::LeagueStart(), C4AulDebug::Listen(), C4Network2::RetrieveRes(), Run(), and C4AppDelegate::suggestQuitting:.

144 {
145  // Needs at least one process to work properly
146  if (!procs.size()) return false;
147 
148  // Get timeout
150  C4TimeMilliseconds tProcTick = GetNextTick(tNow);
151  if (iTimeout == -1 || tNow + iTimeout > tProcTick)
152  {
153  iTimeout = std::max<decltype(iTimeout)>(tProcTick - tNow, 0);
154  }
155 
156  bool old = isInManualLoop;
157  isInManualLoop = true;
158  bool res = DoScheduleProcs(iTimeout);
159  isInManualLoop = old;
160  return res;
161 }
C4TimeMilliseconds GetNextTick(C4TimeMilliseconds tNow)
virtual bool DoScheduleProcs(int iTimeout)
static C4TimeMilliseconds Now()

Here is the call graph for this function:

Here is the caller graph for this function:

void StdScheduler::Set ( StdSchedulerProc **  ppProcs,
int  iProcCnt 
)
inherited

Definition at line 88 of file StdScheduler.cpp.

References StdScheduler::Add(), and StdScheduler::Clear().

Referenced by StdSchedulerThread::Set().

89 {
90  // Remove previous data
91  Clear();
92  // Copy new
93  for (int i = 0; i < inProcCnt; i++)
94  Add(ppnProcs[i]);
95 }
void Add(StdSchedulerProc *pProc)

Here is the call graph for this function:

Here is the caller graph for this function:

bool C4AbstractApp::SetVideoMode ( int  iXRes,
int  iYRes,
unsigned int  iRefreshRate,
unsigned int  iMonitor,
bool  fFullScreen 
)

Definition at line 358 of file C4AppSDL.cpp.

References C4Draw::COLOR_DEPTH, Error(), LogF(), OnResolutionChanged(), pWindow, and C4Window::SetSize().

Referenced by C4Application::DoInit(), FullScreenWinProc(), and C4Application::GameTick().

359 {
360  int res;
361  if (!fFullScreen)
362  {
363  if (iXRes == -1)
364  {
365  SDL_DisplayMode desktop_mode;
366  res = SDL_GetDesktopDisplayMode(iMonitor, &desktop_mode);
367  if (res)
368  {
369  Error(SDL_GetError());
370  LogF("SDL_GetDesktopDisplayMode: %s", SDL_GetError());
371  return false;
372  }
373 
374  iXRes = desktop_mode.w;
375  iYRes = desktop_mode.h;
376  }
377 
378  res = SDL_SetWindowFullscreen(pWindow->window, 0);
379  if (res)
380  {
381  Error(SDL_GetError());
382  LogF("SDL_SetWindowFullscreen: %s", SDL_GetError());
383  return false;
384  }
385 
386  pWindow->SetSize(iXRes, iYRes);
387  OnResolutionChanged(iXRes, iYRes);
388  return true;
389  }
390  SDL_DisplayMode mode;
391  if (iXRes < 0 || iYRes < 0)
392  {
393  res = SDL_SetWindowFullscreen(pWindow->window, SDL_WINDOW_FULLSCREEN_DESKTOP);
394  if (res)
395  {
396  Error(SDL_GetError());
397  LogF("SDL_SetWindowFullscreen: %s", SDL_GetError());
398  return false;
399  }
400  res = SDL_GetDesktopDisplayMode(iMonitor, &mode);
401  if (res)
402  {
403  Error(SDL_GetError());
404  LogF("SDL_GetDesktopDisplayMode: %s", SDL_GetError());
405  return false;
406  }
407  OnResolutionChanged(mode.w, mode.h);
408  return true;
409  }
410 
411  for (int i = 0; i < modeCount; ++i)
412  {
413  res = SDL_GetDisplayMode(iMonitor, i, &mode);
414 
415  if (res)
416  {
417  Error(SDL_GetError());
418  LogF("SDL_GetDisplayMode: %s", SDL_GetError());
419  return false;
420  }
421 
422  if (mode.w == iXRes && mode.h == iYRes && (RefreshRate == 0 || mode.refresh_rate == RefreshRate) && bits_per_pixel(mode.format) == C4Draw::COLOR_DEPTH)
423  {
424  res = SDL_SetWindowDisplayMode(pWindow->window, &mode);
425  if (res)
426  {
427  Error(SDL_GetError());
428  LogF("SDL_SetWindowDisplayMode: %s", SDL_GetError());
429  return false;
430  }
431  res = SDL_SetWindowFullscreen(pWindow->window, SDL_WINDOW_FULLSCREEN);
432  if (res)
433  {
434  Error(SDL_GetError());
435  LogF("SDL_SetWindowFullscreen: %s", SDL_GetError());
436  return false;
437  }
438  OnResolutionChanged(mode.w, mode.h);
439  return true;
440  }
441  }
442 
443  Error("No such resolution available");
444  return false;
445 }
virtual void OnResolutionChanged(unsigned int iXRes, unsigned int iYRes)=0
static constexpr int COLOR_DEPTH
Definition: C4Draw.h:89
void SetSize(unsigned int cx, unsigned int cy)
Definition: C4AppT.cpp:111
void Error(const char *m)
Definition: C4App.h:99
bool LogF(const char *strMessage,...)
Definition: C4Log.cpp:253
C4Window * pWindow
Definition: C4App.h:80

Here is the call graph for this function:

Here is the caller graph for this function:

void StdScheduler::StartOnCurrentThread ( )
inherited

Definition at line 276 of file StdSchedulerMac.mm.

References SCHAdditions::requestAdditionsForScheduler:, and SCHAdditions::start.

277 {
278  [[SCHAdditions requestAdditionsForScheduler:this] start];
279 }

Here is the call graph for this function:

void StdScheduler::UnBlock ( )
inherited

Definition at line 163 of file StdScheduler.cpp.

Referenced by StdSchedulerThread::Stop().

164 {
165  Unblocker.Notify();
166 }

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class C4GtkWindow
friend

Definition at line 163 of file C4App.h.

friend class C4Window
friend

Definition at line 162 of file C4App.h.

friend class CStdGL
friend

Definition at line 160 of file C4App.h.

friend class CStdGLCtx
friend

Definition at line 161 of file C4App.h.

Member Data Documentation

bool C4AbstractApp::fDspModeSet
protected

Definition at line 157 of file C4App.h.

bool C4AbstractApp::fQuitMsgReceived
pthread_t C4AbstractApp::MainThread

Definition at line 128 of file C4App.h.

Referenced by AssertMainThread().

std::string C4AbstractApp::sLastError
protected

Definition at line 156 of file C4App.h.

Referenced by Error(), and GetLastError().


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