diff --git a/lime/app/Application.hx b/lime/app/Application.hx index 898ddd9d6..e605cb00f 100644 --- a/lime/app/Application.hx +++ b/lime/app/Application.hx @@ -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 + } diff --git a/project/src/backend/sdl/SDLWindow.cpp b/project/src/backend/sdl/SDLWindow.cpp index d7b4edc6b..509022695 100644 --- a/project/src/backend/sdl/SDLWindow.cpp +++ b/project/src/backend/sdl/SDLWindow.cpp @@ -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) { diff --git a/tools/platforms/WindowsPlatform.hx b/tools/platforms/WindowsPlatform.hx index 115c2f329..e7fa42e70 100644 --- a/tools/platforms/WindowsPlatform.hx +++ b/tools/platforms/WindowsPlatform.hx @@ -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); - } + }*/ }