Skip to content

Commit b8ce61e

Browse files
committed
Inform reader that the icon must be a .png and if they don't have one, provides a command to use to convert the MonoGame Icon.bmp provided in the project to a png first to use
1 parent 20a7e43 commit b8ce61e

File tree

1 file changed

+37
-19
lines changed
  • articles/tutorials/building_2d_games/25_packaging_game

1 file changed

+37
-19
lines changed

articles/tutorials/building_2d_games/25_packaging_game/index.md

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -209,26 +209,44 @@ To create this structure, from the same terminal window:
209209

210210
7. Next, create the application bundle *.icns* icon file. To do this, perform the following:
211211

212-
```sh
213-
mkdir -p bin/Release/DungeonSlime.iconset
214-
sips -z 16 16 Icon.png --out bin/Release/DungeonSlime.iconset/icon_16x16.png
215-
sips -z 32 32 Icon.png --out bin/Release/DungeonSlime.iconset/icon_16x16@2x.png
216-
sips -z 32 32 Icon.png --out bin/Release/DungeonSlime.iconset/icon_32x32.png
217-
sips -z 64 64 Icon.png --out bin/Release/DungeonSlime.iconset/icon_32x32@2x.png
218-
sips -z 128 128 Icon.png --out bin/Release/DungeonSlime.iconset/icon_128x128.png
219-
sips -z 256 256 Icon.png --out bin/Release/DungeonSlime.iconset/icon_128x128@2x.png
220-
sips -z 256 256 Icon.png --out bin/Release/DungeonSlime.iconset/icon_256x256.png
221-
sips -z 512 512 Icon.png --out bin/Release/DungeonSlime.iconset/icon_256x256@2x.png
222-
sips -z 512 512 Icon.png --out bin/Release/DungeonSlime.iconset/icon_512x512.png
223-
sips -z 1024 1024 Icon.png --out bin/Release/DungeonSlime.iconset/icon_512x512@2x.png
224-
iconutil -c icns bin/Release/DungeonSlime.iconset --output bin/Release/DungeonSlime.app/Contents/Resources/DungeonSlime.icns
225-
```
212+
1. First, you will need a `.png` file that can be used to create the icon set for the final `.icns` output. If you already have a `.png` icon for your game, ensure it is in the root of the main project directory and is named `Icon.png`. If you do not have one already prepared, you can use the `Icon.bmp` that was generated in the root of the main project directory when you initially created the project. However, it will need to be converted to a `.png` first. To do this, execute the following command:
226213

227-
> [!NOTE]
228-
> These commands create a macOS icon file (*.icns*) with multiple resolutions:
229-
> - `sips` (Scriptable Image Processing System) resizes the source image to create different icon sizes.
230-
> - Each size is necessary for different display scenarios in macOS (Dock, Finder, etc.).
231-
> - The `iconutil` command then compiles these images into a single *.icns* file that macOS recognizes as an application icon.
214+
```sh
215+
sips -s format png Icon.bmp --out Icon.png
216+
```
217+
218+
> [!NOTE]
219+
> `sips` (Scriptable Image Processing System) is a command line tool in macOS for image manipulation. Here we are using it to convert a `.bmp` to a `.png`. In a moment, we will also use it to resize the `.png` into different icon sizes required for the application bundle.
220+
221+
2. Next, create a directory that we can output each of the generated `.png` icon files to for the icon set. Execute the following command:
222+
223+
```sh
224+
mkdir -p bin/Release/DungeonSlime.iconset
225+
```
226+
227+
3. Now we use the `sips` command to generate the icon for each size required for a mac app bundle. Each size generated is neccessary for different display scenarios in macOS (Dock, Finder, etc.). To do this, execute the following commands:
228+
229+
```sh
230+
sips -z 16 16 Icon.png --out bin/Release/DungeonSlime.iconset/icon_16x16.png
231+
sips -z 32 32 Icon.png --out bin/Release/DungeonSlime.iconset/icon_16x16@2x.png
232+
sips -z 32 32 Icon.png --out bin/Release/DungeonSlime.iconset/icon_32x32.png
233+
sips -z 64 64 Icon.png --out bin/Release/DungeonSlime.iconset/icon_32x32@2x.png
234+
sips -z 128 128 Icon.png --out bin/Release/DungeonSlime.iconset/icon_128x128.png
235+
sips -z 256 256 Icon.png --out bin/Release/DungeonSlime.iconset/icon_128x128@2x.png
236+
sips -z 256 256 Icon.png --out bin/Release/DungeonSlime.iconset/icon_256x256.png
237+
sips -z 512 512 Icon.png --out bin/Release/DungeonSlime.iconset/icon_256x256@2x.png
238+
sips -z 512 512 Icon.png --out bin/Release/DungeonSlime.iconset/icon_512x512.png
239+
sips -z 1024 1024 Icon.png --out bin/Release/DungeonSlime.iconset/icon_512x512@2x.png
240+
```
241+
242+
4. Finally, combine all of the generated icons for the icon set into a `.icns` file. To do this, execute the following:
243+
244+
```sh
245+
iconutil -c icns bin/Release/DungeonSlime.iconset --output bin/Release/DungeonSlime.app/Contents/Resources/DungeonSlime.icns
246+
```
247+
248+
> [!NOTE]
249+
> `iconutil` is a command line tool in macOS used to convert icon sets into a single high-resolution `.icns` file.
232250

233251
8. Set executable permissions for the game executable. To do this, execute the following command:
234252

0 commit comments

Comments
 (0)