Jump to content
  • Advertisement
Sign in to follow this  
Chrono1081

SDL_WM_SetIcon() on Mac OS?

This topic is 3494 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

I was just wondering if it is possible to use this function to set an icon on the window in Mac OSX? My attempts were unsuccessful. The program compiles but no icon displays (although everything else works fine). The SDL Documentation does not explain how to use this on Mac OS (anywhere that I saw anyway) and doing it the windows way with a 32 x 32 icon doesnt work, and the only googling I found comes up with an unanswered question from this site about something similar (the user got it to work but it looks bad. I cant even get mine to work). Does anyone know if this is doable on Mac OS? If so how? Any help would be greatly appreciated :) Thank you.

Share this post


Link to post
Share on other sites
Advertisement
It certainly appears to have an implementation here (under QZ_SetIcon).

Are you following all the advice in the documentation, particularly "This function must be called before the first call to SDL_SetVideoMode".

If not, you might have to take a look at whether the underlying call to "setApplicationIconImage" has any restrictions on the kinds of images it allows. Some Googling seems to suggest that frequently updating the icon may not be supported, at least using that particular function.

Share this post


Link to post
Share on other sites
As a side note, if you're building an application bundle using Xcode, you can skip SDL_WM_SetIcon() entirely and instead include the icon as a resource in the bundle (the icon will be used in the Finder, the dock, and the 'Command-Tab' window, and perhaps in other places as well). I don't remember the exact details, but I don't think SDL_WM_SetIcon() supports all the features that are available with 'native' OS X icons (for example, it doesn't support alpha blending or multiple icon sizes, IIRC), so if it's an option for you, I'd recommend skipping SDL_WM_SetIcon() and making the icon a resource.

SDL_WM_SetIcon() should work though; like rip-off said, make sure you're calling the function in the right place. (And of course check the obvious things if you haven't already, such as whether the image was correctly loaded in the first place.)

Share this post


Link to post
Share on other sites
Thank you for the responses :)

I am calling it correctly and it loads the dock icon just fine, just not the icon in the top title bar.

I even moved my code from my windows strait to mac os (lots easier then I thought!) and everything works fine, just not that little icon : /


@Ripoff I will have to look more into the QZ_SetIcon. I never saw anything like that. The documentation I was going off of was the stuff on SDL's website.

I also tried adding my icon through the plist but still the same : / The icon will appear in the dock and even beside the icon when minimized, just not in the title bar.

Share this post


Link to post
Share on other sites
In Mac OS X, you'll only get an icon in the title bar if the program handles documents. It's called a proxy icon and is a handle for the document on disk, and I guess that doesn't apply here?

Share this post


Link to post
Share on other sites
Thank you Pointer you nailed it on the head :) I saw a mention of that this morning and you just confirmed it :)

Thank you guys again for all the replies :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!