2009-05-08 13:28:41 +00:00
|
|
|
/*
|
|
|
|
* OpenClonk, http://www.openclonk.org
|
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* Copyright (c) 2005-2009, RedWolf Design GmbH, http://www.clonk.de/
|
2016-04-03 18:18:29 +00:00
|
|
|
* Copyright (c) 2009-2016, The OpenClonk Team and contributors
|
2009-05-08 13:28:41 +00:00
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* Distributed under the terms of the ISC license; see accompanying file
|
|
|
|
* "COPYING" for details.
|
2009-05-08 13:28:41 +00:00
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* "Clonk" is a registered trademark of Matthes Bender, used with permission.
|
|
|
|
* See accompanying file "TRADEMARK" for details.
|
2009-05-08 13:28:41 +00:00
|
|
|
*
|
2013-12-17 20:01:09 +00:00
|
|
|
* To redistribute this file separately, substitute the full license texts
|
|
|
|
* for the above references.
|
2009-05-08 13:28:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* A wrapper class to OS dependent event and window interfaces, Text version */
|
|
|
|
|
2016-04-03 18:07:56 +00:00
|
|
|
#include "C4Include.h"
|
|
|
|
#include "platform/C4App.h"
|
2012-11-15 22:01:24 +00:00
|
|
|
|
2016-04-03 18:07:56 +00:00
|
|
|
#include "game/C4Application.h"
|
2017-04-30 08:49:09 +00:00
|
|
|
#include "graphics/C4Draw.h"
|
|
|
|
#include "platform/C4Window.h"
|
2009-05-08 13:28:41 +00:00
|
|
|
|
2011-08-27 14:20:39 +00:00
|
|
|
/* C4AbstractApp */
|
2009-05-08 13:28:41 +00:00
|
|
|
|
2017-05-07 11:50:00 +00:00
|
|
|
C4AbstractApp::C4AbstractApp()
|
2010-03-28 18:58:01 +00:00
|
|
|
// main thread
|
2009-05-08 13:28:41 +00:00
|
|
|
#ifdef HAVE_PTHREAD
|
2017-05-07 11:50:00 +00:00
|
|
|
: MainThread (pthread_self())
|
2009-05-08 13:28:41 +00:00
|
|
|
#endif
|
|
|
|
{
|
2018-03-04 20:51:36 +00:00
|
|
|
// C4StdInProc is broken on Windows
|
|
|
|
#ifndef STDSCHEDULER_USE_EVENTS
|
2011-01-09 23:01:17 +00:00
|
|
|
Add(&InProc);
|
2018-03-04 20:51:36 +00:00
|
|
|
#endif
|
2009-05-08 13:28:41 +00:00
|
|
|
}
|
|
|
|
|
2011-08-27 14:20:39 +00:00
|
|
|
C4AbstractApp::~C4AbstractApp()
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2011-01-09 23:01:17 +00:00
|
|
|
Remove(&InProc);
|
2009-05-08 13:28:41 +00:00
|
|
|
}
|
|
|
|
|
2011-08-27 14:20:39 +00:00
|
|
|
bool C4AbstractApp::Init(int argc, char * argv[])
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2009-05-08 13:28:41 +00:00
|
|
|
// Set locale
|
|
|
|
setlocale(LC_ALL,"");
|
|
|
|
|
|
|
|
// Custom initialization
|
2010-10-04 19:39:19 +00:00
|
|
|
return DoInit (argc, argv);
|
2009-05-08 13:28:41 +00:00
|
|
|
}
|
|
|
|
|
2011-08-27 14:20:39 +00:00
|
|
|
void C4AbstractApp::Clear()
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2009-05-08 13:28:41 +00:00
|
|
|
}
|
|
|
|
|
2011-08-27 14:20:39 +00:00
|
|
|
void C4AbstractApp::Quit()
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2009-05-08 13:28:41 +00:00
|
|
|
fQuitMsgReceived = true;
|
|
|
|
}
|
2011-01-09 23:01:17 +00:00
|
|
|
|
2011-08-27 14:20:39 +00:00
|
|
|
bool C4AbstractApp::GetIndexedDisplayMode(int32_t iIndex, int32_t *piXRes, int32_t *piYRes, int32_t *piBitDepth, int32_t *piRefreshRate, uint32_t iMonitor)
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2009-05-08 13:28:41 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-08-27 14:20:39 +00:00
|
|
|
void C4AbstractApp::RestoreVideoMode() {}
|
2009-05-08 13:28:41 +00:00
|
|
|
|
2016-02-01 22:59:38 +00:00
|
|
|
bool C4AbstractApp::SetVideoMode(int, int, unsigned int, unsigned int, bool)
|
2012-04-01 20:16:59 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2009-05-08 13:28:41 +00:00
|
|
|
|
|
|
|
// Copy the text to the clipboard or the primary selection
|
2017-03-11 18:52:24 +00:00
|
|
|
bool C4AbstractApp::Copy(const std::string &text, bool fClipboard)
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2011-01-09 23:01:17 +00:00
|
|
|
return false;
|
2009-05-08 13:28:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Paste the text from the clipboard or the primary selection
|
2017-03-11 18:52:24 +00:00
|
|
|
std::string C4AbstractApp::Paste(bool fClipboard)
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2017-03-11 18:52:24 +00:00
|
|
|
return std::string();
|
2009-05-08 13:28:41 +00:00
|
|
|
}
|
|
|
|
// Is there something in the clipboard?
|
2011-08-27 14:20:39 +00:00
|
|
|
bool C4AbstractApp::IsClipboardFull(bool fClipboard)
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2009-05-08 13:28:41 +00:00
|
|
|
return false;
|
|
|
|
}
|
2011-01-09 23:01:17 +00:00
|
|
|
|
2012-02-28 19:40:19 +00:00
|
|
|
void C4AbstractApp::MessageDialog(const char * message) {}
|
2009-05-08 13:28:41 +00:00
|
|
|
|
2011-08-27 14:20:39 +00:00
|
|
|
bool C4AbstractApp::FlushMessages()
|
2009-05-08 13:28:41 +00:00
|
|
|
{
|
2011-01-09 23:01:17 +00:00
|
|
|
// Always fail after quit message
|
|
|
|
if (fQuitMsgReceived)
|
|
|
|
return false;
|
|
|
|
return true;
|
2009-05-08 13:28:41 +00:00
|
|
|
}
|
2011-01-09 23:01:17 +00:00
|
|
|
|
2011-08-27 21:12:01 +00:00
|
|
|
void C4Window::Clear() {}
|
2017-05-03 18:28:00 +00:00
|
|
|
C4Window::C4Window() = default;
|
|
|
|
C4Window::~C4Window() = default;
|
2011-08-27 21:12:01 +00:00
|
|
|
void C4Window::EnumerateMultiSamples(std::vector<int, std::allocator<int> >&) const {}
|
|
|
|
void C4Window::FlashWindow() {}
|
2016-02-12 21:40:55 +00:00
|
|
|
void C4Window::GrabMouse(bool) {}
|
2017-05-03 18:28:00 +00:00
|
|
|
bool C4Window::GetSize(C4Rect*) {return false;}
|
2012-04-01 20:16:59 +00:00
|
|
|
C4Window* C4Window::Init(C4Window::WindowKind, C4AbstractApp*, char const*, const C4Rect *) {return this;}
|
2017-05-03 18:28:00 +00:00
|
|
|
bool C4Window::ReInit(C4AbstractApp*) {return false;}
|
|
|
|
bool C4Window::RestorePosition(char const*, char const*, bool) {return false;}
|
2012-03-25 00:54:07 +00:00
|
|
|
void C4Window::RequestUpdate() {}
|
2011-08-27 21:12:01 +00:00
|
|
|
void C4Window::SetSize(unsigned int, unsigned int) {}
|
|
|
|
void C4Window::SetTitle(char const*) {}
|