[SDL] Getting your own application icon..

Started by
3 comments, last by TheOther 18 years, 1 month ago
Hi everyone, I'm running into a brick wall and pulling my hair out with what should be a simple issue. I've got an icon file which I've imported into my visual studio project. I'm trying to get the compiled resulting .exe to show up as this icon, but so far I'm not getting any love. I'm aware of the SetIcon SDL method, but I want to do this in the compiler, NOT during the runtime of the game itself. This should be possible, but I just can't get it working. I've tried to go through the documenation for the rc (resource compiler) on the MSDN but there's nothing that jumps out at me. Has anyone managed to do this? thanks!
Advertisement
Quote:Original post by TheOther
but I want to do this in the compiler, NOT during the runtime of the game itself.


Well considering the window isn't made at compile time what makes you think the Window icon is going to be made at compile time?

Learn to make games with my SDL 2 Tutorials

I think he means the icon you see when viewing your .exe file in the explorer window, rather than the window icon.

Setting the window icon is easy:
SDL_Surface* icon = SDL_LoadBMP(iconName))SDL_WM_SetIcon(icon, NULL);


They have different implementations I think, and SDL_SetIcon is for the window icon only.
Go to "Add Resource", Select "Icon". Click "New". Now you can copy & paste in your icon. You can add more by doing "Image->New Image Type" from the menu. You should do a 16x16 one and a 32x32 one.

Then when you build your application, it will just throw it in there for you. This will give your program the Icon when you are browsing files. To give it an icon when it is run, use SDL_WM_SetIcon.

I was suprised this worked, but it does.
Quote:Original post by Simian Man
Go to "Add Resource", Select "Icon". Click "New". Now you can copy & paste in your icon. You can add more by doing "Image->New Image Type" from the menu. You should do a 16x16 one and a 32x32 one.

Then when you build your application, it will just throw it in there for you. This will give your program the Icon when you are browsing files. To give it an icon when it is run, use SDL_WM_SetIcon.

I was suprised this worked, but it does.


Thanks Simian Man.

That's exactly right...I was surprised this works as well!

I had used "Import Icon", but when I tried your suggestion of just adding a new one and then cutting & pasting the existing one to it....TA DA!

Thanks everyone.

This topic is closed to new replies.

Advertisement