mirror of
https://github.com/glest/glest-source.git
synced 2025-08-16 13:23:59 +02:00
- modified icons to properly work with windows (bothh ico files and vc++ projeect files etc)
This commit is contained in:
@@ -65,9 +65,17 @@ Window::Window() {
|
||||
lastMouseEvent = 0;
|
||||
mousePos = Vec2i(0);
|
||||
mouseState.clear();
|
||||
|
||||
#ifdef WIN32
|
||||
init_win32();
|
||||
#endif
|
||||
}
|
||||
|
||||
Window::~Window() {
|
||||
#ifdef WIN32
|
||||
done_win32();
|
||||
#endif
|
||||
|
||||
assert(global_window == this);
|
||||
global_window = 0;
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <cassert>
|
||||
#include <algorithm>
|
||||
#include <string.h>
|
||||
#include "SDL_syswm.h"
|
||||
|
||||
#include "leak_dumper.h"
|
||||
|
||||
@@ -179,4 +180,27 @@ void exceptionMessage(const exception &excp){
|
||||
// return GetSystemMetrics(SM_CYSCREEN);
|
||||
//}
|
||||
|
||||
// This lets us set the SDL Window Icon in Windows
|
||||
// since its a console application
|
||||
HICON icon;
|
||||
|
||||
void init_win32() {
|
||||
HINSTANCE handle = ::GetModuleHandle(NULL);
|
||||
icon = ::LoadIcon(handle, "IDI_ICON1");
|
||||
|
||||
SDL_SysWMinfo wminfo;
|
||||
SDL_VERSION(&wminfo.version)
|
||||
if (SDL_GetWMInfo(&wminfo) != 1)
|
||||
{
|
||||
// error: wrong SDL version
|
||||
}
|
||||
|
||||
HWND hwnd = wminfo.window;
|
||||
|
||||
::SetClassLong(hwnd, GCL_HICON, (LONG) icon);
|
||||
}
|
||||
void done_win32() {
|
||||
::DestroyIcon(icon);
|
||||
}
|
||||
|
||||
}}//end namespace
|
||||
|
Reference in New Issue
Block a user