diff --git a/assets/icon.ico b/assets/icon.ico new file mode 100644 index 0000000..4aaf26c Binary files /dev/null and b/assets/icon.ico differ diff --git a/icon.ico b/icon.ico deleted file mode 100644 index 1aded3f..0000000 Binary files a/icon.ico and /dev/null differ diff --git a/include/game.h b/include/game.h index 1938abe..b2b7404 100644 --- a/include/game.h +++ b/include/game.h @@ -68,6 +68,7 @@ struct GameContext { // Asset loading helpers Texture2D LoadTextureFromResource(int id); Sound LoadSoundFromResource(int id); +void SetWindowIconFromResource(int id); // Forward declarations class Ball; diff --git a/pong-reloaded.vcxproj b/pong-reloaded.vcxproj index 3db9ee7..654348a 100644 --- a/pong-reloaded.vcxproj +++ b/pong-reloaded.vcxproj @@ -152,14 +152,13 @@ + - - diff --git a/pong-reloaded.vcxproj.filters b/pong-reloaded.vcxproj.filters index 2eadd4e..1c928b6 100644 --- a/pong-reloaded.vcxproj.filters +++ b/pong-reloaded.vcxproj.filters @@ -79,10 +79,7 @@ Resource Files\textures - - Resource Files - - + Resource Files diff --git a/resources.rc b/resources.rc index 896ecd1..8d0b9cc 100644 --- a/resources.rc +++ b/resources.rc @@ -1,6 +1,6 @@ #include "include/resource.h" -IDI_ICON1 ICON "icon.ico" +IDI_ICON1 ICON "assets/icon.ico" IDR_TEX_BASIC_SPACE RCDATA "assets/textures/spaces/basic_space.png" IDR_TEX_WALLS RCDATA "assets/textures/spaces/walls.png" diff --git a/src/main.cpp b/src/main.cpp index 1ee993a..724a890 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,6 +19,7 @@ int main() { SetTraceLogCallback(CustomLogCallback); InitWindow(screen_width, screen_height, "Pong Reloaded"); + SetWindowIconFromResource(IDI_ICON1); SetTargetFPS(60); InitAudioDevice(); diff --git a/src/resource_loader.cpp b/src/resource_loader.cpp index 94e78b9..1799972 100644 --- a/src/resource_loader.cpp +++ b/src/resource_loader.cpp @@ -50,3 +50,14 @@ Sound LoadSoundFromResource(int id) { UnloadWave(wave); return sound; } + +void SetWindowIconFromResource(int id) { + HWND hwnd = (HWND)GetWindowHandle(); + if (!hwnd) return; + + HICON hIcon = LoadIconA(GetModuleHandle(NULL), MAKEINTRESOURCEA(id)); + if (hIcon) { + SendMessageA(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIcon); + SendMessageA(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); + } +}