diff --git a/CMakeLists.txt b/CMakeLists.txt index e899011..ed8c343 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,7 @@ if(OS_WINDOWS) src/platform/win/startup_win.cpp src/platform/win/browser_host_win.cpp src/platform/win/nebula_window_win.cpp + resources/nebula.rc ) elseif(OS_MACOSX) set(NEBULA_PLATFORM_SOURCES @@ -156,6 +157,9 @@ function(add_nebula_app_target nebula_target entry_source) if(OS_WINDOWS) target_link_libraries(${nebula_target} PRIVATE dwmapi) + target_include_directories(${nebula_target} PRIVATE + "${CMAKE_SOURCE_DIR}/resources" + ) target_compile_definitions(${nebula_target} PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN diff --git a/resources/nebula.rc b/resources/nebula.rc new file mode 100644 index 0000000..d54b912 --- /dev/null +++ b/resources/nebula.rc @@ -0,0 +1,3 @@ +#include "resource.h" + +IDI_APPICON ICON "..\\assets\\images\\branding\\Nebula-Favicon.ico" diff --git a/resources/resource.h b/resources/resource.h new file mode 100644 index 0000000..7737cfe --- /dev/null +++ b/resources/resource.h @@ -0,0 +1,3 @@ +#pragma once + +#define IDI_APPICON 1 diff --git a/src/platform/win/nebula_window_win.cpp b/src/platform/win/nebula_window_win.cpp index dbe4d09..29190aa 100644 --- a/src/platform/win/nebula_window_win.cpp +++ b/src/platform/win/nebula_window_win.cpp @@ -7,6 +7,7 @@ #include #include +#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(LoadImageW( + instance_handle, + MAKEINTRESOURCEW(IDI_APPICON), + IMAGE_ICON, + GetSystemMetrics(SM_CXICON), + GetSystemMetrics(SM_CYICON), + LR_DEFAULTCOLOR)); + window_class.hIconSm = static_cast(LoadImageW( + instance_handle, + MAKEINTRESOURCEW(IDI_APPICON), + IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), + LR_DEFAULTCOLOR)); window_class.lpszClassName = WindowClassName(); RegisterClassExW(&window_class);