You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/tutorials/building_2d_games/25_packaging_game/index.md
+58-30Lines changed: 58 additions & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -153,28 +153,34 @@ To create this structure, from the same terminal window:
153
153
> [!NOTE]
154
154
> The `mkdir -p`command creates directories including any necessary parent directories. The `-p` flag ensures all intermediate directories are created without error if they do not exist yet.
155
155
156
-
2. Combine the Intel (x64) and Apple Silicon (arm64) builds into a `universal binary`. To do this, execute the following commands:
156
+
2. Copy all files from the Intel (x64) build to the MacOS directory. This ensures all the required dependencies are included. To do this, execute the following command:
> The `lipo`command is a macOS utility that works with multi-architecture binaries. Here, it combines the Intel (x64) and Apple Silicon (arm64) executables into a single "universal binary" that can run natively on both Apple Silicon and Intel processor based Macs.
163
+
> This copies all files from the publish directory, including the executable, all dependent `.dll` files, and the `Content` directory that contains your game assets.
164
+
165
+
3. Replace the executable with a universal binary that works on both Intel and Apple Silicon Macs. To do this, execute the following command:
>Note, make sure to the change in folder from `net8.0` to `net9.0`ifit is appropriate.
172
+
>The `lipo`command is a macOS utility that works with multi-architecture binaries. Here, it combines the Intel (x64) and Apple Silicon (arm64) executables into a single "universal binary" that can run natively on both Apple Silicon and Intel processor based Macs.
167
173
168
-
3. Next, copy the your content files to the expected location within the application bundle structure. To do this, execute the following commands:
174
+
4. Move the Content directory from the MacOS directory to the Resources directory, following macOS application bundle conventions. To do this, execute the following command:
>The `cp -R`command copies files recursively, meaning it will copy the entire directory structure. The `-R` flag ensures all subdirectories and their contents are copied.
181
+
>This moves the `Content` directory to the expected location forresourcesin a macOS application bundles.
176
182
177
-
4. Create a new file called `Info.plist`in the `Contents` directory of the application bundle with the following command:
183
+
5. Create a new file called *Info.plist*in the *Contents* directory of the application bundle with the following command:
@@ -183,7 +189,7 @@ To create this structure, from the same terminal window:
183
189
> [!NOTE]
184
190
> The `touch`command creates an empty file if it does not exist or updates the modification timeif it does exist. We are using it here to create a blank file that we will populate with content in the next step.
185
191
186
-
5. Open the `Info.plist` file you just created in a text editor and add the following content to the file and save it.
192
+
6. Open the *Info.plist* file you just created in a text editor and add the following content to the file and save it.
@@ -209,30 +215,52 @@ To create this structure, from the same terminal window:
209
215
>
210
216
> For more information on the `Info.plist` manifest file, refer to the [About Info.plist Keys and Values](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html) Apple Developer documentation.
211
217
212
-
6. Next, create the application bundle `.icns` icon file. To do this, execute the following commands:
7. Next, create the application bundle *.icns* icon file. To do this, perform the following:
228
220
229
-
> [!NOTE]
230
-
> These commands create a macOS icon file (`.icns`) with multiple resolutions:
231
-
> - `sips` (Scriptable Image Processing System) resizes the source image to create different icon sizes.
232
-
> - Each size is necessary fordifferent display scenariosin macOS (Dock, Finder, etc.).
233
-
> - The `iconutil`commandthen compiles these images into a single `.icns` file that macOS recognizes as an application icon.
221
+
1. First, you will need a `.png` file that can be used to create the icon setforthe final `.icns` output. If you already have a `.png` icon for your game, ensure it isin 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:
222
+
223
+
```sh
224
+
sips -s format png Icon.bmp --out Icon.png
225
+
```
226
+
227
+
> [!NOTE]
228
+
>`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.
229
+
230
+
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:
231
+
232
+
```sh
233
+
mkdir -p bin/Release/DungeonSlime.iconset
234
+
```
235
+
236
+
3. Now we use the `sips`command to generate the icon foreach size required for a mac app bundle. Each size generated is neccessary for different display scenariosin macOS (Dock, Finder, etc.). To do this, execute the following commands:
>`iconutil` is a command line tool in macOS used to convert icon sets into a single high-resolution `.icns` file.
259
+
260
+
> [!TIP]
261
+
> After creating the `.icns` file using the above command, if you open the folder in Finder with `DungeonSlime.app` and it shows a blank square as the icon instead of the one you just created, right-click on `DungeonSlime.app` and choose `Get Info` from the context menu. This will force it to do a refresh and show the icon properly. After doing this, if the icon still does not show, then you need to double check that the `CFBundleIconFile` value in the `Info.plist` is named **exactly** the same as the `.icns` file that was created (minus the extension).
234
262
235
-
7. Set executable permissions for the game executable. To do this, execute the following command:
263
+
8. Set executable permissions for the game executable. To do this, execute the following command:
0 commit comments