- modified icons to properly work with windows (bothh ico files and vc++ projeect files etc)

This commit is contained in:
Mark Vejvoda
2010-06-25 22:04:40 +00:00
parent 1a8250d2d2
commit 15ee2da57f
18 changed files with 96 additions and 19 deletions

View File

@@ -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;
}

View File

@@ -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