Permalink
Browse files

Fix window icon.

It worked automatically in Allegro4 but apparently Allegro5 decided to drop that totally inconvenient useless feature.
  • Loading branch information...
SupSuper committed Oct 24, 2015
1 parent 3d2afbd commit 18a041232622b4a485649f7f7ac9914e937d1710
Showing with 18 additions and 5 deletions.
  1. +1 −1 apocicon.rc
  2. +15 −3 framework/framework.cpp
  3. +1 −0 framework/framework.h
  4. +1 −1 game/boot.cpp
View
@@ -1 +1 @@
201 ICON "apocicon.ico"
ALLEGRO_ICON ICON "apocicon.ico"
View
@@ -16,6 +16,10 @@
// Use physfs to get prefs dir
#include <physfs.h>
#ifdef _WIN32
#include <allegro5/allegro_windows.h>
#endif
using namespace OpenApoc;
namespace
@@ -656,12 +660,20 @@ Vec2<int> Framework::Display_GetSize()
void Framework::Display_SetTitle(UString NewTitle)
{
#ifdef _WIN32
al_set_app_name(NewTitle.c_str());
al_set_window_title(p->screen, NewTitle.c_str());
}
void Framework::Display_SetIcon()
{
#ifdef _WIN32
HINSTANCE handle = GetModuleHandle(NULL);
HICON icon = LoadIcon(handle, L"ALLEGRO_ICON");
HWND hwnd = al_get_win_window_handle(p->screen);
SetClassLongPtr(hwnd, GCLP_HICON, (LONG_PTR)icon);
#else
al_set_app_name(NewTitle.c_str());
al_set_window_title(p->screen, NewTitle.c_str());
// TODO: Figure out how this works
// al_set_display_icon(p->screen, ...);
#endif
}
View
@@ -75,6 +75,7 @@ class Framework
int Display_GetHeight();
Vec2<int> Display_GetSize();
void Display_SetTitle(UString NewTitle);
void Display_SetIcon();
bool IsSlowMode();
void SetSlowMode(bool SlowEnabled);
View
@@ -27,7 +27,7 @@ void BootUp::Begin()
loadingimage = fw.data->load_image("UI/LOADING.PNG");
logoimage = fw.data->load_image("UI/LOGO.PNG");
loadtime = 0;
fw.Display_SetTitle("OpenApocalypse");
fw.Display_SetIcon();
this->gamecoreLoadComplete = false;
this->asyncGamecoreLoad =

0 comments on commit 18a0412

Please sign in to comment.