OpenClonk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
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  Add(&InProc);
35 }
36 
38 {
39  Remove(&InProc);
40 }
41 
42 bool C4AbstractApp::Init(int argc, char * argv[])
43 {
44  // Set locale
45  setlocale(LC_ALL,"");
46 
47  // Custom initialization
48  return DoInit (argc, argv);
49 }
50 
52 {
53 }
54 
56 {
57  fQuitMsgReceived = true;
58 }
59 
60 bool C4AbstractApp::GetIndexedDisplayMode(int32_t iIndex, int32_t *piXRes, int32_t *piYRes, int32_t *piBitDepth, int32_t *piRefreshRate, uint32_t iMonitor)
61 {
62  return false;
63 }
64 
66 
67 bool C4AbstractApp::SetVideoMode(int, int, unsigned int, unsigned int, bool)
68 {
69  return true;
70 }
71 
72 // Copy the text to the clipboard or the primary selection
73 bool C4AbstractApp::Copy(const std::string &text, bool fClipboard)
74 {
75  return false;
76 }
77 
78 // Paste the text from the clipboard or the primary selection
79 std::string C4AbstractApp::Paste(bool fClipboard)
80 {
81  return std::string();
82 }
83 // Is there something in the clipboard?
84 bool C4AbstractApp::IsClipboardFull(bool fClipboard)
85 {
86  return false;
87 }
88 
89 void C4AbstractApp::MessageDialog(const char * message) {}
90 
92 {
93  // Always fail after quit message
94  if (fQuitMsgReceived)
95  return false;
96  return true;
97 }
98 
99 void C4Window::Clear() {}
100 C4Window::C4Window() = default;
101 C4Window::~C4Window() = default;
102 void C4Window::EnumerateMultiSamples(std::vector<int, std::allocator<int> >&) const {}
103 void C4Window::FlashWindow() {}
104 void C4Window::GrabMouse(bool) {}
105 bool C4Window::GetSize(C4Rect*) {return false;}
106 C4Window* C4Window::Init(C4Window::WindowKind, C4AbstractApp*, char const*, const C4Rect *) {return this;}
107 bool C4Window::ReInit(C4AbstractApp*) {return false;}
108 bool C4Window::RestorePosition(char const*, char const*, bool) {return false;}
110 void C4Window::SetSize(unsigned int, unsigned int) {}
111 void C4Window::SetTitle(char const*) {}
void GrabMouse(bool grab)
Definition: C4AppT.cpp:104
bool GetSize(C4Rect *pRect)
Definition: C4AppT.cpp:105
void FlashWindow()
Definition: C4AppMac.mm:74
void MessageDialog(const char *message)
Definition: C4AppMac.mm:62
~C4AbstractApp() override
Definition: C4AppT.cpp:37
void SetTitle(const char *Title)
Definition: C4AppT.cpp:111
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:102
virtual bool ReInit(C4AbstractApp *pApp)
Definition: C4AppT.cpp:107
bool FlushMessages()
Definition: C4AppSDL.cpp:115
void SetSize(unsigned int cx, unsigned int cy)
Definition: C4AppT.cpp:110
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:108
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:109
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:106
virtual void Clear()
Definition: C4AppT.cpp:99
bool IsClipboardFull(bool fClipboard=true)
Definition: C4AppMac.mm:57