added icon to screenhelper

This commit is contained in:
Way, No 2014-04-24 11:43:13 +11:00
parent 43c533a2e7
commit 9ab83da60a
2 changed files with 21 additions and 1 deletions

View File

@ -162,6 +162,25 @@ namespace spades {
if(window != nullptr && context == nullptr) {
SPLog("Failed to create OpenGL context: %s", SDL_GetError());
}
#ifdef __APPLE__
#elif __unix
SDL_Surface *icon = nullptr;
SDL_RWops *icon_rw = nullptr;
icon_rw = SDL_RWFromConstMem(LDVAR(openspades_png), LDLEN(openspades_png));
if (icon_rw != nullptr) {
icon = IMG_LoadPNG_RW(icon_rw);
SDL_FreeRW(icon_rw);
}
if(icon == nullptr) {
std::string msg = SDL_GetError();
SPLog("Failed to load icon: %s", msg.c_str());
} else {
SDL_SetWindowIcon(window, icon);
SDL_FreeSurface(icon);
}
#endif
if(!context){
// OpenGL initialization failed!

View File

@ -28,6 +28,7 @@
#include <Core/Math.h>
#include <functional>
#include <map>
#include "Icon.inc"
namespace spades {
class Serveritem;
@ -76,4 +77,4 @@ namespace spades {
void Start();
};
}
}
}