summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp6
-rw-r--r--src/graphics.cpp4
-rw-r--r--src/joystick.cpp5
-rw-r--r--src/keyboardconfig.h4
-rw-r--r--src/keyboarddata.h8
-rw-r--r--src/mobileopenglgraphics.cpp4
-rw-r--r--src/normalopenglgraphics.cpp4
-rw-r--r--src/safeopenglgraphics.cpp4
-rw-r--r--src/sdlshared.h10
9 files changed, 39 insertions, 10 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 29d81ad64..7c04e807e 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -2906,7 +2906,7 @@ void Client::applyGamma()
{
const float val = config.getFloatValue("gamma");
#ifdef USE_SDL2
- // +++ need use SDL_SetWindowBrightness
+ SDL_SetWindowBrightness(mWindow, val);
#else
SDL_SetGamma(val, val, val);
#endif
@@ -2915,9 +2915,11 @@ void Client::applyGamma()
void Client::applyVSync()
{
-#ifndef USE_SDL2
const int val = config.getIntValue("vsync");
if (val > 0 && val < 2)
+#ifdef USE_SDL2
+ SDL_GL_SetSwapInterval(val);
+#else
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, val);
#endif
}
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 28d5e09fb..ac219bc9a 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -266,6 +266,8 @@ bool Graphics::videoInfo()
logger->log("SDL video info");
#ifdef USE_SDL2
logger->log("Using video driver: %s", SDL_GetCurrentVideoDriver());
+
+ // +++ probably SDL_GetRendererInfo can be used for info
#else
char videoDriverName[65];
if (SDL_VideoDriverName(videoDriverName, 64))
@@ -274,7 +276,6 @@ bool Graphics::videoInfo()
logger->log1("Using video driver: unknown");
mDoubleBuffer = ((mWindow->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF);
logger->log("Double buffer mode: %s", mDoubleBuffer ? "yes" : "no");
-#endif
imageHelper->dumpSurfaceFormat(mWindow);
@@ -300,6 +301,7 @@ bool Graphics::videoInfo()
((vi->blit_sw_A) ? "yes" : "no"));
logger->log("Accelerated color fills: %s",
((vi->blit_fill) ? "yes" : "no"));
+#endif
return true;
}
diff --git a/src/joystick.cpp b/src/joystick.cpp
index 324de047d..244996937 100644
--- a/src/joystick.cpp
+++ b/src/joystick.cpp
@@ -26,6 +26,7 @@
#include "configuration.h"
#include "inputmanager.h"
#include "logger.h"
+#include "sdlshared.h"
#include "debug.h"
@@ -65,7 +66,7 @@ void Joystick::init()
joystickCount = SDL_NumJoysticks();
logger->log("%i joysticks/gamepads found", joystickCount);
for (int i = 0; i < joystickCount; i++)
- logger->log("- %s", SDL_JoystickName(i));
+ logger->log("- %s", SDL_JoystickNameForIndex(i));
mEnabled = config.getBoolValue("joystickEnabled");
@@ -268,7 +269,7 @@ void Joystick::getNames(std::vector <std::string> &names)
{
names.clear();
for (int i = 0; i < joystickCount; i++)
- names.push_back(SDL_JoystickName(i));
+ names.push_back(SDL_JoystickNameForIndex(i));
}
void Joystick::update()
diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h
index 0dbf19453..224391cdc 100644
--- a/src/keyboardconfig.h
+++ b/src/keyboardconfig.h
@@ -104,9 +104,9 @@ class KeyboardConfig final
void resetRepeat(const int key);
private:
- bool mEnabled; /**< Flag to respond to key input */
+ bool mEnabled; /**< Flag to respond to key input */
- uint8_t *mActiveKeys; /**< Stores a list of all the keys */
+ const uint8_t *mActiveKeys; /**< Stores a list of all the keys */
uint8_t *mActiveKeys2; /**< Stores a list of all the keys */
diff --git a/src/keyboarddata.h b/src/keyboarddata.h
index f7a358a8f..79da45049 100644
--- a/src/keyboarddata.h
+++ b/src/keyboarddata.h
@@ -1616,14 +1616,22 @@ static const KeyData keyData[Input::KEY_TOTAL] = {
Input::KEY_NO_VALUE, 50,
COND_DEFAULT},
{"keyIgnoreInput1",
+#ifdef USE_SDL2
+ INPUT_UNKNOWN, Input::KEY_NO_VALUE,
+#else
INPUT_KEYBOARD, SDLK_LSUPER,
+#endif
INPUT_UNKNOWN, Input::KEY_NO_VALUE,
Input::GRP_DEFAULT,
&ActionManager::ignoreInput,
Input::KEY_NO_VALUE, 500,
COND_DEFAULT},
{"keyIgnoreInput2",
+#ifdef USE_SDL2
+ INPUT_UNKNOWN, Input::KEY_NO_VALUE,
+#else
INPUT_KEYBOARD, SDLK_RSUPER,
+#endif
INPUT_UNKNOWN, Input::KEY_NO_VALUE,
Input::GRP_DEFAULT,
&ActionManager::ignoreInput,
diff --git a/src/mobileopenglgraphics.cpp b/src/mobileopenglgraphics.cpp
index 96fcc2304..2aec87498 100644
--- a/src/mobileopenglgraphics.cpp
+++ b/src/mobileopenglgraphics.cpp
@@ -826,7 +826,11 @@ void MobileOpenGLGraphics::updateScreen()
mLastDrawCalls = mDrawCalls;
mDrawCalls = 0;
#endif
+#ifdef USE_SDL2
+ SDL_GL_SwapWindow(mWindow);
+#else
SDL_GL_SwapBuffers();
+#endif
// may be need clear?
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
BLOCK_END("Graphics::updateScreen")
diff --git a/src/normalopenglgraphics.cpp b/src/normalopenglgraphics.cpp
index bb4a03860..ac933a6ac 100644
--- a/src/normalopenglgraphics.cpp
+++ b/src/normalopenglgraphics.cpp
@@ -1034,7 +1034,11 @@ void NormalOpenGLGraphics::updateScreen()
mLastBinds = mBinds;
mBinds = 0;
#endif
+#ifdef USE_SDL2
+ SDL_GL_SwapWindow(mWindow);
+#else
SDL_GL_SwapBuffers();
+#endif
// may be need clear?
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
BLOCK_END("Graphics::updateScreen")
diff --git a/src/safeopenglgraphics.cpp b/src/safeopenglgraphics.cpp
index 4411c5130..f04ffb3bc 100644
--- a/src/safeopenglgraphics.cpp
+++ b/src/safeopenglgraphics.cpp
@@ -377,7 +377,11 @@ void SafeOpenGLGraphics::updateScreen()
BLOCK_START("Graphics::updateScreen")
glFlush();
glFinish();
+#ifdef USE_SDL2
+ SDL_GL_SwapWindow(mWindow);
+#else
SDL_GL_SwapBuffers();
+#endif
BLOCK_END("Graphics::updateScreen")
}
diff --git a/src/sdlshared.h b/src/sdlshared.h
index 840283688..d06040220 100644
--- a/src/sdlshared.h
+++ b/src/sdlshared.h
@@ -50,11 +50,15 @@
#define SDLK_PRINT SDLK_PRINTSCREEN
#define SDLK_NUMLOCK SDLK_NUMLOCKCLEAR
#define SDLK_SCROLLOCK SDLK_SCROLLLOCK
+#define SDLK_LAST SDL_NUM_SCANCODES
-#else
+#define SDL_DEFAULT_REPEAT_DELAY 500
+
+#else // USE_SDL2
#define SDL_Window SDL_Surface
+#define SDL_JoystickNameForIndex SDL_JoystickName
-#endif
+#endif // USE_SDL2
-#endif
+#endif // SDLSHARED_H