Fix icon packaging on Windows. (#42)

* Fix icon packaging on Windows.

* Add icon variants.
This commit is contained in:
Darío
2026-01-04 15:56:22 -03:00
committed by GitHub
parent dcb96a5b14
commit e4beb508d1
13 changed files with 23 additions and 9 deletions
+2 -2
View File
@@ -263,8 +263,8 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux")
# Generate icon_bytes.c from the app icon PNG.
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/icon_bytes.c ${CMAKE_CURRENT_BINARY_DIR}/icon_bytes.h
COMMAND file_to_c ${CMAKE_SOURCE_DIR}/icons/512.png icon_bytes ${CMAKE_CURRENT_BINARY_DIR}/icon_bytes.c ${CMAKE_CURRENT_BINARY_DIR}/icon_bytes.h
DEPENDS ${CMAKE_SOURCE_DIR}/icons/512.png
COMMAND file_to_c ${CMAKE_SOURCE_DIR}/icons/app.png icon_bytes ${CMAKE_CURRENT_BINARY_DIR}/icon_bytes.c ${CMAKE_CURRENT_BINARY_DIR}/icon_bytes.h
DEPENDS ${CMAKE_SOURCE_DIR}/icons/app.png
)
target_sources(BanjoRecompiled PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/icon_bytes.c)
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 753 B

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

+18
View File
@@ -0,0 +1,18 @@
When making icons for Windows, it is important to generate the multiple ICO files on different sizes and pack them into one single ICO file.
Using a tool such as `icomake` is recommended for this: https://github.com/tringi/icomake
The recommended workflow is to progressively downscale the icon into the following sizes and export them from a tool that supports exporting to ICO:
- 256.ico, 256x256
- 128.ico, 128x128
- 64.ico, 64x64
- 32.ico, 32x32
- 16.ico, 16x16
Once these are ready, `icomake` can pack these into one icon with the following command:
```
.\icomake.exe app.ico 16.ico 32.ico 64.ico 128.ico 256.ico
```
If done correctly, Windows will now pick the icon with the correct size on the title bar, the taskbar and as a shortcut.
View File

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

+2 -6
View File
@@ -1,6 +1,2 @@
1 ICON DISCARDABLE "512.ico"
2 ICON DISCARDABLE "256.ico"
3 ICON DISCARDABLE "128.ico"
4 ICON DISCARDABLE "64.ico"
5 ICON DISCARDABLE "32.ico"
6 ICON DISCARDABLE "16.ico"
APP_ICON_B ICON "appb.ico"
APP_ICON_K ICON "appk.ico"
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

+1 -1
View File
@@ -151,7 +151,7 @@ ultramodern::renderer::WindowHandle create_window(ultramodern::gfx_callbacks_t::
window = SDL_CreateWindow("Banjo: Recompiled", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1600, 960, flags);
#if defined(__linux__)
SetImageAsIcon("icons/512.png",window);
SetImageAsIcon("icons/app.png", window);
#endif
if (window == nullptr) {