Update application icon and add dynamic icon loading

This commit is contained in:
2026-05-26 23:37:50 +03:00
parent fac5b95a82
commit 6c8fa690d3
8 changed files with 16 additions and 7 deletions
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

+1
View File
@@ -68,6 +68,7 @@ struct GameContext {
// Asset loading helpers // Asset loading helpers
Texture2D LoadTextureFromResource(int id); Texture2D LoadTextureFromResource(int id);
Sound LoadSoundFromResource(int id); Sound LoadSoundFromResource(int id);
void SetWindowIconFromResource(int id);
// Forward declarations // Forward declarations
class Ball; class Ball;
+1 -2
View File
@@ -152,14 +152,13 @@
<ResourceCompile Include="resources.rc" /> <ResourceCompile Include="resources.rc" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Image Include="assets\icon.ico" />
<Image Include="assets\textures\ball\basic_ball_5.png" /> <Image Include="assets\textures\ball\basic_ball_5.png" />
<Image Include="assets\textures\hud\line.png" /> <Image Include="assets\textures\hud\line.png" />
<Image Include="assets\textures\paddles\basic_paddle.png" /> <Image Include="assets\textures\paddles\basic_paddle.png" />
<Image Include="assets\textures\paddles\basic_paddle_2.png" /> <Image Include="assets\textures\paddles\basic_paddle_2.png" />
<Image Include="assets\textures\spaces\basic_space.png" /> <Image Include="assets\textures\spaces\basic_space.png" />
<Image Include="assets\textures\spaces\walls.png" /> <Image Include="assets\textures\spaces\walls.png" />
<Image Include="icon.ico" />
<Image Include="icon.jpg" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="assets\audio\banana_wall_hit.ogg" /> <None Include="assets\audio\banana_wall_hit.ogg" />
+1 -4
View File
@@ -79,10 +79,7 @@
<Image Include="assets\textures\spaces\walls.png"> <Image Include="assets\textures\spaces\walls.png">
<Filter>Resource Files\textures</Filter> <Filter>Resource Files\textures</Filter>
</Image> </Image>
<Image Include="icon.ico"> <Image Include="assets\icon.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="icon.jpg">
<Filter>Resource Files</Filter> <Filter>Resource Files</Filter>
</Image> </Image>
</ItemGroup> </ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
#include "include/resource.h" #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_BASIC_SPACE RCDATA "assets/textures/spaces/basic_space.png"
IDR_TEX_WALLS RCDATA "assets/textures/spaces/walls.png" IDR_TEX_WALLS RCDATA "assets/textures/spaces/walls.png"
+1
View File
@@ -19,6 +19,7 @@ int main() {
SetTraceLogCallback(CustomLogCallback); SetTraceLogCallback(CustomLogCallback);
InitWindow(screen_width, screen_height, "Pong Reloaded"); InitWindow(screen_width, screen_height, "Pong Reloaded");
SetWindowIconFromResource(IDI_ICON1);
SetTargetFPS(60); SetTargetFPS(60);
InitAudioDevice(); InitAudioDevice();
+11
View File
@@ -50,3 +50,14 @@ Sound LoadSoundFromResource(int id) {
UnloadWave(wave); UnloadWave(wave);
return sound; 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);
}
}