From 8920ff5317c7d150f5828f788d6cabd4abfcd1e8 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Sat, 11 Jul 2015 20:30:47 -0700 Subject: [PATCH] Use a default icon --- lime/tools/platforms/AndroidPlatform.hx | 12 +- lime/tools/platforms/BlackBerryPlatform.hx | 11 +- lime/tools/platforms/FirefoxPlatform.hx | 10 +- lime/tools/platforms/IOSPlatform.hx | 13 ++- lime/tools/platforms/MacPlatform.hx | 11 +- lime/tools/platforms/TizenPlatform.hx | 11 +- lime/tools/platforms/WebOSPlatform.hx | 11 +- lime/tools/platforms/WindowsPlatform.hx | 13 ++- .../Assets/lime.svg => default/icon.svg} | 108 +++++++++--------- templates/project/Assets/.gitignore | 0 templates/project/project.xml | 3 +- 11 files changed, 136 insertions(+), 67 deletions(-) rename templates/{project/Assets/lime.svg => default/icon.svg} (98%) create mode 100644 templates/project/Assets/.gitignore diff --git a/lime/tools/platforms/AndroidPlatform.hx b/lime/tools/platforms/AndroidPlatform.hx index 3495b9e40..97de3b7d0 100644 --- a/lime/tools/platforms/AndroidPlatform.hx +++ b/lime/tools/platforms/AndroidPlatform.hx @@ -16,6 +16,7 @@ import lime.tools.helpers.ProcessHelper; import lime.project.Architecture; import lime.project.AssetType; import lime.project.HXProject; +import lime.project.Icon; import lime.project.PlatformTarget; import sys.io.File; import sys.FileSystem; @@ -322,10 +323,17 @@ class AndroidPlatform extends PlatformTarget { var iconTypes = [ "ldpi", "mdpi", "hdpi", "xhdpi", "xxhdpi", "xxxhdpi" ]; var iconSizes = [ 36, 48, 72, 96, 144, 192 ]; + var icons = project.icons; + + if (icons.length == 0) { + + icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; + + } for (i in 0...iconTypes.length) { - if (IconHelper.createIcon (project.icons, iconSizes[i], iconSizes[i], destination + "/res/drawable-" + iconTypes[i] + "/icon.png")) { + if (IconHelper.createIcon (icons, iconSizes[i], iconSizes[i], destination + "/res/drawable-" + iconTypes[i] + "/icon.png")) { context.HAS_ICON = true; @@ -333,7 +341,7 @@ class AndroidPlatform extends PlatformTarget { } - IconHelper.createIcon (project.icons, 732, 412, destination + "/res/drawable-xhdpi/ouya_icon.png"); + IconHelper.createIcon (icons, 732, 412, destination + "/res/drawable-xhdpi/ouya_icon.png"); var packageDirectory = project.meta.packageName; packageDirectory = destination + "/src/" + packageDirectory.split (".").join ("/"); diff --git a/lime/tools/platforms/BlackBerryPlatform.hx b/lime/tools/platforms/BlackBerryPlatform.hx index c2c3fbaef..04387b3b1 100644 --- a/lime/tools/platforms/BlackBerryPlatform.hx +++ b/lime/tools/platforms/BlackBerryPlatform.hx @@ -16,6 +16,7 @@ import lime.tools.helpers.ProcessHelper; import lime.project.AssetType; import lime.project.Haxelib; import lime.project.HXProject; +import lime.project.Icon; import lime.project.NDLL; import lime.project.PlatformTarget; import sys.io.File; @@ -320,9 +321,17 @@ class BlackBerryPlatform extends PlatformTarget { context.ICONS = []; context.HAS_ICON = false; + var icons = project.icons; + + if (icons.length == 0) { + + icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; + + } + for (size in [ 114, 86 ]) { - if (IconHelper.createIcon (project.icons, size, size, PathHelper.combine (destination, "icon-" + size + ".png"))) { + if (IconHelper.createIcon (icons, size, size, PathHelper.combine (destination, "icon-" + size + ".png"))) { context.ICONS.push ("icon-" + size + ".png"); context.HAS_ICON = true; diff --git a/lime/tools/platforms/FirefoxPlatform.hx b/lime/tools/platforms/FirefoxPlatform.hx index 4e2543024..597f180f3 100644 --- a/lime/tools/platforms/FirefoxPlatform.hx +++ b/lime/tools/platforms/FirefoxPlatform.hx @@ -8,6 +8,7 @@ import lime.tools.helpers.IconHelper; import lime.tools.helpers.PathHelper; import lime.tools.helpers.LogHelper; import lime.project.HXProject; +import lime.project.Icon; import sys.FileSystem; @@ -68,10 +69,17 @@ class FirefoxPlatform extends HTML5Platform { FileHelper.recursiveCopyTemplate (project.templatePaths, "firefox/template", destination, context); var sizes = [ 32, 48, 60, 64, 128, 512 ]; + var icons = project.icons; + + if (icons.length == 0) { + + icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; + + } for (size in sizes) { - IconHelper.createIcon (project.icons, size, size, PathHelper.combine (destination, "icon-" + size + ".png")); + IconHelper.createIcon (icons, size, size, PathHelper.combine (destination, "icon-" + size + ".png")); } diff --git a/lime/tools/platforms/IOSPlatform.hx b/lime/tools/platforms/IOSPlatform.hx index 6c269f631..98fe8c4a6 100644 --- a/lime/tools/platforms/IOSPlatform.hx +++ b/lime/tools/platforms/IOSPlatform.hx @@ -23,6 +23,7 @@ import lime.project.Asset; import lime.project.AssetType; import lime.project.Haxelib; import lime.project.HXProject; +import lime.project.Icon; import lime.project.Keystore; import lime.project.NDLL; import lime.project.Platform; @@ -384,15 +385,23 @@ class IOSPlatform extends PlatformTarget { { name : "Icon-76@2x.png", size : 152 }, { name : "Icon-60@3x.png", size : 180 }, ]; - + context.HAS_ICON = true; var iconPath = PathHelper.combine (projectDirectory, "Images.xcassets/AppIcon.appiconset"); PathHelper.mkdir (iconPath); + var icons = project.icons; + + if (icons.length == 0) { + + icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; + + } + for (iconSize in iconSizes) { - if (!IconHelper.createIcon (project.icons, iconSize.size, iconSize.size, PathHelper.combine (iconPath, iconSize.name))) { + if (!IconHelper.createIcon (icons, iconSize.size, iconSize.size, PathHelper.combine (iconPath, iconSize.name))) { context.HAS_ICON = false; diff --git a/lime/tools/platforms/MacPlatform.hx b/lime/tools/platforms/MacPlatform.hx index e107edf4c..8b7e8f916 100644 --- a/lime/tools/platforms/MacPlatform.hx +++ b/lime/tools/platforms/MacPlatform.hx @@ -19,6 +19,7 @@ import lime.project.AssetType; import lime.project.Architecture; import lime.project.Haxelib; import lime.project.HXProject; +import lime.project.Icon; import lime.project.Platform; import lime.project.PlatformTarget; import sys.io.File; @@ -317,7 +318,15 @@ class MacPlatform extends PlatformTarget { FileHelper.copyFileTemplate (project.templatePaths, "mac/Info.plist", targetDirectory + "/bin/" + project.app.file + ".app/Contents/Info.plist", context); FileHelper.copyFileTemplate (project.templatePaths, "mac/Entitlements.plist", targetDirectory + "/bin/" + project.app.file + ".app/Contents/Entitlements.plist", context); - context.HAS_ICON = IconHelper.createMacIcon (project.icons, PathHelper.combine (contentDirectory,"icon.icns")); + var icons = project.icons; + + if (icons.length == 0) { + + icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; + + } + + context.HAS_ICON = IconHelper.createMacIcon (icons, PathHelper.combine (contentDirectory, "icon.icns")); for (asset in project.assets) { diff --git a/lime/tools/platforms/TizenPlatform.hx b/lime/tools/platforms/TizenPlatform.hx index 8df063698..d51e47290 100644 --- a/lime/tools/platforms/TizenPlatform.hx +++ b/lime/tools/platforms/TizenPlatform.hx @@ -13,6 +13,7 @@ import lime.tools.helpers.ProcessHelper; import lime.tools.helpers.TizenHelper; import lime.project.AssetType; import lime.project.HXProject; +import lime.project.Icon; import lime.project.PlatformTarget; import sys.io.File; import sys.FileSystem; @@ -180,7 +181,15 @@ class TizenPlatform extends PlatformTarget { PathHelper.mkdir (destination + "shared/res/screen-density-xhigh"); - if (IconHelper.createIcon (project.icons, 117, 117, PathHelper.combine (destination + "shared/res/screen-density-xhigh", "mainmenu.png"))) { + var icons = project.icons; + + if (icons.length == 0) { + + icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; + + } + + if (IconHelper.createIcon (icons, 117, 117, PathHelper.combine (destination + "shared/res/screen-density-xhigh", "mainmenu.png"))) { context.APP_ICON = "mainmenu.png"; diff --git a/lime/tools/platforms/WebOSPlatform.hx b/lime/tools/platforms/WebOSPlatform.hx index 288b65829..7e857b496 100644 --- a/lime/tools/platforms/WebOSPlatform.hx +++ b/lime/tools/platforms/WebOSPlatform.hx @@ -13,6 +13,7 @@ import lime.tools.helpers.ProcessHelper; import lime.tools.helpers.WebOSHelper; import lime.project.AssetType; import lime.project.HXProject; +import lime.project.Icon; import lime.project.PlatformTarget; import sys.io.File; import sys.FileSystem; @@ -151,7 +152,15 @@ class WebOSPlatform extends PlatformTarget { var context = project.templateContext; context.CPP_DIR = targetDirectory + "/obj"; - if (IconHelper.createIcon (project.icons, 64, 64, PathHelper.combine (destination, "icon.png"))) { + var icons = project.icons; + + if (icons.length == 0) { + + icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; + + } + + if (IconHelper.createIcon (icons, 64, 64, PathHelper.combine (destination, "icon.png"))) { context.APP_ICON = "icon.png"; diff --git a/lime/tools/platforms/WindowsPlatform.hx b/lime/tools/platforms/WindowsPlatform.hx index 672fe1863..a0a3414c7 100644 --- a/lime/tools/platforms/WindowsPlatform.hx +++ b/lime/tools/platforms/WindowsPlatform.hx @@ -3,6 +3,7 @@ package lime.tools.platforms; import haxe.io.Path; import haxe.Template; +import lime.project.Icon; import lime.tools.helpers.AssetHelper; import lime.tools.helpers.CPPHelper; import lime.tools.helpers.DeploymentHelper; @@ -95,6 +96,14 @@ class WindowsPlatform extends PlatformTarget { } + var icons = project.icons; + + if (icons.length == 0) { + + icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; + + } + //IconHelper.createIcon (project.icons, 32, 32, PathHelper.combine (applicationDirectory, "icon.png")); if (targetType == "neko") { @@ -103,7 +112,7 @@ class WindowsPlatform extends PlatformTarget { var iconPath = PathHelper.combine (applicationDirectory, "icon.ico"); - if (!IconHelper.createWindowsIcon (project.icons, iconPath)) { + if (!IconHelper.createWindowsIcon (icons, iconPath)) { iconPath = null; @@ -150,7 +159,7 @@ class WindowsPlatform extends PlatformTarget { var iconPath = PathHelper.combine (applicationDirectory, "icon.ico"); - if (IconHelper.createWindowsIcon (project.icons, iconPath) && PlatformHelper.hostPlatform == WINDOWS) { + if (IconHelper.createWindowsIcon (icons, iconPath) && PlatformHelper.hostPlatform == WINDOWS) { var templates = [ PathHelper.getHaxelib (new Haxelib ("lime")) + "/templates" ].concat (project.templatePaths); ProcessHelper.runCommand ("", PathHelper.findTemplate (templates, "bin/ReplaceVistaIcon.exe"), [ executablePath, iconPath, "1" ], true, true); diff --git a/templates/project/Assets/lime.svg b/templates/default/icon.svg similarity index 98% rename from templates/project/Assets/lime.svg rename to templates/default/icon.svg index 0e20a1c77..98fa1766c 100644 --- a/templates/project/Assets/lime.svg +++ b/templates/default/icon.svg @@ -1,54 +1,54 @@ - - - - - - - - - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/templates/project/Assets/.gitignore b/templates/project/Assets/.gitignore new file mode 100644 index 000000000..e69de29bb diff --git a/templates/project/project.xml b/templates/project/project.xml index 9f63eddf0..d65fddc13 100644 --- a/templates/project/project.xml +++ b/templates/project/project.xml @@ -8,7 +8,6 @@ - - + \ No newline at end of file