MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / displaySetIcon

Method displaySetIcon

framework/framework.cpp:984–1006  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

982}
983
984void Framework::displaySetIcon(sp<RGBImage> image)
985{
986 if (!p->window)
987 {
988 return;
989 }
990#ifdef _WIN32
991 SDL_SysWMinfo info;
992 SDL_VERSION(&info.version);
993 SDL_GetWindowWMInfo(p->window, &info);
994 HINSTANCE handle = GetModuleHandle(NULL);
995 HICON icon = LoadIcon(handle, L"ALLEGRO_ICON");
996 HWND hwnd = info.info.win.window;
997 SetClassLongPtr(hwnd, GCLP_HICON, (LONG_PTR)icon);
998#else
999 RGBImageLock reader(image, ImageLockUse::Read);
1000 // TODO: Should set the pixels instead of using a void*
1001 SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(reader.getData(), image->size.x, image->size.y,
1002 32, 0, 0xF000, 0x0F00, 0x00F0, 0x000F);
1003 SDL_SetWindowIcon(p->window, surface);
1004 SDL_FreeSurface(surface);
1005#endif
1006}
1007
1008void Framework::audioInitialise()
1009{

Callers 1

beginMethod · 0.80

Calls 1

getDataMethod · 0.45

Tested by

no test coverage detected