Automatically load icon on Windows

This commit is contained in:
Joshua Granick
2014-12-28 13:23:12 -08:00
parent a12a27582e
commit 896efe77c0
3 changed files with 17 additions and 3 deletions

View File

@@ -13,6 +13,8 @@ import flash.Lib;
#elseif java
import org.lwjgl.opengl.GL11;
import org.lwjgl.system.glfw.GLFW;
#elseif windows
import sys.FileSystem;
#end
@@ -133,6 +135,15 @@ class Application extends Module {
addWindow (window);
#if windows
if (FileSystem.exists ("icon.png")) {
var image = Image.fromFile ("icon.png");
window.setIcon (image);
}
#end
}

View File

@@ -55,7 +55,7 @@ namespace lime {
void SDLWindow::SetIcon (ImageBuffer *imageBuffer) {
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom (imageBuffer->data->Bytes (), imageBuffer->width, imageBuffer->height, imageBuffer->bpp * 8, imageBuffer->width * imageBuffer->bpp, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom (imageBuffer->data->Bytes (), imageBuffer->width, imageBuffer->height, imageBuffer->bpp * 8, imageBuffer->width * imageBuffer->bpp, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
if (surface) {

View File

@@ -12,6 +12,7 @@ import helpers.NodeJSHelper;
import helpers.PathHelper;
import helpers.PlatformHelper;
import helpers.ProcessHelper;
import project.Asset;
import project.AssetType;
import project.Haxelib;
import project.HXProject;
@@ -92,6 +93,8 @@ class WindowsPlatform extends PlatformTarget {
}
IconHelper.createIcon (project.icons, 32, 32, PathHelper.combine (applicationDirectory, "icon.png"));
if (targetType == "neko") {
ProcessHelper.runCommand ("", "haxe", [ hxml ]);
@@ -134,14 +137,14 @@ class WindowsPlatform extends PlatformTarget {
}
var iconPath = PathHelper.combine (applicationDirectory, "icon.ico");
/*var iconPath = PathHelper.combine (applicationDirectory, "icon.ico");
if (IconHelper.createWindowsIcon (project.icons, iconPath)) {
var templates = [ PathHelper.getHaxelib (new Haxelib ("lime")) + "/templates" ].concat (project.templatePaths);
ProcessHelper.runCommand ("", PathHelper.findTemplate (templates, "bin/ReplaceVistaIcon.exe"), [ executablePath, iconPath ], true, true);
}
}*/
}