Add Windows app icon resource & load it

Add Windows resource files and load the app icon in the window class. Introduce resources/nebula.rc and resources/resource.h (defines IDI_APPICON referencing assets/images/branding/Nebula-Favicon.ico). Include resource.h in nebula_window_win.cpp and set window_class.hIcon/hIconSm via LoadImageW. Update CMakeLists.txt to compile the .rc and add the resources include directory for Windows.
This commit is contained in:
Andrew Zambazos
2026-07-12 19:42:06 +12:00
parent 76b942542a
commit 487c5fc1ae
4 changed files with 25 additions and 0 deletions
+15
View File
@@ -7,6 +7,7 @@
#include <algorithm>
#include <string_view>
#include "resource.h"
#include "ui/paths.h"
namespace nebula::window {
@@ -426,6 +427,20 @@ void nebula::window::NebulaWindowImpl::RegisterClass(HINSTANCE instance_handle)
window_class.lpfnWndProc = StaticWndProc;
window_class.hInstance = instance_handle;
window_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
window_class.hIcon = static_cast<HICON>(LoadImageW(
instance_handle,
MAKEINTRESOURCEW(IDI_APPICON),
IMAGE_ICON,
GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON),
LR_DEFAULTCOLOR));
window_class.hIconSm = static_cast<HICON>(LoadImageW(
instance_handle,
MAKEINTRESOURCEW(IDI_APPICON),
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
LR_DEFAULTCOLOR));
window_class.lpszClassName = WindowClassName();
RegisterClassExW(&window_class);