Load embedded icons to SDL_Surface |
Alexey Petruchik
Guest
|
Is there any way to load embedded icons from rc file on windows to SDL_Surface? SDL_LoadBMP(iconname) seems to be not working for me.
|
|||||||||||
|
Naith
|
It depends on which icon you're talking about.
The different icons you can change is: 1. The icon that is seen when looking at the exe file in Windows Explorer (and other programs). 2. The icon that is seen in the task bar when the exe file is started. 3. The icon that is seen in the upper bar (to the left of the window title) when the application is started. Icon 1 and 2 can easily be changed by choosing Add --> Resource --> Icon in Visual Studio. In there an icon of 16x16 size and an icon of 32x32 size can be created. If you're using another IDE, you need to check how to add an icon file. When the two icons has been created they should be seen in Windows Explorer and in the task bar as soon as the exe has been builded and executed. Icon 3 is a bit harder to change and according to some pages there's ways to change it by using some Windows specific code, but I guess the icon change will only work on Windows then. Check these pages for more information: http://forums.libsdl.org/viewtopic.php?t=8323&sid=4ad14ec89ec998528f309cf0fb7c7842 http://stackoverflow.com/questions/19311609/how-do-i-set-window-titlebar-icon-and-alt-tab-icon-in-sdl2-c-visual-studio If you don't want to go through all that and write Windows-specific code, you can create the icon as a image file, convert it into a raw/binary file and then load it with SDL_LoadBMP_RW. The icon can then be changed by using SDL_SetWindowIcon and passing the surface that has been created with the function above. I have never changed the icon in my applications / games but if I will do it, I will probably do it like that. |
|||||||||||
|
Load embedded icons to SDL_Surface |
Alexey Petruchik
Guest
|
Ok, after some investigation it seems to be a missing functionality so i've created a pull request https://bugzilla.libsdl.org/show_bug.cgi?id=2841
On Fri, Jan 9, 2015 at 1:02 PM, Jeffrey Carpenter wrote:
|
|||||||||||||
|