Permalink
Browse files

Windows: Icon for program executable and render window

  • Loading branch information...
bullno1 committed Apr 29, 2012
1 parent 8272187 commit f7db3df1b645d2eb20088b78d4ee53b721d61957
Showing with 18 additions and 1 deletion.
  1. +3 −1 premake4.lua
  2. BIN src/Akuma.ico
  3. BIN src/Akuma.rc
  4. +15 −0 src/Simulator.cpp
View
@@ -55,7 +55,9 @@ solution "Akuma"
"strmiids"
}
files {
- "src/FileWatcher/FileWatcherWin32.cpp"
+ "src/FileWatcher/FileWatcherWin32.cpp",
+ "src/Akuma.ico",
+ "src/Akuma.rc"
}
excludes {
"src/FileWatcher/FileWatcherLinux.h",
View
Binary file not shown.
View
Binary file not shown.
View
@@ -10,6 +10,7 @@
#include <FileWatcher/FileWatcher.h>
#include <SDL.h>
#include <SDL_opengl.h>
+#include <SDL_syswm.h>
#include "lua.h"
using namespace std;
@@ -84,6 +85,18 @@ void openWindow(const char* title, int width, int height)
SDL_SetVideoMode(width, height, 32, SDL_OPENGL);
SDL_WM_SetCaption(title, 0);
+#ifdef WIN32
+ SDL_SysWMinfo wmInfo;
+ SDL_VERSION(&wmInfo.version);
+ if(SDL_GetWMInfo(&wmInfo) > 0)
+ {
+ HANDLE icon = LoadImage(GetModuleHandle(0), "mainIcon", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE);
+ HWND windowHandle = wmInfo.window;
+ SetClassLong(windowHandle, GCL_HICON, (LONG)icon);
+ SetClassLong(windowHandle, GCL_HICONSM, (LONG)icon);
+ SetConsoleTitle("Log");
+ }
+#endif
AKUDetectGfxContext();
AKUSetScreenSize(width, height);
windowOpened = true;
@@ -233,7 +246,9 @@ ExitReason::Enum startSimulator(const boost::filesystem::path& pathToMain)
//run the main script
ExitReason::Enum exitReason = ExitReason::Error;
if(runScript(filename.string().c_str()))
+ {
exitReason = startGameLoop();
+ }
fw.removeWatch(watchID);
//Ensure that window is closed

0 comments on commit f7db3df

Please sign in to comment.