From 178029317ada09813a2ef250a35e19944a9a36c5 Mon Sep 17 00:00:00 2001 From: Martin Jonasson Date: Fri, 9 Jan 2015 13:21:37 +0100 Subject: [PATCH] Adds all icon sizes wanted by XCode --- .../AppIcon.appiconset/Contents.json | 99 +++++++++++-------- tools/platforms/IOSPlatform.hx | 28 +++++- 2 files changed, 80 insertions(+), 47 deletions(-) diff --git a/legacy/templates/iphone/PROJ/Images.xcassets/AppIcon.appiconset/Contents.json b/legacy/templates/iphone/PROJ/Images.xcassets/AppIcon.appiconset/Contents.json index c1e76a009..8ba31b764 100644 --- a/legacy/templates/iphone/PROJ/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/legacy/templates/iphone/PROJ/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,9 +1,22 @@ { "images" : [ { + "size" : "29x29", "idiom" : "iphone", - "scale" : "1x", - "size" : "29x29" + "filename" : "Icon-Small.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-Small@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-Small-40@2x.png", + "scale" : "2x" }, { "size" : "57x57", @@ -23,6 +36,48 @@ "filename" : "Icon-60@2x.png", "scale" : "2x" }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-60@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-Small.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-Small@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-Small-40.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-Small-40@2x.png", + "scale" : "2x" + }, + { + "size" : "50x50", + "idiom" : "ipad", + "filename" : "Icon-Small-50.png", + "scale" : "1x" + }, + { + "size" : "50x50", + "idiom" : "ipad", + "filename" : "Icon-Small-50@2x.png", + "scale" : "2x" + }, { "size" : "72x72", "idiom" : "ipad", @@ -46,46 +101,6 @@ "idiom" : "ipad", "filename" : "Icon-76@2x.png", "scale" : "2x" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "29x29" - }, - { - "idiom" : "iphone", - "scale" : "2x", - "size" : "40x40" - }, - { - "idiom" : "ipad", - "scale" : "1x", - "size" : "50x50" - }, - { - "idiom" : "ipad", - "scale" : "2x", - "size" : "50x50" - }, - { - "idiom" : "ipad", - "scale" : "1x", - "size" : "40x40" - }, - { - "idiom" : "ipad", - "scale" : "2x", - "size" : "40x40" - }, - { - "idiom" : "ipad", - "scale" : "1x", - "size" : "29x29" - }, - { - "idiom" : "ipad", - "scale" : "2x", - "size" : "29x29" } ], "info" : { diff --git a/tools/platforms/IOSPlatform.hx b/tools/platforms/IOSPlatform.hx index 079f36582..40369f8af 100644 --- a/tools/platforms/IOSPlatform.hx +++ b/tools/platforms/IOSPlatform.hx @@ -28,6 +28,10 @@ import project.PlatformTarget; import sys.io.File; import sys.FileSystem; +private typedef IconSize = { + name:String, + size:Int, +} class IOSPlatform extends PlatformTarget { @@ -360,17 +364,31 @@ class IOSPlatform extends PlatformTarget { PathHelper.mkdir (projectDirectory + "/haxe"); PathHelper.mkdir (projectDirectory + "/haxe/lime/installer"); - var iconNames = [ "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png" ]; - var iconSizes = [ 57, 114, 60, 120, 72, 144, 76, 152 ]; - + var iconSizes:Array = [ + { name : "Icon-Small.png", size : 29 }, + { name : "Icon-Small-40.png", size : 40 }, + { name : "Icon-Small-50.png", size : 50 }, + { name : "Icon.png", size : 57 }, + { name : "Icon-Small@2x.png", size : 58 }, + { name : "Icon-72.png", size : 72 }, + { name : "Icon-76.png", size : 76 }, + { name : "Icon-Small-40@2x.png", size : 80 }, + { name : "Icon-Small-50@2x.png", size : 100 }, + { name : "Icon@2x.png", size : 114 }, + { name : "Icon-60@2x.png", size : 120 }, + { name : "Icon-72@2x.png", size : 144 }, + { 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); - for (i in 0...iconNames.length) { + for (iconSize in iconSizes) { - if (!IconHelper.createIcon (project.icons, iconSizes[i], iconSizes[i], PathHelper.combine (iconPath, iconNames[i]))) { + if (!IconHelper.createIcon (project.icons, iconSize.size, iconSize.size, PathHelper.combine (iconPath, iconSize.name))) { context.HAS_ICON = false;