Update application icon and add dynamic icon loading
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -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;
|
||||
|
||||
@@ -152,14 +152,13 @@
|
||||
<ResourceCompile Include="resources.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="assets\icon.ico" />
|
||||
<Image Include="assets\textures\ball\basic_ball_5.png" />
|
||||
<Image Include="assets\textures\hud\line.png" />
|
||||
<Image Include="assets\textures\paddles\basic_paddle.png" />
|
||||
<Image Include="assets\textures\paddles\basic_paddle_2.png" />
|
||||
<Image Include="assets\textures\spaces\basic_space.png" />
|
||||
<Image Include="assets\textures\spaces\walls.png" />
|
||||
<Image Include="icon.ico" />
|
||||
<Image Include="icon.jpg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="assets\audio\banana_wall_hit.ogg" />
|
||||
|
||||
@@ -79,10 +79,7 @@
|
||||
<Image Include="assets\textures\spaces\walls.png">
|
||||
<Filter>Resource Files\textures</Filter>
|
||||
</Image>
|
||||
<Image Include="icon.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="icon.jpg">
|
||||
<Image Include="assets\icon.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
@@ -19,6 +19,7 @@ int main() {
|
||||
|
||||
SetTraceLogCallback(CustomLogCallback);
|
||||
InitWindow(screen_width, screen_height, "Pong Reloaded");
|
||||
SetWindowIconFromResource(IDI_ICON1);
|
||||
SetTargetFPS(60);
|
||||
InitAudioDevice();
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user