diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2025-07-08 09:02:03 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2025-07-14 17:51:54 +0200 |
commit | d5f14796422dfd180fd2b1a56323225eab655145 (patch) | |
tree | fad3f13a739971f4fad512143b6129e95016e1bf | |
parent | 7ce556976838874ed03585927fddf631c8f042ed (diff) | |
download | mana-d5f14796422dfd180fd2b1a56323225eab655145.tar.gz mana-d5f14796422dfd180fd2b1a56323225eab655145.tar.bz2 mana-d5f14796422dfd180fd2b1a56323225eab655145.tar.xz mana-d5f14796422dfd180fd2b1a56323225eab655145.zip |
Simplified cursor code using SDL_CreateRGBSurfaceWithFormat
-rw-r--r-- | src/gui/gui.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 361ad0b8..768aeb2b 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -295,25 +295,13 @@ void Gui::loadCustomCursors() SDL_SetSurfaceBlendMode(mouseSurface, SDL_BLENDMODE_NONE); -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - const Uint32 rmask = 0xff000000; - const Uint32 gmask = 0x00ff0000; - const Uint32 bmask = 0x0000ff00; - const Uint32 amask = 0x000000ff; -#else - const Uint32 rmask = 0x000000ff; - const Uint32 gmask = 0x0000ff00; - const Uint32 bmask = 0x00ff0000; - const Uint32 amask = 0xff000000; -#endif - constexpr int cursorSize = 40; const int targetCursorSize = cursorSize * mCustomCursorScale; const int columns = mouseSurface->w / cursorSize; - SDL_Surface *cursorSurface = SDL_CreateRGBSurface( + SDL_Surface *cursorSurface = SDL_CreateRGBSurfaceWithFormat( 0, targetCursorSize, targetCursorSize, 32, - rmask, gmask, bmask, amask); + SDL_PIXELFORMAT_RGBA32); for (int i = 0; i < static_cast<int>(Cursor::Count); ++i) { |