forked from Mirrors/openclonk
Update the SDL port to SDL2
SDL2 is a much closer match to the other platform code, and allows the creation of OpenGL 3 core contexts, which is now required.epoxy
parent
1010732ba8
commit
934b519bb4
|
@ -300,11 +300,11 @@ if(Audio_FOUND)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# SDL
|
# SDL
|
||||||
if(USE_SDL_MAINLOOP OR (Audio_TK STREQUAL "SDL_Mixer"))
|
if(USE_SDL_MAINLOOP)
|
||||||
find_package(SDL)
|
find_package(SDL2 REQUIRED)
|
||||||
SET(HAVE_SDL ${SDL_FOUND})
|
include_directories(${SDL2_INCLUDE_DIRS})
|
||||||
include_directories(${SDL_INCLUDE_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
|
set(HAVE_SDL ${SDL2_FOUND})
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
# generated source files
|
# generated source files
|
||||||
|
@ -1093,7 +1093,7 @@ target_link_libraries(openclonk
|
||||||
${PNG_LIBRARIES}
|
${PNG_LIBRARIES}
|
||||||
${JPEG_LIBRARIES}
|
${JPEG_LIBRARIES}
|
||||||
${EXECINFO_LIBRARY}
|
${EXECINFO_LIBRARY}
|
||||||
${SDL_LIBRARY}
|
${SDL2_LIBRARIES}
|
||||||
${Audio_LIBRARIES}
|
${Audio_LIBRARIES}
|
||||||
${GETOPT_LIBRARIES}
|
${GETOPT_LIBRARIES}
|
||||||
${GLEW_LIBRARIES}
|
${GLEW_LIBRARIES}
|
||||||
|
|
|
@ -82,19 +82,12 @@ macro(__FINDAUDIO_FINDOPENAL)
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(__FINDAUDIO_FINDSDLMIXER)
|
|
||||||
find_package(PkgConfig QUIET)
|
|
||||||
if(PKG_CONFIG_FOUND)
|
|
||||||
pkg_check_modules(SDLMixer "SDL_mixer>=1.2.11")
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
if(Audio_TK)
|
if(Audio_TK)
|
||||||
# Already chosen, don't do anything
|
# Already chosen, don't do anything
|
||||||
else()
|
else()
|
||||||
# Test for OpenAL
|
# Test for OpenAL
|
||||||
__FINDAUDIO_FINDOPENAL()
|
__FINDAUDIO_FINDOPENAL()
|
||||||
__FINDAUDIO_FINDSDLMIXER()
|
find_package(SDL2Mixer)
|
||||||
|
|
||||||
if(OpenAL_FOUND AND Alut_FOUND AND OggVorbis_FOUND)
|
if(OpenAL_FOUND AND Alut_FOUND AND OggVorbis_FOUND)
|
||||||
# Prefer OpenAL
|
# Prefer OpenAL
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
# OpenClonk, http://www.openclonk.org
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016, The OpenClonk Team and contributors
|
||||||
|
#
|
||||||
|
# Distributed under the terms of the ISC license; see accompanying file
|
||||||
|
# "COPYING" for details.
|
||||||
|
#
|
||||||
|
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
|
||||||
|
# See accompanying file "TRADEMARK" for details.
|
||||||
|
#
|
||||||
|
# To redistribute this file separately, substitute the full license texts
|
||||||
|
# for the above references.
|
||||||
|
|
||||||
|
# Locate SDL2.
|
||||||
|
# This module defines
|
||||||
|
# SDL2_INCLUDE_DIRS - a list of directories that need to be added to the include path
|
||||||
|
# SDL2_LIBRARIES - a list of libraries to link against to use SDL2
|
||||||
|
# SDL2_FOUND - if false, SDL2 cannot be used
|
||||||
|
|
||||||
|
find_path(SDL2_INCLUDE_DIR SDL.h PATH_SUFFIXES SDL2 HINTS ENV SDL2DIR)
|
||||||
|
mark_as_advanced(SDL2_INCLUDE_DIR)
|
||||||
|
find_library(SDL2_LIBRARY SDL2 HINTS ENV SDL2DIR)
|
||||||
|
mark_as_advanced(SDL2_LIBRARY)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if (SDL2_FOUND)
|
||||||
|
set(SDL2_LIBRARIES "${SDL2_LIBRARY}")
|
||||||
|
set(SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIR}")
|
||||||
|
endif()
|
|
@ -0,0 +1,37 @@
|
||||||
|
# OpenClonk, http://www.openclonk.org
|
||||||
|
#
|
||||||
|
# Copyright (c) 2016, The OpenClonk Team and contributors
|
||||||
|
#
|
||||||
|
# Distributed under the terms of the ISC license; see accompanying file
|
||||||
|
# "COPYING" for details.
|
||||||
|
#
|
||||||
|
# "Clonk" is a registered trademark of Matthes Bender, used with permission.
|
||||||
|
# See accompanying file "TRADEMARK" for details.
|
||||||
|
#
|
||||||
|
# To redistribute this file separately, substitute the full license texts
|
||||||
|
# for the above references.
|
||||||
|
|
||||||
|
# Locate SDL_Mixer 2.
|
||||||
|
# This module defines
|
||||||
|
# SDL2Mixer_INCLUDE_DIRS - a list of directories that need to be added to the include path
|
||||||
|
# SDL2Mixer_LIBRARIES - a list of libraries to link against to use SDL2
|
||||||
|
# SDL2Mixer_FOUND - if false, SDL2 cannot be used
|
||||||
|
|
||||||
|
if(SDL2Mixer_FIND_QUIETLY)
|
||||||
|
set(_FIND_SDL2_ARG QUIET)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(SDL2 ${_FIND_SDL2_ARG})
|
||||||
|
find_path(SDL2Mixer_INCLUDE_DIR SDL_mixer.h PATH_SUFFIXES SDL2 HINTS ENV SDL2DIR)
|
||||||
|
mark_as_advanced(SDL2Mixer_INCLUDE_DIR)
|
||||||
|
find_library(SDL2Mixer_LIBRARY SDL2_mixer HINTS ENV SDL2DIR)
|
||||||
|
mark_as_advanced(SDL2Mixer_LIBRARY)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(SDL2Mixer REQUIRED_VARS SDL2Mixer_LIBRARY SDL2Mixer_INCLUDE_DIR
|
||||||
|
SDL2_LIBRARIES SDL2_INCLUDE_DIRS)
|
||||||
|
|
||||||
|
if (SDL2Mixer_FOUND)
|
||||||
|
set(SDL2Mixer_LIBRARIES ${SDL2Mixer_LIBRARY} ${SDL2_LIBRARIES})
|
||||||
|
set(SDL2Mixer_INCLUDE_DIRS ${SDL2Mixer_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS})
|
||||||
|
endif()
|
|
@ -577,7 +577,11 @@ bool C4ConsoleGUI::ClearLog() {return 0;}
|
||||||
void C4ConsoleGUI::ClearNetMenu() {}
|
void C4ConsoleGUI::ClearNetMenu() {}
|
||||||
void C4ConsoleGUI::ClearPlayerMenu() {}
|
void C4ConsoleGUI::ClearPlayerMenu() {}
|
||||||
void C4ConsoleGUI::ClearViewportMenu() {}
|
void C4ConsoleGUI::ClearViewportMenu() {}
|
||||||
C4Window * C4ConsoleGUI::CreateConsoleWindow(C4AbstractApp*) { return this; }
|
C4Window * C4ConsoleGUI::CreateConsoleWindow(C4AbstractApp * pApp)
|
||||||
|
{
|
||||||
|
C4Rect r(0, 0, 400, 350);
|
||||||
|
return C4Window::Init(C4Window::W_Console, pApp, LoadResStr("IDS_CNS_CONSOLE"), &r);
|
||||||
|
}
|
||||||
void C4ConsoleGUI::DisplayInfoText(C4ConsoleGUI::InfoTextType, StdStrBuf&) {}
|
void C4ConsoleGUI::DisplayInfoText(C4ConsoleGUI::InfoTextType, StdStrBuf&) {}
|
||||||
void C4ConsoleGUI::DoEnableControls(bool) {}
|
void C4ConsoleGUI::DoEnableControls(bool) {}
|
||||||
bool C4ConsoleGUI::DoUpdateHaltCtrls(bool) {return 0;}
|
bool C4ConsoleGUI::DoUpdateHaltCtrls(bool) {return 0;}
|
||||||
|
|
|
@ -127,6 +127,8 @@ protected:
|
||||||
HDC hDC; // device context handle
|
HDC hDC; // device context handle
|
||||||
#elif defined(USE_GTK)
|
#elif defined(USE_GTK)
|
||||||
/*GLXContext*/void * ctx;
|
/*GLXContext*/void * ctx;
|
||||||
|
#elif defined(USE_SDL_MAINLOOP)
|
||||||
|
void * ctx;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Global list of all OpenGL contexts in use
|
// Global list of all OpenGL contexts in use
|
||||||
|
|
|
@ -580,6 +580,8 @@ CStdGLCtx::CStdGLCtx(): pWindow(0), this_context(contexts.end()) { }
|
||||||
|
|
||||||
void CStdGLCtx::Clear(bool multisample_change)
|
void CStdGLCtx::Clear(bool multisample_change)
|
||||||
{
|
{
|
||||||
|
SDL_GL_DeleteContext(ctx);
|
||||||
|
ctx = 0;
|
||||||
pWindow = 0;
|
pWindow = 0;
|
||||||
|
|
||||||
if (this_context != contexts.end())
|
if (this_context != contexts.end())
|
||||||
|
@ -595,6 +597,7 @@ bool CStdGLCtx::Init(C4Window * pWindow, C4AbstractApp *)
|
||||||
if (!pGL) return false;
|
if (!pGL) return false;
|
||||||
// store window
|
// store window
|
||||||
this->pWindow = pWindow;
|
this->pWindow = pWindow;
|
||||||
|
ctx = SDL_GL_CreateContext(pWindow->window);
|
||||||
// No luck at all?
|
// No luck at all?
|
||||||
if (!Select(true)) return pGL->Error(" gl: Unable to select context");
|
if (!Select(true)) return pGL->Error(" gl: Unable to select context");
|
||||||
// init extensions
|
// init extensions
|
||||||
|
@ -612,6 +615,7 @@ bool CStdGLCtx::Init(C4Window * pWindow, C4AbstractApp *)
|
||||||
|
|
||||||
bool CStdGLCtx::Select(bool verbose)
|
bool CStdGLCtx::Select(bool verbose)
|
||||||
{
|
{
|
||||||
|
SDL_GL_MakeCurrent(pWindow->window, ctx);
|
||||||
SelectCommon();
|
SelectCommon();
|
||||||
// update clipper - might have been done by UpdateSize
|
// update clipper - might have been done by UpdateSize
|
||||||
// however, the wrong size might have been assumed
|
// however, the wrong size might have been assumed
|
||||||
|
@ -638,7 +642,7 @@ bool CStdGLCtx::PageFlip()
|
||||||
// flush GL buffer
|
// flush GL buffer
|
||||||
glFlush();
|
glFlush();
|
||||||
if (!pWindow) return false;
|
if (!pWindow) return false;
|
||||||
SDL_GL_SwapBuffers();
|
SDL_GL_SwapWindow(pWindow->window);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,31 +34,6 @@
|
||||||
|
|
||||||
#ifdef USE_SDL_MAINLOOP
|
#ifdef USE_SDL_MAINLOOP
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <SDL_keysym.h>
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
std::string getKeyName(C4KeyCode k)
|
|
||||||
{
|
|
||||||
std::string result = SDL_GetKeyName(static_cast<SDLKey>(k));
|
|
||||||
// unknown key
|
|
||||||
if (result == "unknown key")
|
|
||||||
result = FormatString("\\x%x", (DWORD) k).getData();
|
|
||||||
// some special cases
|
|
||||||
if (result == "world 0") result = "´";
|
|
||||||
if (result == "world 1") result = "ß";
|
|
||||||
if (result == "world 2") result = "Ü";
|
|
||||||
if (result == "world 3") result = "Ä";
|
|
||||||
if (result == "world 4") result = "Ö";
|
|
||||||
// capitalize first letter
|
|
||||||
result[0] = toupper(result[0]);
|
|
||||||
// return key name
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ----------------- Key maps ------------------ */
|
/* ----------------- Key maps ------------------ */
|
||||||
|
@ -102,7 +77,9 @@ struct C4KeyCodeMapEntry
|
||||||
const char *szShortName;
|
const char *szShortName;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(USE_WIN32_WINDOWS) || defined(USE_GTK)
|
#if defined(USE_COCOA)
|
||||||
|
#include "CocoaKeycodeMap.h"
|
||||||
|
#else
|
||||||
const C4KeyCodeMapEntry KeyCodeMap[] = {
|
const C4KeyCodeMapEntry KeyCodeMap[] = {
|
||||||
{K_ESCAPE, "Escape", "Esc"},
|
{K_ESCAPE, "Escape", "Esc"},
|
||||||
{K_1, "1", NULL},
|
{K_1, "1", NULL},
|
||||||
|
@ -211,8 +188,6 @@ const C4KeyCodeMapEntry KeyCodeMap[] = {
|
||||||
{K_PRINT, "Print", NULL},
|
{K_PRINT, "Print", NULL},
|
||||||
{0x00, NULL, NULL}
|
{0x00, NULL, NULL}
|
||||||
};
|
};
|
||||||
#elif defined(USE_COCOA)
|
|
||||||
#include "CocoaKeycodeMap.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void C4KeyCodeEx::FixShiftKeys()
|
void C4KeyCodeEx::FixShiftKeys()
|
||||||
|
@ -331,7 +306,6 @@ C4KeyCode C4KeyCodeEx::String2KeyCode(const StdStrBuf &sName)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#if defined(USE_WIN32_WINDOWS) || defined(USE_COCOA) || defined(USE_GTK)
|
|
||||||
// query map
|
// query map
|
||||||
const C4KeyCodeMapEntry *pCheck = KeyCodeMap;
|
const C4KeyCodeMapEntry *pCheck = KeyCodeMap;
|
||||||
while (pCheck->szName) {
|
while (pCheck->szName) {
|
||||||
|
@ -340,17 +314,11 @@ C4KeyCode C4KeyCodeEx::String2KeyCode(const StdStrBuf &sName)
|
||||||
}
|
}
|
||||||
++pCheck;
|
++pCheck;
|
||||||
}
|
}
|
||||||
return KEY_Undefined;
|
#if defined(USE_SDL_MAINLOOP)
|
||||||
#elif defined(USE_SDL_MAINLOOP)
|
SDL_Scancode s = SDL_GetScancodeFromName(sName.getData());
|
||||||
for (C4KeyCode k = 0; k < SDLK_LAST; ++k)
|
if (s != SDL_SCANCODE_UNKNOWN) return s;
|
||||||
{
|
|
||||||
if (SEqualNoCase(sName.getData(), getKeyName(k).c_str()))
|
|
||||||
return k;
|
|
||||||
}
|
|
||||||
return KEY_Undefined;
|
|
||||||
#else
|
|
||||||
return KEY_Undefined;
|
|
||||||
#endif
|
#endif
|
||||||
|
return KEY_Undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
StdStrBuf C4KeyCodeEx::KeyCode2String(C4KeyCode wCode, bool fHumanReadable, bool fShort)
|
StdStrBuf C4KeyCodeEx::KeyCode2String(C4KeyCode wCode, bool fHumanReadable, bool fShort)
|
||||||
|
@ -465,7 +433,10 @@ StdStrBuf C4KeyCodeEx::KeyCode2String(C4KeyCode wCode, bool fHumanReadable, bool
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
#elif defined(USE_SDL_MAINLOOP)
|
#elif defined(USE_SDL_MAINLOOP)
|
||||||
return StdStrBuf(getKeyName(wCode).c_str());
|
StdStrBuf buf;
|
||||||
|
buf.Copy(SDL_GetScancodeName(static_cast<SDL_Scancode>(wCode)));
|
||||||
|
if (!buf.getLength()) buf.Format("\\x%x", wCode);
|
||||||
|
return buf;
|
||||||
#endif
|
#endif
|
||||||
return FormatString("$%x", static_cast<unsigned int>(wCode));
|
return FormatString("$%x", static_cast<unsigned int>(wCode));
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <C4Application.h>
|
#include <C4Application.h>
|
||||||
#include <C4Gui.h>
|
#include <C4Gui.h>
|
||||||
#include <C4GamePadCon.h>
|
#include <C4GamePadCon.h>
|
||||||
// SDL version
|
#include <C4Version.h>
|
||||||
|
|
||||||
static void sdlToC4MCBtn(const SDL_MouseButtonEvent &e, int32_t& button, DWORD& flags)
|
static void sdlToC4MCBtn(const SDL_MouseButtonEvent &e, int32_t& button, DWORD& flags)
|
||||||
{
|
{
|
||||||
|
@ -79,14 +79,14 @@ static void sdlToC4MCBtn(const SDL_MouseButtonEvent &e, int32_t& button, DWORD&
|
||||||
else
|
else
|
||||||
button = C4MC_Button_MiddleUp;
|
button = C4MC_Button_MiddleUp;
|
||||||
break;
|
break;
|
||||||
case SDL_BUTTON_WHEELUP:
|
/*case SDL_BUTTON_WHEELUP:
|
||||||
button = C4MC_Button_Wheel;
|
button = C4MC_Button_Wheel;
|
||||||
flags = (+32) << 16;
|
flags = (+32) << 16;
|
||||||
break;
|
break;
|
||||||
case SDL_BUTTON_WHEELDOWN:
|
case SDL_BUTTON_WHEELDOWN:
|
||||||
button = C4MC_Button_Wheel;
|
button = C4MC_Button_Wheel;
|
||||||
flags = (-32) << 16;
|
flags = (-32) << 16;
|
||||||
break;
|
break;*/
|
||||||
}
|
}
|
||||||
lastX = e.x;
|
lastX = e.x;
|
||||||
lastY = e.y;
|
lastY = e.y;
|
||||||
|
@ -122,8 +122,7 @@ bool C4AbstractApp::Init(int argc, char * argv[])
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_EnableUNICODE(1);
|
//SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||||
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
|
||||||
|
|
||||||
// Custom initialization
|
// Custom initialization
|
||||||
return DoInit (argc, argv);
|
return DoInit (argc, argv);
|
||||||
|
@ -163,24 +162,12 @@ void C4AbstractApp::HandleSDLEvent(SDL_Event& e)
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
Quit();
|
Quit();
|
||||||
break;
|
break;
|
||||||
|
case SDL_TEXTINPUT:
|
||||||
|
::pGUI->CharIn(e.text.text);
|
||||||
|
break;
|
||||||
case SDL_KEYDOWN:
|
case SDL_KEYDOWN:
|
||||||
{
|
{
|
||||||
#ifndef USE_CONSOLE
|
Game.DoKeyboardInput(e.key.keysym.scancode, KEYEV_Down,
|
||||||
if (e.key.keysym.sym == SDLK_f && (e.key.keysym.mod & (KMOD_LMETA | KMOD_RMETA)))
|
|
||||||
{
|
|
||||||
Config.Graphics.Windowed = !Config.Graphics.Windowed;
|
|
||||||
Application.SetVideoMode(Config.Graphics.ResX, Config.Graphics.ResY, Config.Graphics.RefreshRate, Config.Graphics.Monitor, !Config.Graphics.Windowed);
|
|
||||||
pDraw->InvalidateDeviceObjects();
|
|
||||||
pDraw->RestoreDeviceObjects();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
StdStrBuf c;
|
|
||||||
c.AppendCharacter(e.key.keysym.unicode);
|
|
||||||
::pGUI->CharIn(c.getData());
|
|
||||||
Game.DoKeyboardInput(e.key.keysym.sym, KEYEV_Down,
|
|
||||||
e.key.keysym.mod & (KMOD_LALT | KMOD_RALT),
|
e.key.keysym.mod & (KMOD_LALT | KMOD_RALT),
|
||||||
e.key.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL),
|
e.key.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL),
|
||||||
e.key.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT),
|
e.key.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT),
|
||||||
|
@ -188,7 +175,7 @@ void C4AbstractApp::HandleSDLEvent(SDL_Event& e)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
Game.DoKeyboardInput(e.key.keysym.sym, KEYEV_Up,
|
Game.DoKeyboardInput(e.key.keysym.scancode, KEYEV_Up,
|
||||||
e.key.keysym.mod & (KMOD_LALT | KMOD_RALT),
|
e.key.keysym.mod & (KMOD_LALT | KMOD_RALT),
|
||||||
e.key.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL),
|
e.key.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL),
|
||||||
e.key.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT), false, NULL);
|
e.key.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT), false, NULL);
|
||||||
|
@ -211,87 +198,120 @@ void C4AbstractApp::HandleSDLEvent(SDL_Event& e)
|
||||||
Application.pGamePadControl->FeedEvent(e);
|
Application.pGamePadControl->FeedEvent(e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
MacUtility::ensureWindowInFront();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int modeCount = 0;
|
||||||
|
|
||||||
bool C4AbstractApp::GetIndexedDisplayMode(int32_t iIndex, int32_t *piXRes, int32_t *piYRes, int32_t *piBitDepth, int32_t *piRefreshRate, uint32_t iMonitor)
|
bool C4AbstractApp::GetIndexedDisplayMode(int32_t iIndex, int32_t *piXRes, int32_t *piYRes, int32_t *piBitDepth, int32_t *piRefreshRate, uint32_t iMonitor)
|
||||||
{
|
{
|
||||||
// No support for multiple monitors.
|
if (!modeCount)
|
||||||
if (iMonitor != 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
static SDL_Rect** modes = 0;
|
|
||||||
static int modeCount = 0;
|
|
||||||
if (!modes)
|
|
||||||
{
|
{
|
||||||
modes = SDL_ListModes(NULL, SDL_OPENGL | SDL_FULLSCREEN);
|
modeCount = SDL_GetNumDisplayModes(iMonitor);
|
||||||
// -1 means "all modes allowed". Clonk is not prepared
|
|
||||||
// for this; should probably give some random resolutions
|
|
||||||
// then.
|
|
||||||
assert(reinterpret_cast<intptr_t>(modes) != -1);
|
|
||||||
if (!modes)
|
|
||||||
modeCount = 0;
|
|
||||||
else
|
|
||||||
// Count available modes.
|
|
||||||
for (SDL_Rect** iter = modes; *iter; ++iter)
|
|
||||||
++modeCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iIndex >= modeCount)
|
if (iIndex >= modeCount)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
*piXRes = modes[iIndex]->w;
|
SDL_DisplayMode mode;
|
||||||
*piYRes = modes[iIndex]->h;
|
SDL_GetDisplayMode(iMonitor, iIndex, &mode);
|
||||||
*piBitDepth = SDL_GetVideoInfo()->vfmt->BitsPerPixel;
|
*piXRes = mode.w;
|
||||||
|
*piYRes = mode.h;
|
||||||
|
*piBitDepth = SDL_BITSPERPIXEL(mode.format);
|
||||||
|
*piRefreshRate = mode.refresh_rate;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4AbstractApp::SetVideoMode(int iXRes, int iYRes, unsigned int RefreshRate, unsigned int iMonitor, bool fFullScreen)
|
bool C4AbstractApp::SetVideoMode(int iXRes, int iYRes, unsigned int RefreshRate, unsigned int iMonitor, bool fFullScreen)
|
||||||
{
|
{
|
||||||
//RECT r;
|
int res;
|
||||||
//pWindow->GetSize(&r);
|
if (!fFullScreen)
|
||||||
// FIXME: optimize redundant calls away. maybe make all platforms implicitely call SetVideoMode in C4Window::Init?
|
|
||||||
// SDL doesn't support multiple monitors.
|
|
||||||
if (!SDL_SetVideoMode(iXRes == -1 ? 0 : iXRes, iYRes == -1 ? 0 : iYRes, C4Draw::COLOR_DEPTH,
|
|
||||||
SDL_OPENGL | (fFullScreen ? SDL_FULLSCREEN : 0)))
|
|
||||||
{
|
{
|
||||||
sLastError.Copy(SDL_GetError());
|
res = SDL_SetWindowFullscreen(pWindow->window, 0);
|
||||||
return false;
|
if (res)
|
||||||
|
{
|
||||||
|
LogF("SDL_SetWindowFullscreen: %s", SDL_GetError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (iXRes != -1)
|
||||||
|
pWindow->SetSize(iXRes, iYRes);
|
||||||
|
C4Rect r;
|
||||||
|
pWindow->GetSize(&r);
|
||||||
|
OnResolutionChanged(r.Wdt, r.Hgt);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_DisplayMode mode;
|
||||||
const SDL_VideoInfo * info = SDL_GetVideoInfo();
|
if (iXRes < 0 || iYRes < 0)
|
||||||
OnResolutionChanged(info->current_w, info->current_h);
|
{
|
||||||
return true;
|
res = SDL_SetWindowFullscreen(pWindow->window, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
LogF("SDL_SetWindowFullscreen: %s", SDL_GetError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
res = SDL_GetDesktopDisplayMode(iMonitor, &mode);
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
LogF("SDL_GetDesktopDisplayMode: %s", SDL_GetError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
OnResolutionChanged(mode.w, mode.h);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < modeCount; ++i)
|
||||||
|
{
|
||||||
|
res = SDL_GetDisplayMode(iMonitor, i, &mode);
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
LogF("SDL_GetDisplayMode: %s", SDL_GetError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (mode.w == iXRes && mode.h == iYRes && mode.refresh_rate == RefreshRate && SDL_BITSPERPIXEL(mode.format) == C4Draw::COLOR_DEPTH)
|
||||||
|
{
|
||||||
|
res = SDL_SetWindowDisplayMode(pWindow->window, &mode);
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
LogF("SDL_SetWindowDisplayMode: %s", SDL_GetError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
res = SDL_SetWindowFullscreen(pWindow->window, SDL_WINDOW_FULLSCREEN);
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
LogF("SDL_SetWindowFullscreen: %s", SDL_GetError());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
OnResolutionChanged(mode.w, mode.h);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4AbstractApp::RestoreVideoMode()
|
void C4AbstractApp::RestoreVideoMode()
|
||||||
{
|
{
|
||||||
|
if (pWindow && pWindow->window)
|
||||||
|
SDL_SetWindowFullscreen(pWindow->window, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// For Max OS X, the implementation resides in StdMacApp.mm
|
|
||||||
#ifndef __APPLE__
|
|
||||||
|
|
||||||
// stubs
|
|
||||||
bool C4AbstractApp::Copy(const StdStrBuf & text, bool fClipboard)
|
bool C4AbstractApp::Copy(const StdStrBuf & text, bool fClipboard)
|
||||||
{
|
{
|
||||||
return false;
|
return SDL_SetClipboardText(text.getData()) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
StdStrBuf C4AbstractApp::Paste(bool fClipboard)
|
StdStrBuf C4AbstractApp::Paste(bool fClipboard)
|
||||||
{
|
{
|
||||||
return StdStrBuf("");
|
char * text = SDL_GetClipboardText();
|
||||||
|
StdStrBuf buf;
|
||||||
|
buf.Copy(text);
|
||||||
|
SDL_free(text);
|
||||||
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4AbstractApp::IsClipboardFull(bool fClipboard)
|
bool C4AbstractApp::IsClipboardFull(bool fClipboard)
|
||||||
{
|
{
|
||||||
return false;
|
return SDL_HasClipboardText();
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4AbstractApp::MessageDialog(const char * message)
|
void C4AbstractApp::MessageDialog(const char * message)
|
||||||
{
|
{
|
||||||
|
SDL_ShowSimpleMessageBox(0, C4ENGINECAPTION, message, pWindow ? pWindow->window : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -172,53 +172,111 @@
|
||||||
|
|
||||||
#elif defined(USE_SDL_MAINLOOP)
|
#elif defined(USE_SDL_MAINLOOP)
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#define K_SHIFT_L SDLK_LSHIFT
|
#define K_SHIFT_L SDL_SCANCODE_LSHIFT
|
||||||
#define K_SHIFT_R SDLK_RSHIFT
|
#define K_SHIFT_R SDL_SCANCODE_RSHIFT
|
||||||
#define K_CONTROL_L SDLK_LCTRL
|
#define K_CONTROL_L SDL_SCANCODE_LCTRL
|
||||||
#define K_CONTROL_R SDLK_RCTRL
|
#define K_CONTROL_R SDL_SCANCODE_RCTRL
|
||||||
#define K_ALT_L SDLK_LALT
|
#define K_ALT_L SDL_SCANCODE_LALT
|
||||||
#define K_ALT_R SDLK_RALT
|
#define K_ALT_R SDL_SCANCODE_RALT
|
||||||
#define K_F1 SDLK_F1
|
#define K_F1 SDL_SCANCODE_F1
|
||||||
#define K_F2 SDLK_F2
|
#define K_F2 SDL_SCANCODE_F2
|
||||||
#define K_F3 SDLK_F3
|
#define K_F3 SDL_SCANCODE_F3
|
||||||
#define K_F4 SDLK_F4
|
#define K_F4 SDL_SCANCODE_F4
|
||||||
#define K_F5 SDLK_F5
|
#define K_F5 SDL_SCANCODE_F5
|
||||||
#define K_F6 SDLK_F6
|
#define K_F6 SDL_SCANCODE_F6
|
||||||
#define K_F7 SDLK_F7
|
#define K_F7 SDL_SCANCODE_F7
|
||||||
#define K_F8 SDLK_F8
|
#define K_F8 SDL_SCANCODE_F8
|
||||||
#define K_F9 SDLK_F9
|
#define K_F9 SDL_SCANCODE_F9
|
||||||
#define K_F10 SDLK_F10
|
#define K_F10 SDL_SCANCODE_F10
|
||||||
#define K_F11 SDLK_F11
|
#define K_F11 SDL_SCANCODE_F11
|
||||||
#define K_F12 SDLK_F12
|
#define K_F12 SDL_SCANCODE_F12
|
||||||
#define K_ADD SDLK_KP_PLUS
|
#define K_ADD SDL_SCANCODE_KP_PLUS
|
||||||
#define K_SUBTRACT SDLK_KP_MINUS
|
#define K_SUBTRACT SDL_SCANCODE_KP_MINUS
|
||||||
#define K_MULTIPLY SDLK_KP_MULTIPLY
|
#define K_MULTIPLY SDL_SCANCODE_KP_MULTIPLY
|
||||||
#define K_ESCAPE SDLK_ESCAPE
|
#define K_ESCAPE SDL_SCANCODE_ESCAPE
|
||||||
#define K_PAUSE SDLK_PAUSE
|
#define K_PAUSE SDL_SCANCODE_PAUSE
|
||||||
#define K_TAB SDLK_TAB
|
#define K_TAB SDL_SCANCODE_TAB
|
||||||
#define K_RETURN SDLK_RETURN
|
#define K_RETURN SDL_SCANCODE_RETURN
|
||||||
#define K_DELETE SDLK_DELETE
|
#define K_DELETE SDL_SCANCODE_DELETE
|
||||||
#define K_INSERT SDLK_INSERT
|
#define K_INSERT SDL_SCANCODE_INSERT
|
||||||
#define K_BACK SDLK_BACKSPACE
|
#define K_BACK SDL_SCANCODE_BACKSPACE
|
||||||
#define K_SPACE SDLK_SPACE
|
#define K_SPACE SDL_SCANCODE_SPACE
|
||||||
#define K_UP SDLK_UP
|
#define K_UP SDL_SCANCODE_UP
|
||||||
#define K_DOWN SDLK_DOWN
|
#define K_DOWN SDL_SCANCODE_DOWN
|
||||||
#define K_LEFT SDLK_LEFT
|
#define K_LEFT SDL_SCANCODE_LEFT
|
||||||
#define K_RIGHT SDLK_RIGHT
|
#define K_RIGHT SDL_SCANCODE_RIGHT
|
||||||
#define K_HOME SDLK_HOME
|
#define K_HOME SDL_SCANCODE_HOME
|
||||||
#define K_END SDLK_END
|
#define K_END SDL_SCANCODE_END
|
||||||
#define K_SCROLL SDLK_SCROLLOCK
|
#define K_SCROLL SDL_SCANCODE_SCROLLLOCK
|
||||||
#define K_MENU SDLK_MENU
|
#define K_MENU SDL_SCANCODE_MENU
|
||||||
#define K_PAGEUP SDLK_PAGEUP
|
#define K_PAGEUP SDL_SCANCODE_PAGEUP
|
||||||
#define K_PAGEDOWN SDLK_PAGEDOWN
|
#define K_PAGEDOWN SDL_SCANCODE_PAGEDOWN
|
||||||
#define K_M SDLK_m
|
#define K_1 SDL_SCANCODE_1
|
||||||
#define K_T SDLK_t
|
#define K_2 SDL_SCANCODE_2
|
||||||
#define K_W SDLK_w
|
#define K_3 SDL_SCANCODE_3
|
||||||
#define K_I SDLK_i
|
#define K_4 SDL_SCANCODE_4
|
||||||
#define K_C SDLK_c
|
#define K_5 SDL_SCANCODE_5
|
||||||
#define K_V SDLK_v
|
#define K_6 SDL_SCANCODE_6
|
||||||
#define K_X SDLK_x
|
#define K_7 SDL_SCANCODE_7
|
||||||
#define K_A SDLK_a
|
#define K_8 SDL_SCANCODE_8
|
||||||
|
#define K_9 SDL_SCANCODE_9
|
||||||
|
#define K_0 SDL_SCANCODE_A
|
||||||
|
#define K_A SDL_SCANCODE_A
|
||||||
|
#define K_B SDL_SCANCODE_B
|
||||||
|
#define K_C SDL_SCANCODE_C
|
||||||
|
#define K_D SDL_SCANCODE_D
|
||||||
|
#define K_E SDL_SCANCODE_E
|
||||||
|
#define K_F SDL_SCANCODE_F
|
||||||
|
#define K_G SDL_SCANCODE_G
|
||||||
|
#define K_H SDL_SCANCODE_H
|
||||||
|
#define K_I SDL_SCANCODE_I
|
||||||
|
#define K_J SDL_SCANCODE_J
|
||||||
|
#define K_K SDL_SCANCODE_K
|
||||||
|
#define K_L SDL_SCANCODE_L
|
||||||
|
#define K_M SDL_SCANCODE_M
|
||||||
|
#define K_N SDL_SCANCODE_N
|
||||||
|
#define K_O SDL_SCANCODE_O
|
||||||
|
#define K_P SDL_SCANCODE_P
|
||||||
|
#define K_Q SDL_SCANCODE_Q
|
||||||
|
#define K_R SDL_SCANCODE_R
|
||||||
|
#define K_S SDL_SCANCODE_S
|
||||||
|
#define K_T SDL_SCANCODE_T
|
||||||
|
#define K_U SDL_SCANCODE_U
|
||||||
|
#define K_V SDL_SCANCODE_V
|
||||||
|
#define K_W SDL_SCANCODE_W
|
||||||
|
#define K_X SDL_SCANCODE_X
|
||||||
|
#define K_Y SDL_SCANCODE_Y
|
||||||
|
#define K_Z SDL_SCANCODE_Z
|
||||||
|
#define K_MINUS SDL_SCANCODE_MINUS
|
||||||
|
#define K_EQUAL SDL_SCANCODE_EQUALS
|
||||||
|
#define K_LEFT_BRACKET SDL_SCANCODE_LEFTBRACKET
|
||||||
|
#define K_RIGHT_BRACKET SDL_SCANCODE_RIGHTBRACKET
|
||||||
|
#define K_SEMICOLON SDL_SCANCODE_SEMICOLON
|
||||||
|
#define K_APOSTROPHE SDL_SCANCODE_APOSTROPHE
|
||||||
|
#define K_GRAVE_ACCENT SDL_SCANCODE_GRAVE
|
||||||
|
#define K_BACKSLASH SDL_SCANCODE_BACKSLASH
|
||||||
|
#define K_COMMA SDL_SCANCODE_COMMA
|
||||||
|
#define K_PERIOD SDL_SCANCODE_PERIOD
|
||||||
|
#define K_SLASH SDL_SCANCODE_SLASH
|
||||||
|
#define K_CAPS SDL_SCANCODE_CAPSLOCK
|
||||||
|
#define K_NUM SDL_SCANCODE_NUMLOCKCLEAR
|
||||||
|
#define K_NUM7 SDL_SCANCODE_KP_7
|
||||||
|
#define K_NUM8 SDL_SCANCODE_KP_8
|
||||||
|
#define K_NUM9 SDL_SCANCODE_KP_9
|
||||||
|
#define K_NUM4 SDL_SCANCODE_KP_4
|
||||||
|
#define K_NUM5 SDL_SCANCODE_KP_5
|
||||||
|
#define K_NUM6 SDL_SCANCODE_KP_6
|
||||||
|
#define K_NUM1 SDL_SCANCODE_KP_1
|
||||||
|
#define K_NUM2 SDL_SCANCODE_KP_2
|
||||||
|
#define K_NUM3 SDL_SCANCODE_KP_3
|
||||||
|
#define K_NUM0 SDL_SCANCODE_KP_0
|
||||||
|
#define K_DECIMAL SDL_SCANCODE_KP_PERIOD
|
||||||
|
#define K_86 SDL_SCANCODE_NONUSBACKSLASH
|
||||||
|
#define K_NUM_RETURN SDL_SCANCODE_KP_ENTER
|
||||||
|
#define K_DIVIDE SDL_SCANCODE_KP_DIVIDE
|
||||||
|
#define K_WIN_L SDL_SCANCODE_LGUI
|
||||||
|
#define K_WIN_R SDL_SCANCODE_RGUI
|
||||||
|
#define K_PRINT SDL_SCANCODE_PRINTSCREEN
|
||||||
#elif defined(USE_COCOA)
|
#elif defined(USE_COCOA)
|
||||||
#import "ObjectiveCAssociated.h"
|
#import "ObjectiveCAssociated.h"
|
||||||
// FIXME
|
// FIXME
|
||||||
|
@ -337,6 +395,8 @@ public:
|
||||||
// Set by Init to the widget which is used as a
|
// Set by Init to the widget which is used as a
|
||||||
// render target, which can be the whole window.
|
// render target, which can be the whole window.
|
||||||
/*GtkWidget*/void * render_widget;
|
/*GtkWidget*/void * render_widget;
|
||||||
|
#elif defined(USE_SDL_MAINLOOP)
|
||||||
|
SDL_Window * window;
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_WGL
|
#ifdef USE_WGL
|
||||||
HWND renderwnd;
|
HWND renderwnd;
|
||||||
|
|
|
@ -42,19 +42,29 @@ C4Window::~C4Window ()
|
||||||
|
|
||||||
C4Window * C4Window::Init(WindowKind windowKind, C4AbstractApp * pApp, const char * Title, const C4Rect * size)
|
C4Window * C4Window::Init(WindowKind windowKind, C4AbstractApp * pApp, const char * Title, const C4Rect * size)
|
||||||
{
|
{
|
||||||
if (windowKind != W_Fullscreen)
|
/* SDL_GL_MULTISAMPLEBUFFERS,
|
||||||
return NULL;
|
SDL_GL_MULTISAMPLESAMPLES,*/
|
||||||
Active = true;
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||||
// SDL doesn't support multiple monitors.
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||||
if (!SDL_SetVideoMode(Application.GetConfigWidth() == -1 ? 0 : Application.GetConfigWidth(),
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||||
Application.GetConfigHeight() == -1 ? 0 : Application.GetConfigHeight(),
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 8);
|
||||||
C4Draw::COLOR_DEPTH, SDL_OPENGL | (Config.Graphics.Windowed ? 0 : SDL_FULLSCREEN)))
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, /*REQUESTED_GL_CTX_MAJOR*/ 3);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, /*REQUESTED_GL_CTX_MINOR*/ 2);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, (Config.Graphics.DebugOpenGL ? SDL_GL_CONTEXT_DEBUG_FLAG : 0));
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||||
|
uint32_t flags = SDL_WINDOW_OPENGL;
|
||||||
|
if (windowKind == W_Fullscreen && size->Wdt == -1)
|
||||||
|
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||||
|
else if (windowKind == W_Fullscreen)
|
||||||
|
flags |= SDL_WINDOW_FULLSCREEN;
|
||||||
|
window = SDL_CreateWindow(Title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, size->Wdt, size->Hgt, flags);
|
||||||
|
if (!window)
|
||||||
{
|
{
|
||||||
Log(SDL_GetError());
|
Log(SDL_GetError());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Active = true;
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
SetTitle(Title);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +75,11 @@ bool C4Window::ReInit(C4AbstractApp* pApp)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4Window::Clear() {}
|
void C4Window::Clear()
|
||||||
|
{
|
||||||
|
SDL_DestroyWindow(window);
|
||||||
|
window = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void C4Window::EnumerateMultiSamples(std::vector<int>& samples) const
|
void C4Window::EnumerateMultiSamples(std::vector<int>& samples) const
|
||||||
{
|
{
|
||||||
|
@ -82,18 +96,18 @@ bool C4Window::RestorePosition(const char *, const char *, bool) { return true;
|
||||||
bool C4Window::GetSize(C4Rect * pRect)
|
bool C4Window::GetSize(C4Rect * pRect)
|
||||||
{
|
{
|
||||||
pRect->x = pRect->y = 0;
|
pRect->x = pRect->y = 0;
|
||||||
const SDL_VideoInfo * info = SDL_GetVideoInfo();
|
SDL_GL_GetDrawableSize(window, &pRect->Wdt, &pRect->Hgt);
|
||||||
pRect->Wdt = info->current_w, pRect->Hgt = info->current_h;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4Window::SetSize(unsigned int X, unsigned int Y)
|
void C4Window::SetSize(unsigned int X, unsigned int Y)
|
||||||
{
|
{
|
||||||
|
SDL_SetWindowSize(window, X, Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4Window::SetTitle(const char * Title)
|
void C4Window::SetTitle(const char * Title)
|
||||||
{
|
{
|
||||||
SDL_WM_SetCaption(Title, 0);
|
SDL_SetWindowTitle(window, Title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4Window::RequestUpdate()
|
void C4Window::RequestUpdate()
|
||||||
|
@ -102,11 +116,6 @@ void C4Window::RequestUpdate()
|
||||||
PerformUpdate();
|
PerformUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// For Max OS X, the implementation resides in StdMacApp.mm
|
|
||||||
#ifndef __APPLE__
|
|
||||||
|
|
||||||
void C4Window::FlashWindow()
|
void C4Window::FlashWindow()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue