SDL_WM_SetIcon isn't working

Hi All,

I’m trying to change the app’s icon but SDL_WM_SetIcon isn’t working.
The icon just stays as the default Window’s app icon. I’d rather have a
messed-up icon than none because then I knew it would just be a matter
of changing parameters to SDL_CreateRGBSurfaceFrom.

I’m compiling a resource file witch just has one icon, and it shows up
in the task bar. But the window’s icon and the icon that appears during
Alt-Tab are both the Window’s app icon.

--------------------8<--------------------
SDL_Surface* icon = SDL_CreateRGBSurfaceFrom(
(void*)icon,
32, 32, 8, 32 * 4,
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000
);
if (icon == NULL)
{
THROW(SDL_GetError());
}

SDL_WM_SetCaption(m_Title.c_str(), m_Title.c_str());
SDL_WM_SetIcon(icon, NULL);

SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);

putenv(“SDL_VIDEO_WINDOW_POS”);
putenv(“SDL_VIDEO_CENTERED=1”);

m_Screen = SDL_SetVideoMode(mode.w, mode.h, 0, SDL_OPENGL |
(m_FullScreen ? SDL_FULLSCREEN : 0));
--------------------8<--------------------

I’m using Vista32 and SDL_Linked_Version says I’m using version 1.2.13 :slight_smile:

Thanks in advance,

Andre

Sorry, the 2nd line

(void*)icon,

should read

(void*)the_icon,

Cheers,

Andre

Andre de Leiradella wrote:> Hi All,

I’m trying to change the app’s icon but SDL_WM_SetIcon isn’t working.
The icon just stays as the default Window’s app icon. I’d rather have a
messed-up icon than none because then I knew it would just be a matter
of changing parameters to SDL_CreateRGBSurfaceFrom.

I’m compiling a resource file witch just has one icon, and it shows up
in the task bar. But the window’s icon and the icon that appears during
Alt-Tab are both the Window’s app icon.

--------------------8<--------------------
SDL_Surface* icon = SDL_CreateRGBSurfaceFrom(
(void*)icon,
32, 32, 8, 32 * 4,
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000
);
if (icon == NULL)
{
THROW(SDL_GetError());
}

SDL_WM_SetCaption(m_Title.c_str(), m_Title.c_str());
SDL_WM_SetIcon(icon, NULL);

SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);

putenv(“SDL_VIDEO_WINDOW_POS”);
putenv(“SDL_VIDEO_CENTERED=1”);

m_Screen = SDL_SetVideoMode(mode.w, mode.h, 0, SDL_OPENGL |
(m_FullScreen ? SDL_FULLSCREEN : 0));
--------------------8<--------------------

I’m using Vista32 and SDL_Linked_Version says I’m using version 1.2.13 :slight_smile:

Thanks in advance,

Andre


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Ok, I’ve corrected the parameters of SDL_CreateRGBSurfaceFrom until
SDL_SaveBMP generated a good image and – surprise! – the icon appeared
in both the window and during Alt-Tab.

The problem now is, I have a hand-edited 16x16 icon that looks much
better than SDL’s scaled down version from the 32x32 image I feed to
SDL_WM_SetIcon. Are there any plans to address it in SDL 1.3? It would
be nice to set both the small and large (!) icon on OSes that support it.

Cheers,

Andre

Andre de Leiradella wrote:> Sorry, the 2nd line

(void*)icon,

should read

(void*)the_icon,

Cheers,

Andre

Andre de Leiradella wrote:

Hi All,

I’m trying to change the app’s icon but SDL_WM_SetIcon isn’t working.
The icon just stays as the default Window’s app icon. I’d rather have
a messed-up icon than none because then I knew it would just be a
matter of changing parameters to SDL_CreateRGBSurfaceFrom.

I’m compiling a resource file witch just has one icon, and it shows up
in the task bar. But the window’s icon and the icon that appears
during Alt-Tab are both the Window’s app icon.

--------------------8<--------------------
SDL_Surface* icon = SDL_CreateRGBSurfaceFrom(
(void*)icon,
32, 32, 8, 32 * 4,
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000
);
if (icon == NULL)
{
THROW(SDL_GetError());
}

SDL_WM_SetCaption(m_Title.c_str(), m_Title.c_str());
SDL_WM_SetIcon(icon, NULL);

SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);

putenv(“SDL_VIDEO_WINDOW_POS”);
putenv(“SDL_VIDEO_CENTERED=1”);

m_Screen = SDL_SetVideoMode(mode.w, mode.h, 0, SDL_OPENGL |
(m_FullScreen ? SDL_FULLSCREEN : 0));
--------------------8<--------------------

I’m using Vista32 and SDL_Linked_Version says I’m using version 1.2.13
:slight_smile:

Thanks in advance,

Andre


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yes. It’s not implemented yet, but the plan is to support an icon set
instead of a single icon.On Sun, Oct 4, 2009 at 4:56 PM, Andre de Leiradella wrote:

Ok, I’ve corrected the parameters of SDL_CreateRGBSurfaceFrom until
SDL_SaveBMP generated a good image and – surprise! – the icon appeared in
both the window and during Alt-Tab.

The problem now is, I have a hand-edited 16x16 icon that looks much better
than SDL’s scaled down version from the 32x32 image I feed to
SDL_WM_SetIcon. Are there any plans to address it in SDL 1.3? It would be
nice to set both the small and large (!) icon on OSes that support it.

Cheers,

Andre

Andre de Leiradella wrote:

Sorry, the 2nd line

(void*)icon,

should read

(void*)the_icon,

Cheers,

Andre

Andre de Leiradella wrote:

Hi All,

I’m trying to change the app’s icon but SDL_WM_SetIcon isn’t working. The
icon just stays as the default Window’s app icon. I’d rather have a
messed-up icon than none because then I knew it would just be a matter of
changing parameters to SDL_CreateRGBSurfaceFrom.

I’m compiling a resource file witch just has one icon, and it shows up in
the task bar. But the window’s icon and the icon that appears during Alt-Tab
are both the Window’s app icon.

--------------------8<--------------------
SDL_Surface* icon = SDL_CreateRGBSurfaceFrom(
? ?(void*)icon,
? ?32, 32, 8, 32 * 4,
? ?0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000
);
if (icon == NULL)
{
? ?THROW(SDL_GetError());
}

SDL_WM_SetCaption(m_Title.c_str(), m_Title.c_str());
SDL_WM_SetIcon(icon, NULL);

SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);

putenv(“SDL_VIDEO_WINDOW_POS”);
putenv(“SDL_VIDEO_CENTERED=1”);

m_Screen = SDL_SetVideoMode(mode.w, mode.h, 0, SDL_OPENGL | (m_FullScreen
? SDL_FULLSCREEN : 0));
--------------------8<--------------------

I’m using Vista32 and SDL_Linked_Version says I’m using version 1.2.13
:slight_smile:

Thanks in advance,

Andre


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Great Sam, thanks!

Sam Lantinga wrote:> Yes. It’s not implemented yet, but the plan is to support an icon set

instead of a single icon.

On Sun, Oct 4, 2009 at 4:56 PM, Andre de Leiradella wrote:

Ok, I’ve corrected the parameters of SDL_CreateRGBSurfaceFrom until
SDL_SaveBMP generated a good image and – surprise! – the icon appeared in
both the window and during Alt-Tab.

The problem now is, I have a hand-edited 16x16 icon that looks much better
than SDL’s scaled down version from the 32x32 image I feed to
SDL_WM_SetIcon. Are there any plans to address it in SDL 1.3? It would be
nice to set both the small and large (!) icon on OSes that support it.

Cheers,

Andre

Andre de Leiradella wrote:

Sorry, the 2nd line

(void*)icon,

should read

(void*)the_icon,

Cheers,

Andre

Andre de Leiradella wrote:

Hi All,

I’m trying to change the app’s icon but SDL_WM_SetIcon isn’t working. The
icon just stays as the default Window’s app icon. I’d rather have a
messed-up icon than none because then I knew it would just be a matter of
changing parameters to SDL_CreateRGBSurfaceFrom.

I’m compiling a resource file witch just has one icon, and it shows up in
the task bar. But the window’s icon and the icon that appears during Alt-Tab
are both the Window’s app icon.

--------------------8<--------------------
SDL_Surface* icon = SDL_CreateRGBSurfaceFrom(
(void*)icon,
32, 32, 8, 32 * 4,
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000
);
if (icon == NULL)
{
THROW(SDL_GetError());
}

SDL_WM_SetCaption(m_Title.c_str(), m_Title.c_str());
SDL_WM_SetIcon(icon, NULL);

SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0);

putenv(“SDL_VIDEO_WINDOW_POS”);
putenv(“SDL_VIDEO_CENTERED=1”);

m_Screen = SDL_SetVideoMode(mode.w, mode.h, 0, SDL_OPENGL | (m_FullScreen
? SDL_FULLSCREEN : 0));
--------------------8<--------------------

I’m using Vista32 and SDL_Linked_Version says I’m using version 1.2.13
:slight_smile:

Thanks in advance,

Andre


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org