mirror of
https://git.code.sf.net/p/quake/quake2forge
synced 2025-01-06 09:51:05 +00:00
- Confirmed icon support for SDL drivers. (icculus patchset #9)
This commit is contained in:
parent
3cea7ff14a
commit
f1913fdc22
1 changed files with 27 additions and 28 deletions
55
src/rw_sdl.c
55
src/rw_sdl.c
|
@ -652,39 +652,38 @@ int GLimp_Init( void *hInstance, void *wndProc )
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void SetSDLIcon(void)
|
static void SetSDLIcon(void) {
|
||||||
{
|
|
||||||
#include "../data/pixmaps/q2icon.xbm"
|
#include "../data/pixmaps/q2icon.xbm"
|
||||||
SDL_Surface *icon;
|
SDL_Surface * icon;
|
||||||
SDL_Color color;
|
SDL_Color color;
|
||||||
Uint8 *ptr;
|
Uint8 * ptr;
|
||||||
int i, mask;
|
int i, mask;
|
||||||
|
|
||||||
icon = SDL_CreateRGBSurface(SDL_SWSURFACE, q2icon_width, q2icon_height, 8,
|
icon = SDL_CreateRGBSurface(SDL_SWSURFACE, q2icon_width, q2icon_height, 8,
|
||||||
0, 0, 0, 0);
|
0, 0, 0, 0);
|
||||||
if (icon == NULL)
|
if (icon == NULL)
|
||||||
return; /* oh well... */
|
return; /* oh well... */
|
||||||
SDL_SetColorKey(icon, SDL_SRCCOLORKEY, 0);
|
SDL_SetColorKey(icon, SDL_SRCCOLORKEY, 0);
|
||||||
|
|
||||||
color.r = 255;
|
color.r = 255;
|
||||||
color.g = 255;
|
color.g = 255;
|
||||||
color.b = 255;
|
color.b = 255;
|
||||||
SDL_SetColors(icon, &color, 0, 1); /* just in case */
|
SDL_SetColors(icon, &color, 0, 1); /* just in case */
|
||||||
color.r = 0;
|
color.r = 0;
|
||||||
color.g = 16;
|
color.g = 16;
|
||||||
color.b = 0;
|
color.b = 0;
|
||||||
SDL_SetColors(icon, &color, 1, 1);
|
SDL_SetColors(icon, &color, 1, 1);
|
||||||
|
|
||||||
ptr = (Uint8 *)icon->pixels;
|
ptr = (Uint8 *)icon->pixels;
|
||||||
for (i = 0; i < sizeof(q2icon_bits); i++) {
|
for (i = 0; i < sizeof(q2icon_bits); i++) {
|
||||||
for (mask = 1; mask != 0x100; mask <<= 1) {
|
for (mask = 1; mask != 0x100; mask <<= 1) {
|
||||||
*ptr = (q2icon_bits[i] & mask) ? 1 : 0;
|
*ptr = (q2icon_bits[i] & mask) ? 1 : 0;
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_WM_SetIcon(icon, NULL);
|
SDL_WM_SetIcon(icon, NULL);
|
||||||
SDL_FreeSurface(icon);
|
SDL_FreeSurface(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue