summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2025-07-08 09:02:03 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2025-07-14 17:51:54 +0200
commitd5f14796422dfd180fd2b1a56323225eab655145 (patch)
treefad3f13a739971f4fad512143b6129e95016e1bf
parent7ce556976838874ed03585927fddf631c8f042ed (diff)
downloadmana-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.cpp16
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)
{