diff --git a/docs/ROADMAP.en.md b/docs/ROADMAP.en.md index 03d8ac4..685272c 100644 --- a/docs/ROADMAP.en.md +++ b/docs/ROADMAP.en.md @@ -45,7 +45,7 @@ INTRO.EXE stays local (`build/`). Mods replace files at runtime, never touching does not pass it on - [x] **Widescreen without black bars**: sides filled with a blurred background or an illustration - [ ] **Upscaled FLC cutscenes** -- [ ] Game icon: `tucker.exe` (`assets/icon/dtr.rc` resource compiled with `rc` in `build.bat`) and +- [x] Game icon: `tucker.exe` (`assets/icon/dtr.rc` resource compiled with `rc` in `build.bat`) and window (`SDL_SetWindowIcon` with `assets/icon/dtr-256.png`). The launcher already has it ## 2. Sound diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md index 39fff54..7582277 100644 --- a/docs/ROADMAP.md +++ b/docs/ROADMAP.md @@ -48,7 +48,7 @@ jamais modifier les originaux. - [x] **Écran large sans bandes noires** : bords remplis par le décor flouté ou une illustration - [ ] **Cinématiques FLC agrandies** - [ ] Police HD pour les textes et les sous-titres -- [ ] Icône du jeu : `tucker.exe` (ressource `assets/icon/dtr.rc` compilée avec `rc` dans `build.bat`) +- [x] Icône du jeu : `tucker.exe` (ressource `assets/icon/dtr.rc` compilée avec `rc` dans `build.bat`) et fenêtre (`SDL_SetWindowIcon` avec `assets/icon/dtr-256.png`). Le launcher l'a déjà ## 2. Son diff --git a/runtime/host_sdl.c b/runtime/host_sdl.c index 0d07893..e8609ab 100644 --- a/runtime/host_sdl.c +++ b/runtime/host_sdl.c @@ -248,6 +248,29 @@ static int is_dir(const char *p) { return stat(p, &st) == 0 && (st.st_mode & S_IFDIR); } +/* icône de la fenêtre (barre de titre, Alt+Tab, Linux) : dtr-256.png à côté de l'exécutable, ou assets/icon/ du + * dépôt depuis build\. Sous Windows, sans ce fichier, la fenêtre garde l'icône compilée dans tucker.exe. */ +static void set_window_icon(void) { + char *base = SDL_GetBasePath(); + char path[700]; + int i, w, h; + uint32_t *img = NULL; + if (!base) return; + for (i = 0; i < 3 && !img; i++) { + char sep = base[strlen(base) - 1]; + if (i == 0) snprintf(path, sizeof path, "%sdtr-256.png", base); + else if (i == 1) snprintf(path, sizeof path, "%sassets%cicon%cdtr-256.png", base, sep, sep); + else snprintf(path, sizeof path, "%s..%cassets%cicon%cdtr-256.png", base, sep, sep, sep); + img = png_load(path, &w, &h, NULL); + } + SDL_free(base); + if (img) { + SDL_Surface *s = SDL_CreateRGBSurfaceWithFormatFrom(img, w, h, 32, w * 4, SDL_PIXELFORMAT_ARGB8888); + if (s) { SDL_SetWindowIcon(win, s); SDL_FreeSurface(s); } + free(img); + } +} + /* dossier des mods : réglage mods.dir, sinon « mods » à côté de l'exécutable (ou du dossier build\), sinon ./mods */ static void init_mods(void) { char dir[600]; @@ -334,6 +357,7 @@ int host_init(int argc, char **argv) { win = SDL_CreateWindow("Bud Tucker in Double Trouble (recomp) — F12 : réglages", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, w, h, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); } + if (win) set_window_icon(); glctx = win ? SDL_GL_CreateContext(win) : NULL; if (!glctx) { fprintf(stderr, "OpenGL 3.3 indisponible : %s\n", SDL_GetError()); return 0; } if (!gfx_init()) { fprintf(stderr, "initialisation du rendu OpenGL impossible\n"); return 0; }