From 88bd43c093e0280258fd36a584fad9d3786dacf1 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Mon, 2 Dec 2024 16:04:43 +0100 Subject: window icon --- build.bat | 7 +++++-- icon.ico | Bin 0 -> 3160 bytes icon.rc | 26 ++++++++++++++++++++++++++ icon.res | Bin 0 -> 4200 bytes project-base/src/windows/platform.c | 2 +- src/main.c | 5 +++++ 6 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 icon.ico create mode 100644 icon.rc create mode 100644 icon.res diff --git a/build.bat b/build.bat index adc4518..8302705 100644 --- a/build.bat +++ b/build.bat @@ -1,3 +1,6 @@ robocopy "data/" "build/data" /s /e -gcc.exe -m64 -w -g -DMODE_DEBUG src/main.c -o build/truckerx2.exe -Llibs/ -lSDL2 -lSDL2_mixer -call build\truckerx2.exe \ No newline at end of file + +windres icon.rc -O coff -o icon.res + +gcc.exe -m64 -w -g -DMODE_DEBUG src/main.c icon.res -o build/truckerx.exe -Llibs/ -lSDL2 -lSDL2_mixer -mwindows +call build\truckerx.exe \ No newline at end of file diff --git a/icon.ico b/icon.ico new file mode 100644 index 0000000..fdf6161 Binary files /dev/null and b/icon.ico differ diff --git a/icon.rc b/icon.rc new file mode 100644 index 0000000..20e33bb --- /dev/null +++ b/icon.rc @@ -0,0 +1,26 @@ + +101 ICON "icon.ico" + +1 VERSIONINFO +FILEVERSION 1,0,0,0 +PRODUCTVERSION 1,0,0,0 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "080904E4" + BEGIN + VALUE "CompanyName", "Aldrik Ramaekers" + VALUE "FileDescription", "TruckerX" + VALUE "FileVersion", "1.0.0" + VALUE "InternalName", "TruckerX" + VALUE "LegalCopyright", "Aldrik Ramaekers" + VALUE "OriginalFilename", "truckerX.exe" + VALUE "ProductName", "TruckerX" + VALUE "ProductVersion", "1.0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x809, 1252 + END +END diff --git a/icon.res b/icon.res new file mode 100644 index 0000000..20c5ef4 Binary files /dev/null and b/icon.res differ diff --git a/project-base/src/windows/platform.c b/project-base/src/windows/platform.c index 52bf1df..119e08e 100644 --- a/project-base/src/windows/platform.c +++ b/project-base/src/windows/platform.c @@ -930,7 +930,7 @@ platform_window* platform_open_window_ex(char *name, u16 width, u16 height, u16 window->window_class.lpfnWndProc = main_window_callback; window->window_class.hInstance = instance; window->window_class.lpszClassName = name; - window->window_class.hIcon = LoadIcon(NULL, IDI_WINLOGO); + window->window_class.hIcon = LoadIcon(instance, MAKEINTRESOURCE(101)); //window->window_class.hCursor = LoadCursor(NULL, IDC_ARROW); ATOM success = RegisterClass(&window->window_class); diff --git a/src/main.c b/src/main.c index 2a5e908..1b10c0a 100644 --- a/src/main.c +++ b/src/main.c @@ -137,6 +137,11 @@ void update_render_game(platform_window* window) update_music(); } +int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, char* ignore, int nShowCmd) +{ + return main(__argc, __argv); +} + int main(int argc, char** argv) { platform_init(argc, argv, CONFIG_DIRECTORY); -- cgit v1.2.3-70-g09d2