forked from Mirrors/openclonk
Consolidate some random platform abstraction functions into a single file
That way, the windows variants can be used without requiring the Win32 C4Window implementation.
parent
1929e8d779
commit
b895bbad31
|
@ -500,6 +500,7 @@ set(OC_CLONK_SOURCES
|
||||||
src/platform/C4Window.h
|
src/platform/C4Window.h
|
||||||
src/platform/C4windowswrapper.h
|
src/platform/C4windowswrapper.h
|
||||||
src/platform/GetTime.cpp
|
src/platform/GetTime.cpp
|
||||||
|
src/platform/PlatformAbstraction.cpp
|
||||||
src/platform/PlatformAbstraction.h
|
src/platform/PlatformAbstraction.h
|
||||||
src/platform/StdD3D.cpp
|
src/platform/StdD3D.cpp
|
||||||
src/platform/StdD3D.h
|
src/platform/StdD3D.h
|
||||||
|
|
|
@ -474,6 +474,7 @@ src/platform/C4VideoPlayback.h \
|
||||||
src/platform/C4ViewportWindow.cpp \
|
src/platform/C4ViewportWindow.cpp \
|
||||||
src/platform/C4ViewportWindow.h \
|
src/platform/C4ViewportWindow.h \
|
||||||
src/platform/C4windowswrapper.h \
|
src/platform/C4windowswrapper.h \
|
||||||
|
src/platform/PlatformAbstraction.cpp \
|
||||||
src/platform/PlatformAbstraction.h \
|
src/platform/PlatformAbstraction.h \
|
||||||
src/platform/C4App.h \
|
src/platform/C4App.h \
|
||||||
src/platform/C4App.cpp \
|
src/platform/C4App.cpp \
|
||||||
|
|
|
@ -609,6 +609,5 @@ void C4ToolsDlg::UpdateToolCtrls() {}
|
||||||
bool C4Viewport::ScrollBarsByViewPosition() {return 0;}
|
bool C4Viewport::ScrollBarsByViewPosition() {return 0;}
|
||||||
bool C4Viewport::TogglePlayerLock() {return 0;}
|
bool C4Viewport::TogglePlayerLock() {return 0;}
|
||||||
void C4Window::RequestUpdate() {}
|
void C4Window::RequestUpdate() {}
|
||||||
bool OpenURL(char const*) {return 0;}
|
|
||||||
#include "C4ConsoleGUICommon.h"
|
#include "C4ConsoleGUICommon.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 2007 Alexander Post
|
* Copyright (c) 2007 Alexander Post
|
||||||
* Copyright (c) 2010 Martin Plicht
|
* Copyright (c) 2010 Martin Plicht
|
||||||
|
*
|
||||||
* Portions might be copyrighted by other authors who have contributed
|
* Portions might be copyrighted by other authors who have contributed
|
||||||
* to OpenClonk.
|
* to OpenClonk.
|
||||||
*
|
*
|
||||||
|
@ -38,23 +39,6 @@ bool C4AbstractApp::ScheduleProcs(int iTimeout)
|
||||||
return StdScheduler::ScheduleProcs(iTimeout);
|
return StdScheduler::ScheduleProcs(iTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(__APPLE__) && !defined(_WIN32)
|
|
||||||
|
|
||||||
bool IsGermanSystem()
|
|
||||||
{
|
|
||||||
if (strstr(setlocale(LC_MESSAGES, 0), "de"))
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EraseItemSafe(const char *szFilename)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void C4Window::PerformUpdate()
|
void C4Window::PerformUpdate()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/*
|
/*
|
||||||
* OpenClonk, http://www.openclonk.org
|
* OpenClonk, http://www.openclonk.org
|
||||||
*
|
*
|
||||||
* Copyright (c) 2001-2002, 2005-2007 Sven Eberhardt
|
|
||||||
* Copyright (c) 2005-2006, 2008-2011 Günther Brammer
|
* Copyright (c) 2005-2006, 2008-2011 Günther Brammer
|
||||||
* Copyright (c) 2005, 2007, 2009 Peter Wortmann
|
* Copyright (c) 2005, 2007, 2009 Peter Wortmann
|
||||||
|
* Copyright (c) 2002, 2005-2007 Sven Eberhardt
|
||||||
* Copyright (c) 2006, 2010 Armin Burgmeier
|
* Copyright (c) 2006, 2010 Armin Burgmeier
|
||||||
* Copyright (c) 2009-2011 Nicolas Hake
|
* Copyright (c) 2009-2011 Nicolas Hake
|
||||||
* Copyright (c) 2010 Benjamin Herr
|
* Copyright (c) 2010 Benjamin Herr
|
||||||
|
@ -830,29 +830,3 @@ void C4Window::RequestUpdate()
|
||||||
PerformUpdate();
|
PerformUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenURL(const char *szURL)
|
|
||||||
{
|
|
||||||
return (intptr_t)ShellExecuteW(NULL, L"open", GetWideChar(szURL), NULL, NULL, SW_SHOW) > 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EraseItemSafe(const char *szFilename)
|
|
||||||
{
|
|
||||||
char Filename[_MAX_PATH+1];
|
|
||||||
SCopy(szFilename, Filename, _MAX_PATH);
|
|
||||||
Filename[SLen(Filename)+1]=0;
|
|
||||||
SHFILEOPSTRUCTW shs;
|
|
||||||
shs.hwnd=0;
|
|
||||||
shs.wFunc=FO_DELETE;
|
|
||||||
shs.pFrom=GetWideChar(Filename);
|
|
||||||
shs.pTo=NULL;
|
|
||||||
shs.fFlags=FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_SILENT;
|
|
||||||
shs.fAnyOperationsAborted=false;
|
|
||||||
shs.hNameMappings=0;
|
|
||||||
shs.lpszProgressTitle=NULL;
|
|
||||||
return !SHFileOperationW(&shs);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsGermanSystem()
|
|
||||||
{
|
|
||||||
return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_GERMAN;
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
* OpenClonk, http://www.openclonk.org
|
||||||
|
*
|
||||||
|
* Copyright (c) 2001 Sven Eberhardt
|
||||||
|
* Copyright (c) 2010 Martin Plicht
|
||||||
|
* Copyright (c) 2012 Günther Brammer
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <C4Include.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <C4windowswrapper.h>
|
||||||
|
#include <shellapi.h>
|
||||||
|
bool OpenURL(const char *szURL)
|
||||||
|
{
|
||||||
|
return (intptr_t)ShellExecuteW(NULL, L"open", GetWideChar(szURL), NULL, NULL, SW_SHOW) > 32;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EraseItemSafe(const char *szFilename)
|
||||||
|
{
|
||||||
|
char Filename[_MAX_PATH+1];
|
||||||
|
SCopy(szFilename, Filename, _MAX_PATH);
|
||||||
|
Filename[SLen(Filename)+1]=0;
|
||||||
|
SHFILEOPSTRUCTW shs;
|
||||||
|
shs.hwnd=0;
|
||||||
|
shs.wFunc=FO_DELETE;
|
||||||
|
shs.pFrom=GetWideChar(Filename);
|
||||||
|
shs.pTo=NULL;
|
||||||
|
shs.fFlags=FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_SILENT;
|
||||||
|
shs.fAnyOperationsAborted=false;
|
||||||
|
shs.hNameMappings=0;
|
||||||
|
shs.lpszProgressTitle=NULL;
|
||||||
|
return !SHFileOperationW(&shs);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsGermanSystem()
|
||||||
|
{
|
||||||
|
return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_GERMAN;
|
||||||
|
}
|
||||||
|
#elif !defined(__APPLE__)
|
||||||
|
|
||||||
|
bool IsGermanSystem()
|
||||||
|
{
|
||||||
|
if (strstr(setlocale(LC_MESSAGES, 0), "de"))
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EraseItemSafe(const char *szFilename)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(USE_X11)
|
||||||
|
bool OpenURL(char const*) {return 0;}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue