Sign in to follow this  

[SDL] Getting your own application icon..

This topic is 4306 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4306 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this