2009-05-08 13:28:41 +00:00
|
|
|
/*
|
|
|
|
* OpenClonk, http://www.openclonk.org
|
|
|
|
*
|
2010-12-23 00:01:24 +00:00
|
|
|
* Copyright (c) 2005 Peter Wortmann
|
2013-01-09 23:23:06 +00:00
|
|
|
* Copyright (c) 2005-2006, 2008-2009, 2011-2012 Günther Brammer
|
2010-12-23 00:01:24 +00:00
|
|
|
* Copyright (c) 2006 Armin Burgmeier
|
2009-06-05 13:41:20 +00:00
|
|
|
* Copyright (c) 2009 Nicolas Hake
|
2010-12-23 00:01:24 +00:00
|
|
|
* Copyright (c) 2010 Benjamin Herr
|
2009-05-08 13:28:41 +00:00
|
|
|
* Copyright (c) 2005-2009, RedWolf Design GmbH, http://www.clonk.de
|
|
|
|
*
|
|
|
|
* Portions might be copyrighted by other authors who have contributed
|
|
|
|
* to OpenClonk.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
* See isc_license.txt for full license and disclaimer.
|
|
|
|
*
|
|
|
|
* "Clonk" is a registered trademark of Matthes Bender.
|
|
|
|
* See clonk_trademark_license.txt for full license.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* A wrapper class to OS dependent event and window interfaces, Text version */
|
|
|
|
|
2010-03-04 21:12:35 +00:00
|
|
|
#include <C4Include.h>
|
2012-11-15 22:01:24 +00:00
|
|
|
#include "C4App.h"
|
|
|
|
|
2011-10-03 15:19:24 +00:00
|
|
|
#include <C4Window.h>
|
2012-04-27 17:04:43 +00:00
|
|
|
#include <C4Draw.h>
|
2011-01-09 23:01:17 +00:00
|
|
|
#include <C4Application.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
|
|
|
|
2011-08-27 14:20:39 +00:00
|
|
|
C4AbstractApp::C4AbstractApp(): Active(false), fQuitMsgReceived(false),
|
2010-03-28 18:58:01 +00:00
|
|
|
// main thread
|
2009-05-08 13:28:41 +00:00
|
|
|
#ifdef HAVE_PTHREAD
|
2010-03-28 18:58:01 +00:00
|
|
|
MainThread (pthread_self()),
|
2009-05-08 13:28:41 +00:00
|
|
|
#endif
|
2010-03-28 18:58:01 +00:00
|
|
|
fDspModeSet(false)
|
2009-05-08 13:28:41 +00:00
|
|
|
{
|
2011-01-09 23:01:17 +00:00
|
|
|
Add(&InProc);
|
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
|
|
|
|
2012-04-01 20:16:59 +00:00
|
|
|
bool C4AbstractApp::SetVideoMode(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, bool)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2009-05-08 13:28:41 +00:00
|
|
|
|
|
|
|
// Copy the text to the clipboard or the primary selection
|
2011-08-27 14:20:39 +00:00
|
|
|
bool C4AbstractApp::Copy(const StdStrBuf & 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
|
2011-08-27 14:20:39 +00:00
|
|
|
StdStrBuf C4AbstractApp::Paste(bool fClipboard)
|
2010-03-28 18:58:01 +00:00
|
|
|
{
|
2009-05-08 13:28:41 +00:00
|
|
|
return StdStrBuf("");
|
|
|
|
}
|
|
|
|
// 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
|
|
|
|
2013-10-29 13:27:18 +00:00
|
|
|
bool C4AbstractApp::ApplyGammaRamp(_GAMMARAMP&, bool) { return true; }
|
|
|
|
bool C4AbstractApp::SaveDefaultGammaRamp(_GAMMARAMP&) { return true; }
|
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() {}
|
|
|
|
C4Window::C4Window() {}
|
|
|
|
C4Window::~C4Window() {}
|
|
|
|
void C4Window::EnumerateMultiSamples(std::vector<int, std::allocator<int> >&) const {}
|
|
|
|
void C4Window::FlashWindow() {}
|
|
|
|
bool C4Window::GetSize(C4Rect*) {return 0;}
|
2012-04-01 20:16:59 +00:00
|
|
|
C4Window* C4Window::Init(C4Window::WindowKind, C4AbstractApp*, char const*, const C4Rect *) {return this;}
|
2011-08-27 21:12:01 +00:00
|
|
|
bool C4Window::ReInit(C4AbstractApp*) {return 0;}
|
|
|
|
bool C4Window::RestorePosition(char const*, char const*, bool) {return 0;}
|
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*) {}
|