OpenClonk
C4AppT.cpp
Go to the documentation of this file.
1 /*
2  * OpenClonk, http://www.openclonk.org
3  *
4  * Copyright (c) 2005-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 
17 /* A wrapper class to OS dependent event and window interfaces, Text version */
18 
19 #include "C4Include.h"
20 #include "platform/C4App.h"
21 
22 #include "game/C4Application.h"
23 #include "graphics/C4Draw.h"
24 #include "platform/C4Window.h"
25 
26 /* C4AbstractApp */
27 
29  // main thread
30 #ifdef HAVE_PTHREAD
31  : MainThread (pthread_self())
32 #endif
33 {
34  // C4StdInProc is broken on Windows
35 #ifndef STDSCHEDULER_USE_EVENTS
36  Add(&InProc);
37 #endif
38 }
39 
41 {
42  Remove(&InProc);
43 }
44 
45 bool C4AbstractApp::Init(int argc, char * argv[])
46 {
47  // Set locale
48  setlocale(LC_ALL,"");
49 
50  // Custom initialization
51  return DoInit (argc, argv);
52 }
53 
55 {
56 }
57 
59 {
60  fQuitMsgReceived = true;
61 }
62 
63 bool C4AbstractApp::GetIndexedDisplayMode(int32_t iIndex, int32_t *piXRes, int32_t *piYRes, int32_t *piBitDepth, int32_t *piRefreshRate, uint32_t iMonitor)
64 {
65  return false;
66 }
67 
69 
70 bool C4AbstractApp::SetVideoMode(int, int, unsigned int, unsigned int, bool)
71 {
72  return true;
73 }
74 
75 // Copy the text to the clipboard or the primary selection
76 bool C4AbstractApp::Copy(const std::string &text, bool fClipboard)
77 {
78  return false;
79 }
80 
81 // Paste the text from the clipboard or the primary selection
82 std::string C4AbstractApp::Paste(bool fClipboard)
83 {
84  return std::string();
85 }
86 // Is there something in the clipboard?
87 bool C4AbstractApp::IsClipboardFull(bool fClipboard)
88 {
89  return false;
90 }
91 
92 void C4AbstractApp::MessageDialog(const char * message) {}
93 
95 {
96  // Always fail after quit message
97  if (fQuitMsgReceived)
98  return false;
99  return true;
100 }
101 
103 C4Window::C4Window() = default;
104 C4Window::~C4Window() = default;
105 void C4Window::EnumerateMultiSamples(std::vector<int, std::allocator<int> >&) const {}
106 void C4Window::FlashWindow() {}
107 void C4Window::GrabMouse(bool) {}
108 bool C4Window::GetSize(C4Rect*) {return false;}
109 C4Window* C4Window::Init(C4Window::WindowKind, C4AbstractApp*, char const*, const C4Rect *) {return this;}
110 bool C4Window::ReInit(C4AbstractApp*) {return false;}
111 bool C4Window::RestorePosition(char const*, char const*, bool) {return false;}
113 void C4Window::SetSize(unsigned int, unsigned int) {}
114 void C4Window::SetTitle(char const*) {}
void GrabMouse(bool grab)
Definition: C4AppT.cpp:107
bool GetSize(C4Rect *pRect)
Definition: C4AppT.cpp:108
void FlashWindow()
Definition: C4AppMac.mm:74
void MessageDialog(const char *message)
Definition: C4AppMac.mm:62
~C4AbstractApp() override
Definition: C4AppT.cpp:40
void SetTitle(const char *Title)
Definition: C4AppT.cpp:114
bool SetVideoMode(int iXRes, int iYRes, unsigned int iRefreshRate, unsigned int iMonitor, bool fFullScreen)
Definition: C4AppSDL.cpp:354
Definition: C4Rect.h:27
virtual void EnumerateMultiSamples(std::vector< int > &samples) const
Definition: C4AppT.cpp:105
virtual bool ReInit(C4AbstractApp *pApp)
Definition: C4AppT.cpp:110
bool FlushMessages()
Definition: C4AppSDL.cpp:115
void SetSize(unsigned int cx, unsigned int cy)
Definition: C4AppT.cpp:113
virtual ~C4Window()
Definition: C4WindowSDL.cpp:46
virtual bool DoInit(int argc, char *argv[])=0
bool RestorePosition(const char *szWindowName, const char *szSubKey, bool fHidden=false)
Definition: C4AppT.cpp:111
bool fQuitMsgReceived
Definition: C4App.h:81
virtual void Quit()
Definition: C4AppSDL.cpp:110
void Remove(StdSchedulerProc *pProc)
bool GetIndexedDisplayMode(int32_t iIndex, int32_t *piXRes, int32_t *piYRes, int32_t *piBitDepth, int32_t *piRefreshRate, uint32_t iMonitor)
Definition: C4AppSDL.cpp:335
bool Copy(const std::string &text, bool fClipboard=true)
Definition: C4AppMac.mm:33
void RestoreVideoMode()
Definition: C4AppSDL.cpp:443
virtual void RequestUpdate()
Definition: C4AppT.cpp:112
bool Init(int argc, char *argv[])
Definition: C4AppSDL.cpp:87
virtual void Clear()
Definition: C4AppSDL.cpp:105
std::string Paste(bool fClipboard=true)
Definition: C4AppMac.mm:46
virtual C4Window * Init(WindowKind windowKind, C4AbstractApp *pApp, const char *Title, const C4Rect *size)
Definition: C4AppT.cpp:109
virtual void Clear()
Definition: C4AppT.cpp:102
bool IsClipboardFull(bool fClipboard=true)
Definition: C4AppMac.mm:57