Sign in to follow this  
Gykonik

C++ Change Window Icon

Recommended Posts

I know, that this theme got already discussed a lot of times but I now read over 4 hours and still I'm not able to get this working..

 

"All" I want to do is to set my custom icon for the window for all 3 cases (exe, tabmenu and real window icon (left top corner))

 

I found the doc from sdl, but there they are hardcoding the pixel values into a array and this I don't want..

 

I have a icon.png and this one I want to include in my window..

I installed sdl and sdl_image

 

Now I tried this:

IMG_Init(IMG_INIT_PNG);

SDL_Surface* surface = IMG_Load("icon.png");
// The icon is attached to the window pointer
SDL_SetWindowIcon(_sdlWindow, surface);

// ...and the surface containing the icon pixel data is no longer required.
SDL_FreeSurface(surface);

But also this one doesn't work...

 

I would love it, if someone could say me, how I can do this...

 

Thanks

Share this post


Link to post
Share on other sites

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