How do I set window titlebar icon and alt-tab icon in SDL2 / C++ / Visual Studio 2012 express program?

前端 未结 2 1967
时光取名叫无心
时光取名叫无心 2021-01-19 07:38

I have added a .rc file to my project with just the following:

IDI_MAIN_ICON          ICON          \"..\\\\..\\\\icon_artwork\\\\windows_icons\\\\project.         


        
2条回答
  •  别那么骄傲
    2021-01-19 08:08

    You should be able to get a SDL_Surface from a .png file using

    SDL_Surface *IMG_Load(const char *file)
    

    then pass it to your SDL_SetWindowIcon(SDL_Window* window, SDL_Surface* icon) method. I don't think the IMG_Load(...) method takes .ico files though, but a 32x32 .png version of your icon would be a good compromise... Not ideal but the best workaround I can think of ;)

提交回复
热议问题