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 "platform/C4Window.h"
23 #include "graphics/C4Draw.h"
24 #include "game/C4Application.h"
25 
26 /* C4AbstractApp */
27 
28 C4AbstractApp::C4AbstractApp(): Active(false), fQuitMsgReceived(false),
29  // main thread
30 #ifdef HAVE_PTHREAD
31  MainThread (pthread_self()),
32 #endif
33  fDspModeSet(false)
34 {
35  Add(&InProc);
36 }
37 
39 {
40  Remove(&InProc);
41 }
42 
43 bool C4AbstractApp::Init(int argc, char * argv[])
44 {
45  // Set locale
46  setlocale(LC_ALL,"");
47 
48  // Custom initialization
49  return DoInit (argc, argv);
50 }
51 
53 {
54 }
55 
57 {
58  fQuitMsgReceived = true;
59 }
60 
61 bool C4AbstractApp::GetIndexedDisplayMode(int32_t iIndex, int32_t *piXRes, int32_t *piYRes, int32_t *piBitDepth, int32_t *piRefreshRate, uint32_t iMonitor)
62 {
63  return false;
64 }
65 
67 
68 bool C4AbstractApp::SetVideoMode(int, int, unsigned int, unsigned int, bool)
69 {
70  return true;
71 }
72 
73 // Copy the text to the clipboard or the primary selection
74 bool C4AbstractApp::Copy(const std::string &text, bool fClipboard)
75 {
76  return false;
77 }
78 
79 // Paste the text from the clipboard or the primary selection
80 std::string C4AbstractApp::Paste(bool fClipboard)
81 {
82  return std::string();
83 }
84 // Is there something in the clipboard?
85 bool C4AbstractApp::IsClipboardFull(bool fClipboard)
86 {
87  return false;
88 }
89 
90 void C4AbstractApp::MessageDialog(const char * message) {}
91 
93 {
94  // Always fail after quit message
95  if (fQuitMsgReceived)
96  return false;
97  return true;
98 }
99 
103 void C4Window::EnumerateMultiSamples(std::vector<int, std::allocator<int> >&) const {}
104 void C4Window::FlashWindow() {}
105 void C4Window::GrabMouse(bool) {}
106 bool C4Window::GetSize(C4Rect*) {return 0;}
107 C4Window* C4Window::Init(C4Window::WindowKind, C4AbstractApp*, char const*, const C4Rect *) {return this;}
108 bool C4Window::ReInit(C4AbstractApp*) {return 0;}
109 bool C4Window::RestorePosition(char const*, char const*, bool) {return 0;}
111 void C4Window::SetSize(unsigned int, unsigned int) {}
112 void C4Window::SetTitle(char const*) {}
void GrabMouse(bool grab)
Definition: C4AppT.cpp:105
bool GetSize(C4Rect *pRect)
Definition: C4AppT.cpp:106
void FlashWindow()
Definition: C4AppMac.mm:75
void MessageDialog(const char *message)
Definition: C4AppMac.mm:63
void SetTitle(const char *Title)
Definition: C4AppT.cpp:112
bool SetVideoMode(int iXRes, int iYRes, unsigned int iRefreshRate, unsigned int iMonitor, bool fFullScreen)
Definition: C4AppSDL.cpp:358
Definition: C4Rect.h:29
virtual void EnumerateMultiSamples(std::vector< int > &samples) const
Definition: C4AppT.cpp:103
void Add(StdSchedulerProc *pProc)
virtual bool ReInit(C4AbstractApp *pApp)
Definition: C4AppT.cpp:108
bool FlushMessages()
Definition: C4AppSDL.cpp:119
void SetSize(unsigned int cx, unsigned int cy)
Definition: C4AppT.cpp:111
virtual ~C4AbstractApp()
Definition: C4AppSDL.cpp:87
virtual ~C4Window()
Definition: C4AppT.cpp:102
virtual bool DoInit(int argc, char *argv[])=0
bool RestorePosition(const char *szWindowName, const char *szSubKey, bool fHidden=false)
Definition: C4AppT.cpp:109
bool fQuitMsgReceived
Definition: C4App.h:81
virtual void Quit()
Definition: C4AppSDL.cpp:114
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:339
bool Copy(const std::string &text, bool fClipboard=true)
Definition: C4AppMac.mm:34
void RestoreVideoMode()
Definition: C4AppSDL.cpp:447
virtual void RequestUpdate()
Definition: C4AppT.cpp:110
bool Init(int argc, char *argv[])
Definition: C4AppSDL.cpp:91
virtual void Clear()
Definition: C4AppSDL.cpp:109
std::string Paste(bool fClipboard=true)
Definition: C4AppMac.mm:47
virtual C4Window * Init(WindowKind windowKind, C4AbstractApp *pApp, const char *Title, const C4Rect *size)
Definition: C4AppT.cpp:107
virtual void Clear()
Definition: C4AppT.cpp:100
bool IsClipboardFull(bool fClipboard=true)
Definition: C4AppMac.mm:58
C4Window()
Definition: C4AppT.cpp:101