// This file is part of the "Irrlicht Engine".\r
// For conditions of distribution and use, see copyright notice in irrlicht.h\r
\r
-#include "IrrCompileConfig.h"\r
\r
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_\r
\r
#include "CIrrDeviceSDL.h"\r
#include "IEventReceiver.h"\r
-#include "irrList.h"\r
+#include "IGUIElement.h"\r
+#include "IGUIEnvironment.h"\r
#include "os.h"\r
#include "CTimer.h"\r
#include "irrString.h"\r
#include <emscripten.h>\r
#endif\r
\r
+#ifdef _IRR_COMPILE_WITH_OPENGL_\r
+#include "CSDLManager.h"\r
+#endif\r
+\r
static int SDLDeviceInstances = 0;\r
\r
namespace irr\r
{\r
namespace video\r
{\r
- #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_\r
- IVideoDriver* createDirectX9Driver(const irr::SIrrlichtCreationParameters& params,\r
- io::IFileSystem* io, HWND window);\r
+ #ifdef _IRR_COMPILE_WITH_OPENGL_\r
+ IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);\r
#endif\r
\r
- #ifdef _IRR_COMPILE_WITH_OPENGL_\r
- IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,\r
- io::IFileSystem* io, CIrrDeviceSDL* device);\r
+ #ifdef _IRR_COMPILE_WITH_OGLES2_\r
+ IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);\r
#endif\r
\r
- #if defined(_IRR_COMPILE_WITH_OGLES2_) && defined(_IRR_EMSCRIPTEN_PLATFORM_)\r
- IVideoDriver* createOGLES2Driver(const irr::SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);\r
+ #ifdef _IRR_COMPILE_WITH_WEBGL1_\r
+ IVideoDriver* createWebGL1Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);\r
#endif\r
\r
- #if defined(_IRR_COMPILE_WITH_WEBGL1_) && defined(_IRR_EMSCRIPTEN_PLATFORM_)\r
- IVideoDriver* createWebGL1Driver(const irr::SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);\r
+ #ifdef ENABLE_OPENGL3\r
+ IVideoDriver* createOpenGL3Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);\r
#endif\r
} // end namespace video\r
\r
}\r
#endif\r
\r
-bool CIrrDeviceSDL::isNoUnicodeKey(EKEY_CODE key) const\r
+\r
+bool CIrrDeviceSDL::keyIsKnownSpecial(EKEY_CODE key)\r
{\r
switch ( key )\r
{\r
- // keys which should not be mapped to a Unicode char\r
- case KEY_UNKNOWN:\r
- case KEY_SHIFT:\r
- case KEY_CONTROL:\r
- case KEY_MENU:\r
+ // keys which are known to have safe special character interpretation\r
+ // could need changes over time (removals and additions!)\r
+ case KEY_RETURN:\r
case KEY_PAUSE:\r
- case KEY_CAPITAL:\r
case KEY_ESCAPE:\r
case KEY_PRIOR:\r
case KEY_NEXT:\r
- case KEY_END:\r
case KEY_HOME:\r
+ case KEY_END:\r
case KEY_LEFT:\r
case KEY_UP:\r
case KEY_RIGHT:\r
case KEY_DOWN:\r
+ case KEY_TAB:\r
case KEY_PRINT:\r
case KEY_SNAPSHOT:\r
case KEY_INSERT:\r
+ case KEY_BACK:\r
case KEY_DELETE:\r
case KEY_HELP:\r
- case KEY_LWIN:\r
- case KEY_RWIN:\r
case KEY_APPS:\r
case KEY_SLEEP:\r
case KEY_F1:\r
case KEY_F24:\r
case KEY_NUMLOCK:\r
case KEY_SCROLL:\r
- case KEY_LSHIFT:\r
- case KEY_RSHIFT:\r
case KEY_LCONTROL:\r
case KEY_RCONTROL:\r
- case KEY_LMENU:\r
- case KEY_RMENU:\r
- return true;\r
+ return true;\r
\r
- default:\r
- return false;\r
+ default:\r
+ return false;\r
}\r
}\r
\r
+int CIrrDeviceSDL::findCharToPassToIrrlicht(int assumedChar, EKEY_CODE key) {\r
+ // SDL in-place ORs values with no character representation with 1<<30\r
+ // https://wiki.libsdl.org/SDL2/SDLKeycodeLookup\r
+ if (assumedChar & (1<<30))\r
+ return 0;\r
+\r
+ switch (key) {\r
+ case KEY_PRIOR:\r
+ case KEY_NEXT:\r
+ case KEY_HOME:\r
+ case KEY_END:\r
+ case KEY_LEFT:\r
+ case KEY_UP:\r
+ case KEY_RIGHT:\r
+ case KEY_DOWN:\r
+ case KEY_NUMLOCK:\r
+ return 0;\r
+ default:\r
+ return assumedChar;\r
+ }\r
+}\r
+\r
+void CIrrDeviceSDL::resetReceiveTextInputEvents() {\r
+ gui::IGUIElement *elem = GUIEnvironment->getFocus();\r
+ if (elem && elem->acceptsIME())\r
+ SDL_StartTextInput();\r
+ else\r
+ SDL_StopTextInput();\r
+}\r
+\r
//! constructor\r
CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)\r
: CIrrDeviceStub(param),\r
Window((SDL_Window*)param.WindowId), SDL_Flags(0),\r
MouseX(0), MouseY(0), MouseXRel(0), MouseYRel(0), MouseButtonStates(0),\r
Width(param.WindowSize.Width), Height(param.WindowSize.Height),\r
- Resizable(param.WindowResizable == 1 ? true : false), WindowMinimized(false)\r
+ Resizable(param.WindowResizable == 1 ? true : false)\r
{\r
#ifdef _DEBUG\r
setDebugName("CIrrDeviceSDL");\r
\r
if ( ++SDLDeviceInstances == 1 )\r
{\r
- // Initialize SDL... Timer for sleep, video for the obvious, and\r
- // noparachute prevents SDL from catching fatal errors.\r
- if (SDL_Init( SDL_INIT_TIMER|SDL_INIT_VIDEO|\r
+ u32 flags = SDL_INIT_TIMER | SDL_INIT_EVENTS;\r
+ if (CreationParams.DriverType != video::EDT_NULL)\r
+ flags |= SDL_INIT_VIDEO;\r
#if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)\r
- SDL_INIT_JOYSTICK|\r
+ flags |= SDL_INIT_JOYSTICK;\r
#endif\r
- SDL_INIT_NOPARACHUTE ) < 0)\r
+ if (SDL_Init(flags) < 0)\r
{\r
os::Printer::log( "Unable to initialize SDL!", SDL_GetError());\r
Close = true;\r
// create keymap\r
createKeyMap();\r
\r
- if ( CreationParams.Fullscreen )\r
+ if (CreationParams.Fullscreen) {\r
SDL_Flags |= SDL_WINDOW_FULLSCREEN;\r
- else if ( Resizable )\r
- SDL_Flags |= SDL_WINDOW_RESIZABLE;\r
+ } else {\r
+ if (Resizable)\r
+ SDL_Flags |= SDL_WINDOW_RESIZABLE;\r
+ if (CreationParams.WindowMaximized)\r
+ SDL_Flags |= SDL_WINDOW_MAXIMIZED;\r
+ }\r
if (CreationParams.DriverType == video::EDT_OPENGL)\r
{\r
SDL_Flags |= SDL_WINDOW_OPENGL;\r
createWindow();\r
}\r
\r
+\r
SDL_VERSION(&Info.version);\r
\r
#ifndef _IRR_EMSCRIPTEN_PLATFORM_\r
{\r
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);\r
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);\r
- } \r
+ }\r
\r
SDL_CreateWindowAndRenderer(0, 0, SDL_Flags, &Window, &Renderer); // 0,0 will use the canvas size\r
\r
return false;\r
\r
if (CreationParams.DriverType == video::EDT_OPENGL) {\r
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);\r
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);\r
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);\r
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG | SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG);\r
if (CreationParams.Bits == 16) {\r
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 4);\r
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 4);\r
{\r
switch(CreationParams.DriverType)\r
{\r
- case video::DEPRECATED_EDT_DIRECT3D8_NO_LONGER_EXISTS:\r
- os::Printer::log("DIRECT3D8 Driver is no longer supported in Irrlicht. Try another one.", ELL_ERROR);\r
- break;\r
-\r
- case video::EDT_DIRECT3D9:\r
- #ifdef _IRR_COMPILE_WITH_DIRECT3D_9_\r
- os::Printer::log("SDL device does not support DIRECT3D9 driver. Try another one.", ELL_ERROR);\r
- #else\r
- os::Printer::log("DIRECT3D9 Driver was not compiled into this dll. Try another one.", ELL_ERROR);\r
- #endif // _IRR_COMPILE_WITH_DIRECT3D_9_\r
-\r
- break;\r
-\r
- case video::EDT_SOFTWARE:\r
- #ifdef _IRR_COMPILE_WITH_SOFTWARE_\r
- VideoDriver = video::createSoftwareDriver(CreationParams.WindowSize, CreationParams.Fullscreen, FileSystem, this);\r
- #else\r
- os::Printer::log("No Software driver support compiled in.", ELL_ERROR);\r
- #endif\r
- break;\r
-\r
- case video::EDT_BURNINGSVIDEO:\r
- #ifdef _IRR_COMPILE_WITH_BURNINGSVIDEO_\r
- VideoDriver = video::createBurningVideoDriver(CreationParams, FileSystem, this);\r
- #else\r
- os::Printer::log("Burning's video driver was not compiled in.", ELL_ERROR);\r
- #endif\r
- break;\r
-\r
case video::EDT_OPENGL:\r
#ifdef _IRR_COMPILE_WITH_OPENGL_\r
- VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, this);\r
+ ContextManager = new video::CSDLManager(this);\r
+ VideoDriver = video::createOpenGL3Driver(CreationParams, FileSystem, ContextManager);\r
#else\r
os::Printer::log("No OpenGL support compiled in.", ELL_ERROR);\r
#endif\r
\r
switch ( SDL_event.type )\r
{\r
- case SDL_MOUSEMOTION:\r
+ case SDL_MOUSEMOTION: {\r
+ SDL_Keymod keymod = SDL_GetModState();\r
+\r
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;\r
irrevent.MouseInput.Event = irr::EMIE_MOUSE_MOVED;\r
MouseX = irrevent.MouseInput.X = SDL_event.motion.x;\r
MouseXRel = SDL_event.motion.xrel;\r
MouseYRel = SDL_event.motion.yrel;\r
irrevent.MouseInput.ButtonStates = MouseButtonStates;\r
+ irrevent.MouseInput.Shift = (keymod & KMOD_SHIFT) != 0;\r
+ irrevent.MouseInput.Control = (keymod & KMOD_CTRL) != 0;\r
\r
postEventFromUser(irrevent);\r
break;\r
- case SDL_MOUSEWHEEL:\r
+ }\r
+ case SDL_MOUSEWHEEL: {\r
+ SDL_Keymod keymod = SDL_GetModState();\r
+\r
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;\r
irrevent.MouseInput.Event = irr::EMIE_MOUSE_WHEEL;\r
irrevent.MouseInput.Wheel = static_cast<float>(SDL_event.wheel.y);\r
+ irrevent.MouseInput.Shift = (keymod & KMOD_SHIFT) != 0;\r
+ irrevent.MouseInput.Control = (keymod & KMOD_CTRL) != 0;\r
+ irrevent.MouseInput.X = MouseX;\r
+ irrevent.MouseInput.Y = MouseY;\r
+\r
postEventFromUser(irrevent);\r
break;\r
+ }\r
case SDL_MOUSEBUTTONDOWN:\r
- case SDL_MOUSEBUTTONUP:\r
+ case SDL_MOUSEBUTTONUP: {\r
+ SDL_Keymod keymod = SDL_GetModState();\r
+\r
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;\r
irrevent.MouseInput.X = SDL_event.button.x;\r
irrevent.MouseInput.Y = SDL_event.button.y;\r
+ irrevent.MouseInput.Shift = (keymod & KMOD_SHIFT) != 0;\r
+ irrevent.MouseInput.Control = (keymod & KMOD_CTRL) != 0;\r
\r
irrevent.MouseInput.Event = irr::EMIE_MOUSE_MOVED;\r
\r
}\r
}\r
break;\r
+ }\r
+\r
+ case SDL_TEXTINPUT:\r
+ {\r
+ irrevent.EventType = irr::EET_STRING_INPUT_EVENT;\r
+ irrevent.StringInput.Str = new core::stringw();\r
+ irr::core::multibyteToWString(*irrevent.StringInput.Str, SDL_event.text.text);\r
+ postEventFromUser(irrevent);\r
+ delete irrevent.StringInput.Str;\r
+ irrevent.StringInput.Str = NULL;\r
+ }\r
+ break;\r
\r
case SDL_KEYDOWN:\r
case SDL_KEYUP:\r
else\r
key = (EKEY_CODE)KeyMap[idx].Win32Key;\r
\r
+ // Make sure to only input special characters if something is in focus, as SDL_TEXTINPUT handles normal unicode already\r
+ if (SDL_IsTextInputActive() && !keyIsKnownSpecial(key) && (SDL_event.key.keysym.mod & KMOD_CTRL) == 0)\r
+ break;\r
+\r
#ifdef _IRR_WINDOWS_API_\r
// handle alt+f4 in Windows, because SDL seems not to\r
if ( (SDL_event.key.keysym.mod & KMOD_LALT) && key == KEY_F4)\r
}\r
#endif\r
irrevent.EventType = irr::EET_KEY_INPUT_EVENT;\r
-\r
- if (isNoUnicodeKey(key))\r
- irrevent.KeyInput.Char = 0;\r
- else\r
- irrevent.KeyInput.Char = SDL_event.key.keysym.sym;\r
-\r
irrevent.KeyInput.Key = key;\r
irrevent.KeyInput.PressedDown = (SDL_event.type == SDL_KEYDOWN);\r
irrevent.KeyInput.Shift = (SDL_event.key.keysym.mod & KMOD_SHIFT) != 0;\r
irrevent.KeyInput.Control = (SDL_event.key.keysym.mod & KMOD_CTRL ) != 0;\r
-\r
- // SDL2 no longer provides unicode character in the key event so we ensure the character is in the correct case\r
- // TODO: Unicode input doesn't work like this, should probably use SDL_TextInputEvent\r
- bool convertCharToUppercase =\r
- irrevent.KeyInput.Shift != !!(SDL_event.key.keysym.mod & KMOD_CAPS);\r
-\r
- if (convertCharToUppercase)\r
- irrevent.KeyInput.Char = irr::core::locale_upper(irrevent.KeyInput.Char);\r
-\r
+ irrevent.KeyInput.Char = findCharToPassToIrrlicht(mp.SDLKey, key);\r
postEventFromUser(irrevent);\r
}\r
break;\r
case SDL_WINDOWEVENT:\r
switch (SDL_event.window.event)\r
{\r
- case SDL_WINDOWEVENT_MAXIMIZED:\r
- WindowMinimized = true;\r
- break;\r
- case SDL_WINDOWEVENT_RESTORED:\r
- WindowMinimized = false;\r
- break;\r
case SDL_WINDOWEVENT_RESIZED:\r
if ((SDL_event.window.data1 != (int)Width) || (SDL_event.window.data2 != (int)Height))\r
{\r
default:\r
break;\r
} // end switch\r
-\r
+ resetReceiveTextInputEvents();\r
} // end while\r
\r
#if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)\r
for(joystick = 0; joystick < (int)joystickInfo.size(); ++joystick)\r
{\r
char logString[256];\r
- (void)sprintf(logString, "Found joystick %d, %d axes, %d buttons '%s'",\r
- joystick, joystickInfo[joystick].Axes,\r
- joystickInfo[joystick].Buttons, joystickInfo[joystick].Name.c_str());\r
+ snprintf_irr(logString, sizeof(logString), "Found joystick %d, %d axes, %d buttons '%s'",\r
+ joystick, joystickInfo[joystick].Axes,\r
+ joystickInfo[joystick].Buttons, joystickInfo[joystick].Name.c_str());\r
os::Printer::log(logString, ELL_INFORMATION);\r
}\r
\r
}\r
\r
\r
-//! presents a surface in the client area\r
-bool CIrrDeviceSDL::present(video::IImage* surface, void* windowId, core::rect<s32>* srcClip)\r
-{\r
-#ifdef _IRR_EMSCRIPTEN_PLATFORM_\r
- return true;\r
-#else // !_IRR_EMSCRIPTEN_PLATFORM_\r
- SDL_Surface *sdlSurface = SDL_CreateRGBSurfaceFrom(\r
- surface->getData(), surface->getDimension().Width, surface->getDimension().Height,\r
- surface->getBitsPerPixel(), surface->getPitch(),\r
- surface->getRedMask(), surface->getGreenMask(), surface->getBlueMask(), surface->getAlphaMask());\r
- if (!sdlSurface)\r
- return false;\r
- SDL_SetSurfaceAlphaMod(sdlSurface, 0);\r
- SDL_SetColorKey(sdlSurface, 0, 0);\r
- sdlSurface->format->BitsPerPixel=surface->getBitsPerPixel();\r
- sdlSurface->format->BytesPerPixel=surface->getBytesPerPixel();\r
- if ((surface->getColorFormat()==video::ECF_R8G8B8) ||\r
- (surface->getColorFormat()==video::ECF_A8R8G8B8))\r
- {\r
- sdlSurface->format->Rloss=0;\r
- sdlSurface->format->Gloss=0;\r
- sdlSurface->format->Bloss=0;\r
- sdlSurface->format->Rshift=16;\r
- sdlSurface->format->Gshift=8;\r
- sdlSurface->format->Bshift=0;\r
- if (surface->getColorFormat()==video::ECF_R8G8B8)\r
- {\r
- sdlSurface->format->Aloss=8;\r
- sdlSurface->format->Ashift=32;\r
- }\r
- else\r
- {\r
- sdlSurface->format->Aloss=0;\r
- sdlSurface->format->Ashift=24;\r
- }\r
- }\r
- else if (surface->getColorFormat()==video::ECF_R5G6B5)\r
- {\r
- sdlSurface->format->Rloss=3;\r
- sdlSurface->format->Gloss=2;\r
- sdlSurface->format->Bloss=3;\r
- sdlSurface->format->Aloss=8;\r
- sdlSurface->format->Rshift=11;\r
- sdlSurface->format->Gshift=5;\r
- sdlSurface->format->Bshift=0;\r
- sdlSurface->format->Ashift=16;\r
- }\r
- else if (surface->getColorFormat()==video::ECF_A1R5G5B5)\r
- {\r
- sdlSurface->format->Rloss=3;\r
- sdlSurface->format->Gloss=3;\r
- sdlSurface->format->Bloss=3;\r
- sdlSurface->format->Aloss=7;\r
- sdlSurface->format->Rshift=10;\r
- sdlSurface->format->Gshift=5;\r
- sdlSurface->format->Bshift=0;\r
- sdlSurface->format->Ashift=15;\r
- }\r
-\r
- SDL_Surface* scr = (SDL_Surface* )windowId;\r
- if (!scr)\r
- scr = SDL_GetWindowSurface(Window);\r
- if (scr)\r
- {\r
- if (srcClip)\r
- {\r
- SDL_Rect sdlsrcClip;\r
- sdlsrcClip.x = srcClip->UpperLeftCorner.X;\r
- sdlsrcClip.y = srcClip->UpperLeftCorner.Y;\r
- sdlsrcClip.w = srcClip->getWidth();\r
- sdlsrcClip.h = srcClip->getHeight();\r
- SDL_BlitSurface(sdlSurface, &sdlsrcClip, scr, NULL);\r
- }\r
- else\r
- SDL_BlitSurface(sdlSurface, NULL, scr, NULL);\r
- SDL_RenderPresent(SDL_GetRenderer(Window));\r
- }\r
-\r
- SDL_FreeSurface(sdlSurface);\r
- return (scr != 0);\r
-#endif // !_IRR_EMSCRIPTEN_PLATFORM_\r
-}\r
-\r
-\r
//! notifies the device that it should close itself\r
void CIrrDeviceSDL::closeDevice()\r
{\r
os::Printer::log("Resizable not available on the web." , ELL_WARNING);\r
return;\r
#else // !_IRR_EMSCRIPTEN_PLATFORM_\r
- if (resize != Resizable) { \r
+ if (resize != Resizable) {\r
if (resize)\r
SDL_Flags |= SDL_WINDOW_RESIZABLE;\r
else\r
//! Minimizes window if possible\r
void CIrrDeviceSDL::minimizeWindow()\r
{\r
- if (Window) {\r
+ if (Window)\r
SDL_MinimizeWindow(Window);\r
- }\r
}\r
\r
\r
//! Maximize window\r
void CIrrDeviceSDL::maximizeWindow()\r
{\r
- // do nothing\r
+ if (Window)\r
+ SDL_MaximizeWindow(Window);\r
}\r
\r
//! Get the position of this window on screen\r
//! Restore original window size\r
void CIrrDeviceSDL::restoreWindow()\r
{\r
- // do nothing\r
+ if (Window)\r
+ SDL_RestoreWindow(Window);\r
+}\r
+\r
+bool CIrrDeviceSDL::isWindowMaximized() const\r
+{\r
+ return Window && (SDL_GetWindowFlags(Window) & SDL_WINDOW_MAXIMIZED) != 0;\r
}\r
\r
bool CIrrDeviceSDL::isFullscreen() const\r
//! returns if window has focus.\r
bool CIrrDeviceSDL::isWindowFocused() const\r
{\r
- return SDL_GetWindowFlags(Window) & SDL_WINDOW_INPUT_FOCUS;\r
+ return Window && (SDL_GetWindowFlags(Window) & SDL_WINDOW_INPUT_FOCUS) != 0;\r
}\r
\r
\r
//! returns if window is minimized.\r
bool CIrrDeviceSDL::isWindowMinimized() const\r
{\r
- return WindowMinimized;\r
-}\r
-\r
-\r
-//! Set the current Gamma Value for the Display\r
-bool CIrrDeviceSDL::setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast )\r
-{\r
- /*\r
- // todo: Gamma in SDL takes ints, what does Irrlicht use?\r
- return (SDL_SetGamma(red, green, blue) != -1);\r
- */\r
- return false;\r
+ return Window && (SDL_GetWindowFlags(Window) & SDL_WINDOW_MINIMIZED) != 0;\r
}\r
\r
-//! Get the current Gamma Value for the Display\r
-bool CIrrDeviceSDL::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast )\r
-{\r
-/* brightness = 0.f;\r
- contrast = 0.f;\r
- return (SDL_GetGamma(&red, &green, &blue) != -1);*/\r
- return false;\r
-}\r
\r
//! returns color format of the window.\r
video::ECOLOR_FORMAT CIrrDeviceSDL::getColorFormat() const\r
KeyMap.sort();\r
}\r
\r
+void CIrrDeviceSDL::CCursorControl::initCursors()\r
+{\r
+ Cursors.reserve(gui::ECI_COUNT);\r
+\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW)); // ECI_NORMAL\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_CROSSHAIR)); // ECI_CROSS\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND)); // ECI_HAND\r
+ Cursors.emplace_back(nullptr); // ECI_HELP\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM)); // ECI_IBEAM\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_NO)); // ECI_NO\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_WAIT)); // ECI_WAIT\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEALL)); // ECI_SIZEALL\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENESW)); // ECI_SIZENESW\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENWSE)); // ECI_SIZENWSE\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENS)); // ECI_SIZENS\r
+ Cursors.emplace_back(SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE)); // ECI_SIZEWE\r
+ Cursors.emplace_back(nullptr); // ECI_UP\r
+}\r
+\r
} // end namespace irr\r
\r
#endif // _IRR_COMPILE_WITH_SDL_DEVICE_\r