diff --git a/CLAUDE.md b/CLAUDE.md index 4ba99eb..00aa4c0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -84,19 +84,14 @@ Pipeline SDL3 GPU portat de `coffee_crisis_arcade_edition`. El canvas 256×192 e - `videoGpuPreferredDriver` (string, buit = auto) - `videoShaderEnabled` (bool) - `videoShaderType` (0=POSTFX, 1=CRTPI) -- **Hotkeys** (provisionals fins que hi hagi menú d'opcions): `F4` activa/desactiva post-procesado · `F5` alterna POSTFX ↔ CRTPI (només si està actiu) · `F6` següent preset (només si està actiu) · `F7` següent skin. No hi ha tecla per a preset anterior. +- **Hotkeys** (provisionals fins que hi hagi menú d'opcions): `F4` activa/desactiva post-procesado · `F5` alterna POSTFX ↔ CRTPI (només si està actiu) · `F6` següent preset (només si està actiu). No hi ha tecla per a preset anterior. - **API** a `Screen`: `setGpuAcceleration`/`toggleGpuAcceleration`/`isGpuAccelerated`, `setShaderEnabled`/`toggleShaderEnabled`/`isShaderEnabled`, `setActiveShader`/`toggleActiveShader`/`getActiveShader`. Presets PostFX/CrtPi i cicle de presets encara **no** estan implementats — arribaran amb la migració a YAML. Per ara, valors per defecte hardcoded. -### Skins - -Els gràfics viuen sota `data/skins//gfx/`. Cada skin té un `skin.yaml` (id, display_name, gfx_dir). `SkinManager` (`core/resources/skin_manager.*`) escaneja manifests al boot, recorda l'skin activa (`Options::settings.skin`) i composa paths per a `Asset::addSkinAware()`. El canvi en calent (F7) és lliure: `Resource::reloadForSkin()` recorre el cache de Texture* i .ani fent `reLoadFromPath`/re-parse, mantenint stable pointer identity perquè els Sprites no s'invaliden. Les skins han de mantenir paritat de basenames i dimensions (recoloreds purs). De moment només es varia el contingut gràfic; logo, fades i altres comportaments són comuns. - ## Data Directory -- `data/skins//gfx/` — PNG spritesheets and `.ani` animation definition files per skin (`classic`, `nes`, ...) -- `data/skins//skin.yaml` — manifest de la skin (id, display_name, gfx_dir) +- `data/gfx/` — PNG spritesheets and `.ani` animation definition files - `data/font/` — bitmap font files - `data/music/` and `data/sound/` — audio assets - `data/lang/` — language files (es_ES, ba_BA, en_UK) diff --git a/data/skins/classic/gfx/balloon1.ani b/data/gfx/balloon1.ani similarity index 100% rename from data/skins/classic/gfx/balloon1.ani rename to data/gfx/balloon1.ani diff --git a/data/skins/classic/gfx/balloon1.png b/data/gfx/balloon1.png similarity index 100% rename from data/skins/classic/gfx/balloon1.png rename to data/gfx/balloon1.png diff --git a/data/skins/classic/gfx/balloon2.ani b/data/gfx/balloon2.ani similarity index 100% rename from data/skins/classic/gfx/balloon2.ani rename to data/gfx/balloon2.ani diff --git a/data/skins/classic/gfx/balloon2.png b/data/gfx/balloon2.png similarity index 100% rename from data/skins/classic/gfx/balloon2.png rename to data/gfx/balloon2.png diff --git a/data/skins/classic/gfx/balloon3.ani b/data/gfx/balloon3.ani similarity index 100% rename from data/skins/classic/gfx/balloon3.ani rename to data/gfx/balloon3.ani diff --git a/data/skins/classic/gfx/balloon3.png b/data/gfx/balloon3.png similarity index 100% rename from data/skins/classic/gfx/balloon3.png rename to data/gfx/balloon3.png diff --git a/data/skins/classic/gfx/balloon4.ani b/data/gfx/balloon4.ani similarity index 100% rename from data/skins/classic/gfx/balloon4.ani rename to data/gfx/balloon4.ani diff --git a/data/skins/classic/gfx/balloon4.png b/data/gfx/balloon4.png similarity index 100% rename from data/skins/classic/gfx/balloon4.png rename to data/gfx/balloon4.png diff --git a/data/skins/classic/gfx/bullet.png b/data/gfx/bullet.png similarity index 100% rename from data/skins/classic/gfx/bullet.png rename to data/gfx/bullet.png diff --git a/data/skins/classic/gfx/game_buildings.png b/data/gfx/game_buildings.png similarity index 100% rename from data/skins/classic/gfx/game_buildings.png rename to data/gfx/game_buildings.png diff --git a/data/skins/classic/gfx/game_clouds.png b/data/gfx/game_clouds.png similarity index 100% rename from data/skins/classic/gfx/game_clouds.png rename to data/gfx/game_clouds.png diff --git a/data/skins/classic/gfx/game_grass.png b/data/gfx/game_grass.png similarity index 100% rename from data/skins/classic/gfx/game_grass.png rename to data/gfx/game_grass.png diff --git a/data/skins/classic/gfx/game_power_meter.png b/data/gfx/game_power_meter.png similarity index 100% rename from data/skins/classic/gfx/game_power_meter.png rename to data/gfx/game_power_meter.png diff --git a/data/skins/classic/gfx/game_sky_colors.png b/data/gfx/game_sky_colors.png similarity index 100% rename from data/skins/classic/gfx/game_sky_colors.png rename to data/gfx/game_sky_colors.png diff --git a/data/skins/classic/gfx/game_text.png b/data/gfx/game_text.png similarity index 100% rename from data/skins/classic/gfx/game_text.png rename to data/gfx/game_text.png diff --git a/data/skins/classic/gfx/intro.png b/data/gfx/intro.png similarity index 100% rename from data/skins/classic/gfx/intro.png rename to data/gfx/intro.png diff --git a/data/skins/classic/gfx/item_clock.ani b/data/gfx/item_clock.ani similarity index 100% rename from data/skins/classic/gfx/item_clock.ani rename to data/gfx/item_clock.ani diff --git a/data/skins/classic/gfx/item_clock.png b/data/gfx/item_clock.png similarity index 100% rename from data/skins/classic/gfx/item_clock.png rename to data/gfx/item_clock.png diff --git a/data/skins/classic/gfx/item_coffee.ani b/data/gfx/item_coffee.ani similarity index 100% rename from data/skins/classic/gfx/item_coffee.ani rename to data/gfx/item_coffee.ani diff --git a/data/skins/classic/gfx/item_coffee.png b/data/gfx/item_coffee.png similarity index 100% rename from data/skins/classic/gfx/item_coffee.png rename to data/gfx/item_coffee.png diff --git a/data/skins/classic/gfx/item_coffee_machine.ani b/data/gfx/item_coffee_machine.ani similarity index 100% rename from data/skins/classic/gfx/item_coffee_machine.ani rename to data/gfx/item_coffee_machine.ani diff --git a/data/skins/classic/gfx/item_coffee_machine.png b/data/gfx/item_coffee_machine.png similarity index 100% rename from data/skins/classic/gfx/item_coffee_machine.png rename to data/gfx/item_coffee_machine.png diff --git a/data/skins/classic/gfx/item_points1_disk.ani b/data/gfx/item_points1_disk.ani similarity index 100% rename from data/skins/classic/gfx/item_points1_disk.ani rename to data/gfx/item_points1_disk.ani diff --git a/data/skins/classic/gfx/item_points1_disk.png b/data/gfx/item_points1_disk.png similarity index 100% rename from data/skins/classic/gfx/item_points1_disk.png rename to data/gfx/item_points1_disk.png diff --git a/data/skins/classic/gfx/item_points2_gavina.ani b/data/gfx/item_points2_gavina.ani similarity index 100% rename from data/skins/classic/gfx/item_points2_gavina.ani rename to data/gfx/item_points2_gavina.ani diff --git a/data/skins/classic/gfx/item_points2_gavina.png b/data/gfx/item_points2_gavina.png similarity index 100% rename from data/skins/classic/gfx/item_points2_gavina.png rename to data/gfx/item_points2_gavina.png diff --git a/data/skins/classic/gfx/item_points3_pacmar.ani b/data/gfx/item_points3_pacmar.ani similarity index 100% rename from data/skins/classic/gfx/item_points3_pacmar.ani rename to data/gfx/item_points3_pacmar.ani diff --git a/data/skins/classic/gfx/item_points3_pacmar.png b/data/gfx/item_points3_pacmar.png similarity index 100% rename from data/skins/classic/gfx/item_points3_pacmar.png rename to data/gfx/item_points3_pacmar.png diff --git a/data/skins/classic/gfx/logo.png b/data/gfx/logo.png similarity index 100% rename from data/skins/classic/gfx/logo.png rename to data/gfx/logo.png diff --git a/data/skins/classic/gfx/menu_game_over.png b/data/gfx/menu_game_over.png similarity index 100% rename from data/skins/classic/gfx/menu_game_over.png rename to data/gfx/menu_game_over.png diff --git a/data/skins/classic/gfx/menu_game_over_end.png b/data/gfx/menu_game_over_end.png similarity index 100% rename from data/skins/classic/gfx/menu_game_over_end.png rename to data/gfx/menu_game_over_end.png diff --git a/data/skins/classic/gfx/player_arounder_body.png b/data/gfx/player_arounder_body.png similarity index 100% rename from data/skins/classic/gfx/player_arounder_body.png rename to data/gfx/player_arounder_body.png diff --git a/data/skins/classic/gfx/player_arounder_death.png b/data/gfx/player_arounder_death.png similarity index 100% rename from data/skins/classic/gfx/player_arounder_death.png rename to data/gfx/player_arounder_death.png diff --git a/data/skins/classic/gfx/player_arounder_fire.png b/data/gfx/player_arounder_fire.png similarity index 100% rename from data/skins/classic/gfx/player_arounder_fire.png rename to data/gfx/player_arounder_fire.png diff --git a/data/skins/classic/gfx/player_arounder_head.png b/data/gfx/player_arounder_head.png similarity index 100% rename from data/skins/classic/gfx/player_arounder_head.png rename to data/gfx/player_arounder_head.png diff --git a/data/skins/classic/gfx/player_arounder_legs.png b/data/gfx/player_arounder_legs.png similarity index 100% rename from data/skins/classic/gfx/player_arounder_legs.png rename to data/gfx/player_arounder_legs.png diff --git a/data/skins/classic/gfx/player_bal1_body.png b/data/gfx/player_bal1_body.png similarity index 100% rename from data/skins/classic/gfx/player_bal1_body.png rename to data/gfx/player_bal1_body.png diff --git a/data/skins/classic/gfx/player_bal1_death.png b/data/gfx/player_bal1_death.png similarity index 100% rename from data/skins/classic/gfx/player_bal1_death.png rename to data/gfx/player_bal1_death.png diff --git a/data/skins/classic/gfx/player_bal1_fire.png b/data/gfx/player_bal1_fire.png similarity index 100% rename from data/skins/classic/gfx/player_bal1_fire.png rename to data/gfx/player_bal1_fire.png diff --git a/data/skins/classic/gfx/player_bal1_head.png b/data/gfx/player_bal1_head.png similarity index 100% rename from data/skins/classic/gfx/player_bal1_head.png rename to data/gfx/player_bal1_head.png diff --git a/data/skins/classic/gfx/player_bal1_legs.png b/data/gfx/player_bal1_legs.png similarity index 100% rename from data/skins/classic/gfx/player_bal1_legs.png rename to data/gfx/player_bal1_legs.png diff --git a/data/skins/classic/gfx/player_body.ani b/data/gfx/player_body.ani similarity index 100% rename from data/skins/classic/gfx/player_body.ani rename to data/gfx/player_body.ani diff --git a/data/skins/classic/gfx/player_death.ani b/data/gfx/player_death.ani similarity index 100% rename from data/skins/classic/gfx/player_death.ani rename to data/gfx/player_death.ani diff --git a/data/skins/classic/gfx/player_fire.ani b/data/gfx/player_fire.ani similarity index 100% rename from data/skins/classic/gfx/player_fire.ani rename to data/gfx/player_fire.ani diff --git a/data/skins/classic/gfx/player_head.ani b/data/gfx/player_head.ani similarity index 100% rename from data/skins/classic/gfx/player_head.ani rename to data/gfx/player_head.ani diff --git a/data/skins/classic/gfx/player_legs.ani b/data/gfx/player_legs.ani similarity index 100% rename from data/skins/classic/gfx/player_legs.ani rename to data/gfx/player_legs.ani diff --git a/data/skins/classic/gfx/title_bg_tile.png b/data/gfx/title_bg_tile.png similarity index 100% rename from data/skins/classic/gfx/title_bg_tile.png rename to data/gfx/title_bg_tile.png diff --git a/data/skins/classic/gfx/title_coffee.png b/data/gfx/title_coffee.png similarity index 100% rename from data/skins/classic/gfx/title_coffee.png rename to data/gfx/title_coffee.png diff --git a/data/skins/classic/gfx/title_crisis.png b/data/gfx/title_crisis.png similarity index 100% rename from data/skins/classic/gfx/title_crisis.png rename to data/gfx/title_crisis.png diff --git a/data/skins/classic/gfx/title_dust.ani b/data/gfx/title_dust.ani similarity index 100% rename from data/skins/classic/gfx/title_dust.ani rename to data/gfx/title_dust.ani diff --git a/data/skins/classic/gfx/title_dust.png b/data/gfx/title_dust.png similarity index 100% rename from data/skins/classic/gfx/title_dust.png rename to data/gfx/title_dust.png diff --git a/data/skins/classic/gfx/title_gradient.png b/data/gfx/title_gradient.png similarity index 100% rename from data/skins/classic/gfx/title_gradient.png rename to data/gfx/title_gradient.png diff --git a/data/lang/ba_BA.txt b/data/lang/ba_BA.txt index e1280a9..5a1d826 100644 --- a/data/lang/ba_BA.txt +++ b/data/lang/ba_BA.txt @@ -302,7 +302,4 @@ Shader Preset ## 101 - NOTIFICACIO HOTKEY -Torna a premer ESC per a eixir - -## 102 - NOTIFICACIO HOTKEY -Skin \ No newline at end of file +Torna a premer ESC per a eixir \ No newline at end of file diff --git a/data/lang/en_UK.txt b/data/lang/en_UK.txt index 71bafff..de41965 100644 --- a/data/lang/en_UK.txt +++ b/data/lang/en_UK.txt @@ -302,7 +302,4 @@ Shader Preset ## 101 - HOTKEY NOTIFICATION -Press ESC again to quit - -## 102 - HOTKEY NOTIFICATION -Skin \ No newline at end of file +Press ESC again to quit \ No newline at end of file diff --git a/data/lang/es_ES.txt b/data/lang/es_ES.txt index b6a9bdb..bb546ce 100644 --- a/data/lang/es_ES.txt +++ b/data/lang/es_ES.txt @@ -302,7 +302,4 @@ Shader Preset ## 101 - NOTIFICACION HOTKEY -Vuelve a pulsar ESC para salir - -## 102 - NOTIFICACION HOTKEY -Skin \ No newline at end of file +Vuelve a pulsar ESC para salir \ No newline at end of file diff --git a/data/skins/classic/skin.yaml b/data/skins/classic/skin.yaml deleted file mode 100644 index 302a666..0000000 --- a/data/skins/classic/skin.yaml +++ /dev/null @@ -1,4 +0,0 @@ -# Coffee Crisis - Classic skin manifest -name: classic -display_name: "Classic" -gfx_dir: gfx diff --git a/data/skins/nes/gfx/balloon1.ani b/data/skins/nes/gfx/balloon1.ani deleted file mode 100644 index 3fbe8c1..0000000 --- a/data/skins/nes/gfx/balloon1.ani +++ /dev/null @@ -1,37 +0,0 @@ -frameWidth=8 -frameHeight=8 - -[animation] -name=orange -speed=10 -loop=0 -frames=0,1,2,3,4,5,6,7,8,9 -[/animation] - -[animation] -name=blue -speed=20 -loop=0 -frames=12,13,14,15,16,17,18,19,20,21 -[/animation] - -[animation] -name=green -speed=10 -loop=0 -frames=24,25,26,27,28,29,30,31,32,33 -[/animation] - -[animation] -name=red -speed=20 -loop=0 -frames=36,37,38,39,40,41,42,43,44,45 -[/animation] - -[animation] -name=pop -speed=5 -loop=-1 -frames=48,49,50,51,52,53,54,55,56,57,58,59 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/balloon1.png b/data/skins/nes/gfx/balloon1.png deleted file mode 100644 index 7f1aef9..0000000 Binary files a/data/skins/nes/gfx/balloon1.png and /dev/null differ diff --git a/data/skins/nes/gfx/balloon2.ani b/data/skins/nes/gfx/balloon2.ani deleted file mode 100644 index bbc4d86..0000000 --- a/data/skins/nes/gfx/balloon2.ani +++ /dev/null @@ -1,37 +0,0 @@ -frameWidth=13 -frameHeight=13 - -[animation] -name=orange -speed=10 -loop=0 -frames=0,1,2,3,4,5,6,7,8,9 -[/animation] - -[animation] -name=blue -speed=20 -loop=0 -frames=12,13,14,15,16,17,18,19,20,21 -[/animation] - -[animation] -name=green -speed=10 -loop=0 -frames=24,25,26,27,28,29,30,31,32,33 -[/animation] - -[animation] -name=red -speed=20 -loop=0 -frames=36,37,38,39,40,41,42,43,44,45 -[/animation] - -[animation] -name=pop -speed=5 -loop=-1 -frames=48,49,50,51,52,53,54,55,56,57,58,59 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/balloon2.png b/data/skins/nes/gfx/balloon2.png deleted file mode 100644 index 8f3356b..0000000 Binary files a/data/skins/nes/gfx/balloon2.png and /dev/null differ diff --git a/data/skins/nes/gfx/balloon3.ani b/data/skins/nes/gfx/balloon3.ani deleted file mode 100644 index e1fd440..0000000 --- a/data/skins/nes/gfx/balloon3.ani +++ /dev/null @@ -1,37 +0,0 @@ -frameWidth=21 -frameHeight=21 - -[animation] -name=orange -speed=10 -loop=0 -frames=0,1,2,3,4,5,6,7,8,9 -[/animation] - -[animation] -name=blue -speed=20 -loop=0 -frames=12,13,14,15,16,17,18,19,20,21 -[/animation] - -[animation] -name=green -speed=10 -loop=0 -frames=24,25,26,27,28,29,30,31,32,33 -[/animation] - -[animation] -name=red -speed=20 -loop=0 -frames=36,37,38,39,40,41,42,43,44,45 -[/animation] - -[animation] -name=pop -speed=5 -loop=-1 -frames=48,49,50,51,52,53,54,55,56,57,58,59 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/balloon3.png b/data/skins/nes/gfx/balloon3.png deleted file mode 100644 index 66ddb4a..0000000 Binary files a/data/skins/nes/gfx/balloon3.png and /dev/null differ diff --git a/data/skins/nes/gfx/balloon4.ani b/data/skins/nes/gfx/balloon4.ani deleted file mode 100644 index db7e703..0000000 --- a/data/skins/nes/gfx/balloon4.ani +++ /dev/null @@ -1,44 +0,0 @@ -frameWidth=37 -frameHeight=37 - -[animation] -name=orange -speed=10 -loop=0 -frames=0,1,2,3,4,5,6,7,8,9 -[/animation] - -[animation] -name=blue -speed=20 -loop=0 -frames=12,13,14,15,16,17,18,19,20,21 -[/animation] - -[animation] -name=green -speed=10 -loop=0 -frames=24,25,26,27,28,29,30,31,32,33 -[/animation] - -[animation] -name=red -speed=20 -loop=0 -frames=36,37,38,39,40,41,42,43,44,45 -[/animation] - -[animation] -name=powerball -speed=10 -loop=0 -frames=10 -[/animation] - -[animation] -name=pop -speed=5 -loop=-1 -frames=48,49,50,51,52,53,54,55,56,57,58,59 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/balloon4.png b/data/skins/nes/gfx/balloon4.png deleted file mode 100644 index f9b73cc..0000000 Binary files a/data/skins/nes/gfx/balloon4.png and /dev/null differ diff --git a/data/skins/nes/gfx/bullet.png b/data/skins/nes/gfx/bullet.png deleted file mode 100644 index 88aaf65..0000000 Binary files a/data/skins/nes/gfx/bullet.png and /dev/null differ diff --git a/data/skins/nes/gfx/game_buildings.png b/data/skins/nes/gfx/game_buildings.png deleted file mode 100644 index 4427579..0000000 Binary files a/data/skins/nes/gfx/game_buildings.png and /dev/null differ diff --git a/data/skins/nes/gfx/game_clouds.png b/data/skins/nes/gfx/game_clouds.png deleted file mode 100644 index 8e45d4d..0000000 Binary files a/data/skins/nes/gfx/game_clouds.png and /dev/null differ diff --git a/data/skins/nes/gfx/game_grass.png b/data/skins/nes/gfx/game_grass.png deleted file mode 100644 index 8c036ad..0000000 Binary files a/data/skins/nes/gfx/game_grass.png and /dev/null differ diff --git a/data/skins/nes/gfx/game_power_meter.png b/data/skins/nes/gfx/game_power_meter.png deleted file mode 100644 index 4fb54a8..0000000 Binary files a/data/skins/nes/gfx/game_power_meter.png and /dev/null differ diff --git a/data/skins/nes/gfx/game_sky_colors.png b/data/skins/nes/gfx/game_sky_colors.png deleted file mode 100644 index 577b0bc..0000000 Binary files a/data/skins/nes/gfx/game_sky_colors.png and /dev/null differ diff --git a/data/skins/nes/gfx/game_text.png b/data/skins/nes/gfx/game_text.png deleted file mode 100644 index 695b693..0000000 Binary files a/data/skins/nes/gfx/game_text.png and /dev/null differ diff --git a/data/skins/nes/gfx/intro.png b/data/skins/nes/gfx/intro.png deleted file mode 100644 index 4d0964b..0000000 Binary files a/data/skins/nes/gfx/intro.png and /dev/null differ diff --git a/data/skins/nes/gfx/item_clock.ani b/data/skins/nes/gfx/item_clock.ani deleted file mode 100644 index 5967f69..0000000 --- a/data/skins/nes/gfx/item_clock.ani +++ /dev/null @@ -1,9 +0,0 @@ -frameWidth=16 -frameHeight=16 - -[animation] -name=default -speed=10 -loop=0 -frames=0,1 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/item_clock.png b/data/skins/nes/gfx/item_clock.png deleted file mode 100644 index 415ef88..0000000 Binary files a/data/skins/nes/gfx/item_clock.png and /dev/null differ diff --git a/data/skins/nes/gfx/item_coffee.ani b/data/skins/nes/gfx/item_coffee.ani deleted file mode 100644 index 5967f69..0000000 --- a/data/skins/nes/gfx/item_coffee.ani +++ /dev/null @@ -1,9 +0,0 @@ -frameWidth=16 -frameHeight=16 - -[animation] -name=default -speed=10 -loop=0 -frames=0,1 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/item_coffee.png b/data/skins/nes/gfx/item_coffee.png deleted file mode 100644 index 4888ee6..0000000 Binary files a/data/skins/nes/gfx/item_coffee.png and /dev/null differ diff --git a/data/skins/nes/gfx/item_coffee_machine.ani b/data/skins/nes/gfx/item_coffee_machine.ani deleted file mode 100644 index 465d9e8..0000000 --- a/data/skins/nes/gfx/item_coffee_machine.ani +++ /dev/null @@ -1,9 +0,0 @@ -frameWidth=23 -frameHeight=29 - -[animation] -name=default -speed=10 -loop=0 -frames=0,1,2,3 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/item_coffee_machine.png b/data/skins/nes/gfx/item_coffee_machine.png deleted file mode 100644 index 4c68ecf..0000000 Binary files a/data/skins/nes/gfx/item_coffee_machine.png and /dev/null differ diff --git a/data/skins/nes/gfx/item_points1_disk.ani b/data/skins/nes/gfx/item_points1_disk.ani deleted file mode 100644 index 5967f69..0000000 --- a/data/skins/nes/gfx/item_points1_disk.ani +++ /dev/null @@ -1,9 +0,0 @@ -frameWidth=16 -frameHeight=16 - -[animation] -name=default -speed=10 -loop=0 -frames=0,1 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/item_points1_disk.png b/data/skins/nes/gfx/item_points1_disk.png deleted file mode 100644 index ac974d2..0000000 Binary files a/data/skins/nes/gfx/item_points1_disk.png and /dev/null differ diff --git a/data/skins/nes/gfx/item_points2_gavina.ani b/data/skins/nes/gfx/item_points2_gavina.ani deleted file mode 100644 index 5967f69..0000000 --- a/data/skins/nes/gfx/item_points2_gavina.ani +++ /dev/null @@ -1,9 +0,0 @@ -frameWidth=16 -frameHeight=16 - -[animation] -name=default -speed=10 -loop=0 -frames=0,1 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/item_points2_gavina.png b/data/skins/nes/gfx/item_points2_gavina.png deleted file mode 100644 index cbf4529..0000000 Binary files a/data/skins/nes/gfx/item_points2_gavina.png and /dev/null differ diff --git a/data/skins/nes/gfx/item_points3_pacmar.ani b/data/skins/nes/gfx/item_points3_pacmar.ani deleted file mode 100644 index 5967f69..0000000 --- a/data/skins/nes/gfx/item_points3_pacmar.ani +++ /dev/null @@ -1,9 +0,0 @@ -frameWidth=16 -frameHeight=16 - -[animation] -name=default -speed=10 -loop=0 -frames=0,1 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/item_points3_pacmar.png b/data/skins/nes/gfx/item_points3_pacmar.png deleted file mode 100644 index f8e5515..0000000 Binary files a/data/skins/nes/gfx/item_points3_pacmar.png and /dev/null differ diff --git a/data/skins/nes/gfx/logo.png b/data/skins/nes/gfx/logo.png deleted file mode 100644 index 0177885..0000000 Binary files a/data/skins/nes/gfx/logo.png and /dev/null differ diff --git a/data/skins/nes/gfx/menu_game_over.png b/data/skins/nes/gfx/menu_game_over.png deleted file mode 100644 index c70d2e8..0000000 Binary files a/data/skins/nes/gfx/menu_game_over.png and /dev/null differ diff --git a/data/skins/nes/gfx/menu_game_over_end.png b/data/skins/nes/gfx/menu_game_over_end.png deleted file mode 100644 index 5e8fe65..0000000 Binary files a/data/skins/nes/gfx/menu_game_over_end.png and /dev/null differ diff --git a/data/skins/nes/gfx/player_arounder_body.png b/data/skins/nes/gfx/player_arounder_body.png deleted file mode 100644 index ec8aa4c..0000000 Binary files a/data/skins/nes/gfx/player_arounder_body.png and /dev/null differ diff --git a/data/skins/nes/gfx/player_arounder_death.png b/data/skins/nes/gfx/player_arounder_death.png deleted file mode 100644 index a2ee38b..0000000 Binary files a/data/skins/nes/gfx/player_arounder_death.png and /dev/null differ diff --git a/data/skins/nes/gfx/player_arounder_fire.png b/data/skins/nes/gfx/player_arounder_fire.png deleted file mode 100644 index 5da208b..0000000 Binary files a/data/skins/nes/gfx/player_arounder_fire.png and /dev/null differ diff --git a/data/skins/nes/gfx/player_arounder_head.png b/data/skins/nes/gfx/player_arounder_head.png deleted file mode 100644 index 211f287..0000000 Binary files a/data/skins/nes/gfx/player_arounder_head.png and /dev/null differ diff --git a/data/skins/nes/gfx/player_arounder_legs.png b/data/skins/nes/gfx/player_arounder_legs.png deleted file mode 100644 index cbc353b..0000000 Binary files a/data/skins/nes/gfx/player_arounder_legs.png and /dev/null differ diff --git a/data/skins/nes/gfx/player_bal1_body.png b/data/skins/nes/gfx/player_bal1_body.png deleted file mode 100644 index da04d54..0000000 Binary files a/data/skins/nes/gfx/player_bal1_body.png and /dev/null differ diff --git a/data/skins/nes/gfx/player_bal1_death.png b/data/skins/nes/gfx/player_bal1_death.png deleted file mode 100644 index 07b3248..0000000 Binary files a/data/skins/nes/gfx/player_bal1_death.png and /dev/null differ diff --git a/data/skins/nes/gfx/player_bal1_fire.png b/data/skins/nes/gfx/player_bal1_fire.png deleted file mode 100644 index cf0927c..0000000 Binary files a/data/skins/nes/gfx/player_bal1_fire.png and /dev/null differ diff --git a/data/skins/nes/gfx/player_bal1_head.png b/data/skins/nes/gfx/player_bal1_head.png deleted file mode 100644 index 6a8d3d2..0000000 Binary files a/data/skins/nes/gfx/player_bal1_head.png and /dev/null differ diff --git a/data/skins/nes/gfx/player_bal1_legs.png b/data/skins/nes/gfx/player_bal1_legs.png deleted file mode 100644 index f1a6a5e..0000000 Binary files a/data/skins/nes/gfx/player_bal1_legs.png and /dev/null differ diff --git a/data/skins/nes/gfx/player_body.ani b/data/skins/nes/gfx/player_body.ani deleted file mode 100644 index dd893e7..0000000 --- a/data/skins/nes/gfx/player_body.ani +++ /dev/null @@ -1,176 +0,0 @@ -frameWidth=24 -frameHeight=24 - -[animation] -name=walk -speed=5 -loop=0 -frames=0,1,2,3 -[/animation] - -[animation] -name=stand -speed=10 -loop=0 -frames=4,5,6,7 -[/animation] - -[animation] -name=walk_1C -speed=5 -loop=0 -frames=8,9,10,11 -[/animation] - -[animation] -name=stand_1C -speed=10 -loop=0 -frames=12,13,14,15 -[/animation] - -[animation] -name=walk_2C -speed=5 -loop=0 -frames=16,17,18,19 -[/animation] - -[animation] -name=stand_2C -speed=10 -loop=0 -frames=20,21,22,23 -[/animation] - - - -[animation] -name=sideshoot -speed=5 -loop=0 -frames=24,25,26,27 -[/animation] - -[animation] -name=centershoot -speed=5 -loop=0 -frames=28,29,30,31 -[/animation] - -[animation] -name=sideshoot_1C -speed=5 -loop=0 -frames=32,33,34,35 -[/animation] - -[animation] -name=centershoot_1C -speed=5 -loop=0 -frames=36,37,38,39 -[/animation] - -[animation] -name=sideshoot_2C -speed=5 -loop=0 -frames=40,41,42,43 -[/animation] - -[animation] -name=centershoot_2C -speed=5 -loop=0 -frames=44,45,46,47 -[/animation] - - - -[animation] -name=walk_pwr -speed=3 -loop=0 -frames=0,1,2,3 -[/animation] - -[animation] -name=stand_pwr -speed=5 -loop=0 -frames=4,5,6,7 -[/animation] - -[animation] -name=walk_1C_pwr -speed=3 -loop=0 -frames=8,9,10,11 -[/animation] - -[animation] -name=stand_1C_pwr -speed=5 -loop=0 -frames=12,13,14,15 -[/animation] - -[animation] -name=walk_2C_pwr -speed=3 -loop=0 -frames=16,17,18,19 -[/animation] - -[animation] -name=stand_2C_pwr -speed=5 -loop=0 -frames=20,21,22,23 -[/animation] - - - -[animation] -name=sideshoot_pwr -speed=2 -loop=0 -frames=24,25,26,27 -[/animation] - -[animation] -name=centershoot_pwr -speed=2 -loop=0 -frames=28,29,30,31 -[/animation] - -[animation] -name=sideshoot_1C_pwr -speed=2 -loop=0 -frames=32,33,34,35 -[/animation] - -[animation] -name=centershoot_1C_pwr -speed=2 -loop=0 -frames=36,37,38,39 -[/animation] - -[animation] -name=sideshoot_2C_pwr -speed=2 -loop=0 -frames=40,41,42,43 -[/animation] - -[animation] -name=centershoot_2C_pwr -speed=2 -loop=0 -frames=44,45,46,47 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/player_death.ani b/data/skins/nes/gfx/player_death.ani deleted file mode 100644 index 2567468..0000000 --- a/data/skins/nes/gfx/player_death.ani +++ /dev/null @@ -1,9 +0,0 @@ -frameWidth=24 -frameHeight=24 - -[animation] -name=default -speed=5 -loop=0 -frames=0,1,2,3 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/player_fire.ani b/data/skins/nes/gfx/player_fire.ani deleted file mode 100644 index 8552ba5..0000000 --- a/data/skins/nes/gfx/player_fire.ani +++ /dev/null @@ -1,9 +0,0 @@ -frameWidth=28 -frameHeight=32 - -[animation] -name=default -speed=5 -loop=0 -frames=0,1,2,3 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/player_head.ani b/data/skins/nes/gfx/player_head.ani deleted file mode 100644 index 52fc8e0..0000000 --- a/data/skins/nes/gfx/player_head.ani +++ /dev/null @@ -1,114 +0,0 @@ -frameWidth=24 -frameHeight=24 - -[animation] -name=walk -speed=5 -loop=0 -frames=0,1,2,3 -[/animation] - -[animation] -name=stand -speed=10 -loop=0 -frames=4,5,6,7 -[/animation] - -[animation] -name=walk_1C -speed=5 -loop=0 -frames=8,9,10,11 -[/animation] - -[animation] -name=stand_1C -speed=10 -loop=0 -frames=12,13,14,15 -[/animation] - -[animation] -name=walk_pwr -speed=5 -loop=0 -frames=16,17,18,19 -[/animation] - -[animation] -name=stand_pwr -speed=10 -loop=0 -frames=20,21,22,23 -[/animation] - -[animation] -name=walk_1C_pwr -speed=5 -loop=0 -frames=24,25,26,27 -[/animation] - -[animation] -name=stand_1C_pwr -speed=10 -loop=0 -frames=28,29,30,31 -[/animation] - -[animation] -name=sideshoot -speed=5 -loop=0 -frames=16,17,18,19 -[/animation] - -[animation] -name=centershoot -speed=5 -loop=0 -frames=20,21,22,23 -[/animation] - -[animation] -name=sideshoot_1C -speed=5 -loop=0 -frames=24,25,26,27 -[/animation] - -[animation] -name=centershoot_1C -speed=5 -loop=0 -frames=28,29,30,31 -[/animation] - -[animation] -name=sideshoot_pwr -speed=2 -loop=0 -frames=16,17,18,19 -[/animation] - -[animation] -name=centershoot_pwr -speed=2 -loop=0 -frames=20,21,22,23 -[/animation] - -[animation] -name=sideshoot_1C_pwr -speed=2 -loop=0 -frames=24,25,26,27 -[/animation] - -[animation] -name=centershoot_1C_pwr -speed=2 -loop=0 -frames=28,29,30,31 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/player_legs.ani b/data/skins/nes/gfx/player_legs.ani deleted file mode 100644 index 9cd6905..0000000 --- a/data/skins/nes/gfx/player_legs.ani +++ /dev/null @@ -1,16 +0,0 @@ -frameWidth=24 -frameHeight=24 - -[animation] -name=walk -speed=5 -loop=0 -frames=0,1,2,3 -[/animation] - -[animation] -name=stand -speed=10 -loop=0 -frames=4,5,6,7 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/title_bg_tile.png b/data/skins/nes/gfx/title_bg_tile.png deleted file mode 100644 index ea06e48..0000000 Binary files a/data/skins/nes/gfx/title_bg_tile.png and /dev/null differ diff --git a/data/skins/nes/gfx/title_coffee.png b/data/skins/nes/gfx/title_coffee.png deleted file mode 100644 index b1f9f35..0000000 Binary files a/data/skins/nes/gfx/title_coffee.png and /dev/null differ diff --git a/data/skins/nes/gfx/title_crisis.png b/data/skins/nes/gfx/title_crisis.png deleted file mode 100644 index 0e4d082..0000000 Binary files a/data/skins/nes/gfx/title_crisis.png and /dev/null differ diff --git a/data/skins/nes/gfx/title_dust.ani b/data/skins/nes/gfx/title_dust.ani deleted file mode 100644 index 9e655a4..0000000 --- a/data/skins/nes/gfx/title_dust.ani +++ /dev/null @@ -1,9 +0,0 @@ -frameWidth=16 -frameHeight=16 - -[animation] -name=default -speed=8 -loop=-1 -frames=0,1,2,3,4,5,6 -[/animation] \ No newline at end of file diff --git a/data/skins/nes/gfx/title_dust.png b/data/skins/nes/gfx/title_dust.png deleted file mode 100644 index 3d4a967..0000000 Binary files a/data/skins/nes/gfx/title_dust.png and /dev/null differ diff --git a/data/skins/nes/gfx/title_gradient.png b/data/skins/nes/gfx/title_gradient.png deleted file mode 100644 index 046b5aa..0000000 Binary files a/data/skins/nes/gfx/title_gradient.png and /dev/null differ diff --git a/data/skins/nes/skin.yaml b/data/skins/nes/skin.yaml deleted file mode 100644 index 4112aaa..0000000 --- a/data/skins/nes/skin.yaml +++ /dev/null @@ -1,4 +0,0 @@ -# Coffee Crisis - NES skin manifest -name: nes -display_name: "NES" -gfx_dir: gfx diff --git a/source/core/input/global_inputs.cpp b/source/core/input/global_inputs.cpp index d817f85..d4ebc6c 100644 --- a/source/core/input/global_inputs.cpp +++ b/source/core/input/global_inputs.cpp @@ -5,8 +5,6 @@ #include "core/input/input.h" #include "core/locale/lang.h" #include "core/rendering/screen.h" -#include "core/resources/resource.h" -#include "core/resources/skin_manager.hpp" #include "game/options.hpp" #include "utils/utils.h" @@ -20,7 +18,6 @@ namespace GlobalInputs { constexpr int LANG_SHADER = 99; constexpr int LANG_PRESET = 100; constexpr int LANG_EXIT_CONFIRM = 101; - constexpr int LANG_SKIN = 102; constexpr Uint32 NOTIFY_MS = 1500; constexpr Uint32 EXIT_CONFIRM_MS = 2000; @@ -66,11 +63,6 @@ namespace GlobalInputs { Screen::get()->notify(MSG, GREEN, BLACK, NOTIFY_MS); } - void notifySkin() { - const std::string MSG = Lang::get()->getText(LANG_SKIN) + " " + SkinManager::get()->currentDisplayName(); - Screen::get()->notify(MSG, CYAN, BLACK, NOTIFY_MS); - } - void onExit() { const Uint32 NOW = SDL_GetTicks(); if (NOW < exit_window_until_ticks) { @@ -125,14 +117,6 @@ namespace GlobalInputs { return true; } } - if (Input::get()->checkInput(Input::Action::NEXT_SKIN, Input::Repeat::OFF)) { - const std::string NEXT_ID = SkinManager::get()->nextSkinId(); - if (NEXT_ID != SkinManager::get()->current()) { - Resource::get()->reloadForSkin(NEXT_ID); - } - notifySkin(); - return true; - } return false; } diff --git a/source/core/input/global_inputs.hpp b/source/core/input/global_inputs.hpp index 38ca511..b8b4f1d 100644 --- a/source/core/input/global_inputs.hpp +++ b/source/core/input/global_inputs.hpp @@ -3,11 +3,11 @@ namespace GlobalInputs { // Gestiona els atalls globals disponibles en qualsevol escena: zoom de // finestra (F1/F2), fullscreen (F3), toggle shader (F4), tipus de shader - // POSTFX↔CRTPI (F5), següent preset (F6), següent skin (F7) i la - // confirmació d'eixida amb ESC (Action::EXIT) en dues pulsacions. Cada - // hotkey emet una notificació localitzada. Retorna true si ha consumit - // alguna tecla (per si la capa cridant vol suprimir-la del processament - // específic de l'escena). + // POSTFX↔CRTPI (F5), següent preset (F6) i la confirmació d'eixida amb + // ESC (Action::EXIT) en dues pulsacions. Cada hotkey emet una + // notificació localitzada. Retorna true si ha consumit alguna tecla (per + // si la capa cridant vol suprimir-la del processament específic de + // l'escena). auto handle() -> bool; // True si la doble pulsació d'ESC s'ha confirmat. Director consulta açò diff --git a/source/core/input/input.h b/source/core/input/input.h index 62ad5a0..9989bb8 100644 --- a/source/core/input/input.h +++ b/source/core/input/input.h @@ -50,9 +50,6 @@ class Input { TOGGLE_SHADER, TOGGLE_SHADER_TYPE, - // Skins - NEXT_SKIN, - // Centinela final (usar para sizing) NUMBER_OF_INPUTS }; @@ -64,12 +61,12 @@ class Input { ~Input(); // Destructor - void update(); // Actualiza el estado del objeto + void update(); // Actualiza el estado del objeto void bindKey(Action input, SDL_Scancode code); // Asigna inputs a teclas void bindGameControllerButton(Action input, SDL_GamepadButton button); // Asigna inputs a botones del mando auto checkInput(Action input, Repeat repeat = Repeat::ON, Device device = Device::ANY, int index = 0) -> bool; // Comprueba si un input esta activo - auto checkAnyInput(Device device = Device::ANY, int index = 0) -> bool; // Comprueba si hay almenos un input activo + auto checkAnyInput(Device device = Device::ANY, int index = 0) -> bool; // Comprueba si hay almenos un input activo auto discoverGameController() -> bool; // Busca si hay un mando conectado @@ -85,9 +82,9 @@ class Input { [[nodiscard]] auto getNumControllers() const -> int; // Obten el numero de mandos conectados auto getControllerName(int index) -> std::string; // Obten el nombre de un mando de juego - void setVerbose(bool value); // Establece si ha de mostrar mensajes - void disableUntil(Disable value); // Deshabilita las entradas durante un periodo de tiempo - void enable(); // Hablita las entradas + void setVerbose(bool value); // Establece si ha de mostrar mensajes + void disableUntil(Disable value); // Deshabilita las entradas durante un periodo de tiempo + void enable(); // Hablita las entradas private: struct KeyBindings { diff --git a/source/core/locale/lang.h b/source/core/locale/lang.h index 5265872..578b115 100644 --- a/source/core/locale/lang.h +++ b/source/core/locale/lang.h @@ -30,7 +30,7 @@ class Lang { static auto nextLanguage(Code c) -> Code; // Devuelve el siguiente idioma del ciclo private: - static constexpr int MAX_TEXT_STRINGS = 111; + static constexpr int MAX_TEXT_STRINGS = 110; std::string text_strings_[MAX_TEXT_STRINGS]; // Vector con los textos diff --git a/source/core/rendering/texture.cpp b/source/core/rendering/texture.cpp index dbdd450..81b05c1 100644 --- a/source/core/rendering/texture.cpp +++ b/source/core/rendering/texture.cpp @@ -212,14 +212,6 @@ auto Texture::reLoad() -> bool { return loadFromFile(path_, renderer_); } -// Reapunta el path emmagatzemat i recarrega: usat pel SkinManager per a -// fer hot-swap d'skin mantenint estable el punter Texture* (els Sprites -// continuen apuntant al mateix objecte amb contingut actualitzat). -auto Texture::reLoadFromPath(const std::string &new_path) -> bool { - path_ = new_path; - return loadFromFile(path_, renderer_); -} - // Obtiene la textura auto Texture::getSDLTexture() -> SDL_Texture * { return texture_; diff --git a/source/core/rendering/texture.h b/source/core/rendering/texture.h index 096f811..e9d729e 100644 --- a/source/core/rendering/texture.h +++ b/source/core/rendering/texture.h @@ -26,14 +26,13 @@ class Texture { void setAlpha(Uint8 alpha); // Establece el alpha para la modulación void render(SDL_Renderer *renderer, int x, int y, const SDL_Rect *clip = nullptr, float zoom_w = 1, float zoom_h = 1, double angle = 0.0, const SDL_Point *center = nullptr, SDL_FlipMode flip = SDL_FLIP_NONE); // Renderiza la textura en un punto específico - void setAsRenderTarget(SDL_Renderer *renderer); // Establece la textura como objetivo de renderizado + void setAsRenderTarget(SDL_Renderer *renderer); // Establece la textura como objetivo de renderizado [[nodiscard]] auto getWidth() const -> int; // Obtiene el ancho de la imagen [[nodiscard]] auto getHeight() const -> int; // Obtiene el alto de la imagen - auto reLoad() -> bool; // Recarga la textura - auto reLoadFromPath(const std::string &new_path) -> bool; // Reapunta path_ i recarrega (preserva el Texture*) - auto getSDLTexture() -> SDL_Texture *; // Obtiene la textura + auto reLoad() -> bool; // Recarga la textura + auto getSDLTexture() -> SDL_Texture *; // Obtiene la textura private: // Objetos y punteros diff --git a/source/core/resources/asset.cpp b/source/core/resources/asset.cpp index b989fb3..31fd105 100644 --- a/source/core/resources/asset.cpp +++ b/source/core/resources/asset.cpp @@ -6,7 +6,6 @@ #include // for basic_ostream, operator<<, cout, endl #include "core/resources/resource_helper.h" -#include "core/resources/skin_manager.hpp" // Instancia única Asset *Asset::instance = nullptr; @@ -42,30 +41,6 @@ void Asset::add(const std::string &file, Type type, bool required, bool absolute longest_name_ = SDL_max(longest_name_, FILE_NAME.size()); } -// Afegeix un asset gfx skin-aware: el path complet es composa via -// SkinManager (que ja inclou el PREFIX de plataforma) i guardem el -// basename per a poder-lo recomposar quan canviï la skin activa. -void Asset::addSkinAware(const std::string &basename, Type type, bool required) { - Item temp; - temp.file = executable_path_ + SkinManager::get()->gfxPath(basename); - temp.type = type; - temp.required = required; - temp.skin_basename = basename; - file_list_.push_back(temp); - - longest_name_ = SDL_max(longest_name_, basename.size()); -} - -// Recomposa els paths dels items skin-aware amb l'skin actual del -// SkinManager. Cridat per Resource::reloadForSkin després d'un canvi. -void Asset::onSkinChanged() { - for (auto &it : file_list_) { - if (!it.skin_basename.empty()) { - it.file = executable_path_ + SkinManager::get()->gfxPath(it.skin_basename); - } - } -} - // Devuelve el fichero de un elemento de la lista a partir de una cadena auto Asset::get(const std::string &text) -> std::string { for (const auto &f : file_list_) { diff --git a/source/core/resources/asset.h b/source/core/resources/asset.h index 39bd3ea..e7f44d1 100644 --- a/source/core/resources/asset.h +++ b/source/core/resources/asset.h @@ -23,10 +23,9 @@ class Asset { // Estructura para definir un item struct Item { - std::string file; // Ruta del fichero desde la raiz del directorio - Type type; // Indica el tipo de recurso - bool required; // Indica si es un fichero que debe de existir - std::string skin_basename; // No buit ⇒ item skin-aware (recomposable via SkinManager) + std::string file; // Ruta del fichero desde la raiz del directorio + Type type; // Indica el tipo de recurso + bool required; // Indica si es un fichero que debe de existir }; // Singleton API @@ -35,8 +34,6 @@ class Asset { static auto get() -> Asset *; // Obtiene el puntero a la instancia void add(const std::string &file, Type type, bool required = true, bool absolute = false); // Añade un elemento a la lista - void addSkinAware(const std::string &basename, Type type, bool required = true); // Afegeix un asset gfx que viu sota la skin activa (recomposable) - void onSkinChanged(); // Recomposa el path dels items skin-aware amb la skin actual auto get(const std::string &text) -> std::string; // Devuelve un elemento de la lista a partir de una cadena [[nodiscard]] auto getAll() const -> const std::vector & { return file_list_; } // Devuelve toda la lista de items registrados auto check() -> bool; // Comprueba que existen todos los elementos diff --git a/source/core/resources/resource.cpp b/source/core/resources/resource.cpp index 8b83b7b..6f77bd8 100644 --- a/source/core/resources/resource.cpp +++ b/source/core/resources/resource.cpp @@ -8,8 +8,6 @@ #include "core/rendering/texture.h" #include "core/resources/asset.h" #include "core/resources/resource_helper.h" -#include "core/resources/skin_manager.hpp" -#include "game/options.hpp" #include "game/ui/menu.h" // Nota: Asset::get() e Input::get() se consultan en preloadAll y al construir @@ -265,41 +263,3 @@ auto Resource::getMenu(const std::string &name) -> Menu * { } return it->second; } - -void Resource::reloadForSkin(const std::string &skin_id) { - if (SkinManager::get() == nullptr || !SkinManager::get()->exists(skin_id)) { - return; - } - - SkinManager::get()->setCurrent(skin_id); - Asset::get()->onSkinChanged(); - - // Recarrega cada textura cachejada des del nou path mantenint pointer - // identity perquè els Sprites no s'invaliden. - for (auto &[bname, tex] : textures_) { - const std::string NEW_PATH = Asset::get()->get(bname); - if (!NEW_PATH.empty()) { - tex->reLoadFromPath(NEW_PATH); - } - } - - // Re-parseja els fitxers .ani de la nova skin. - for (auto &[bname, lines] : animation_lines_) { - const std::string NEW_PATH = Asset::get()->get(bname); - if (NEW_PATH.empty()) { continue; } - auto bytes = ResourceHelper::loadFile(NEW_PATH); - if (bytes.empty()) { continue; } - std::string content(reinterpret_cast(bytes.data()), bytes.size()); - std::stringstream ss(content); - std::vector new_lines; - std::string line; - while (std::getline(ss, line)) { - if (!line.empty() && line.back() == '\r') { line.pop_back(); } - new_lines.push_back(line); - } - lines = std::move(new_lines); - } - - Options::settings.skin = skin_id; - Options::saveToFile(); -} diff --git a/source/core/resources/resource.h b/source/core/resources/resource.h index 7e0108d..e41d428 100644 --- a/source/core/resources/resource.h +++ b/source/core/resources/resource.h @@ -31,11 +31,6 @@ class Resource { auto getMenu(const std::string &name) -> Menu *; // name sin extensión: "title", "options", ... auto getDemoBytes() const -> const std::vector & { return demo_bytes_; } - // Recarrega tots els recursos skin-aware (textures + animacions) per a - // l'skin donada. Manté pointer identity dels Texture* perquè els Sprites - // existents continuïn vàlids. - void reloadForSkin(const std::string &skin_id); - private: explicit Resource(SDL_Renderer *renderer); ~Resource(); diff --git a/source/core/resources/skin_manager.cpp b/source/core/resources/skin_manager.cpp deleted file mode 100644 index 26fecdd..0000000 --- a/source/core/resources/skin_manager.cpp +++ /dev/null @@ -1,133 +0,0 @@ -#include "core/resources/skin_manager.hpp" - -#include -#include -#include - -#include "core/resources/resource_helper.h" -#include "core/resources/resource_loader.h" -#include "external/fkyaml_node.hpp" - -SkinManager *SkinManager::instance = nullptr; - -void SkinManager::init(const std::string &executable_path, const std::string &asset_prefix) { - if (instance == nullptr) { - instance = new SkinManager(executable_path, asset_prefix); - instance->scan(); - } -} - -void SkinManager::destroy() { - delete instance; - instance = nullptr; -} - -auto SkinManager::get() -> SkinManager * { - return instance; -} - -SkinManager::SkinManager(std::string executable_path, std::string asset_prefix) - : executable_path_(std::move(executable_path)), - asset_prefix_(std::move(asset_prefix)) { -} - -void SkinManager::scan() { - skins_.clear(); - - // ResourceLoader enumera tant entries del pack com fitxers de - // `data/` en mode fallback. Les claus retornades són relatives a - // `data/` (ex: "skins/classic/skin.yaml"). Buscar manifests - // amb aquest patró és més robust que `std::filesystem` perquè - // funciona igual a release (pack) que a dev (filesystem). - const auto ALL = ResourceLoader::getInstance().getAvailableResources(); - - const std::string PREFIX = "skins/"; - const std::string SUFFIX = "/skin.yaml"; - - for (const auto &key : ALL) { - if (!key.starts_with(PREFIX) || !key.ends_with(SUFFIX)) { continue; } - const std::string ID = key.substr(PREFIX.size(), key.size() - PREFIX.size() - SUFFIX.size()); - if (ID.find('/') != std::string::npos) { continue; } // només top-level dins skins/ - - // ResourceHelper espera un path que contingui "data/" — el construïm - // amb la convenció habitual del projecte. - const std::string FULL_PATH = executable_path_ + asset_prefix_ + "/data/" + key; - auto bytes = ResourceHelper::loadFile(FULL_PATH); - if (bytes.empty()) { - std::cerr << "SkinManager: cannot read manifest " << FULL_PATH << '\n'; - continue; - } - - SkinInfo info; - info.id = ID; - info.display_name = ID; - info.gfx_dir = "gfx"; - - try { - const std::string CONTENT(reinterpret_cast(bytes.data()), bytes.size()); - auto yaml = fkyaml::node::deserialize(CONTENT); - if (yaml.contains("display_name")) { - info.display_name = yaml["display_name"].get_value(); - } - if (yaml.contains("gfx_dir")) { - info.gfx_dir = yaml["gfx_dir"].get_value(); - } - } catch (const fkyaml::exception &e) { - std::cerr << "SkinManager: bad manifest " << FULL_PATH << ": " << e.what() << '\n'; - continue; - } - - skins_.push_back(std::move(info)); - } - - // Ordre alfabètic estable: garanteix que next/prev són deterministes. - std::ranges::sort(skins_, [](const SkinInfo &a, const SkinInfo &b) { return a.id < b.id; }); -} - -auto SkinManager::exists(const std::string &id) const -> bool { - return std::ranges::any_of(skins_, [&](const SkinInfo &s) { return s.id == id; }); -} - -auto SkinManager::currentDisplayName() const -> std::string { - return displayNameOf(current_id_); -} - -auto SkinManager::displayNameOf(const std::string &id) const -> std::string { - const auto IT = std::ranges::find_if(skins_, [&](const SkinInfo &s) { return s.id == id; }); - return (IT != skins_.end()) ? IT->display_name : id; -} - -void SkinManager::setCurrent(const std::string &id) { - if (exists(id)) { - current_id_ = id; - } -} - -auto SkinManager::gfxDirOf(const std::string &id) const -> std::string { - const auto IT = std::ranges::find_if(skins_, [&](const SkinInfo &s) { return s.id == id; }); - return (IT != skins_.end()) ? IT->gfx_dir : std::string("gfx"); -} - -auto SkinManager::gfxPath(const std::string &basename) const -> std::string { - return asset_prefix_ + "/data/skins/" + current_id_ + "/" + gfxDirOf(current_id_) + "/" + basename; -} - -auto SkinManager::nextSkinId() const -> std::string { - if (skins_.empty()) { return current_id_; } - for (size_t i = 0; i < skins_.size(); ++i) { - if (skins_[i].id == current_id_) { - return skins_[(i + 1) % skins_.size()].id; - } - } - return skins_.front().id; -} - -auto SkinManager::prevSkinId() const -> std::string { - if (skins_.empty()) { return current_id_; } - for (size_t i = 0; i < skins_.size(); ++i) { - if (skins_[i].id == current_id_) { - return skins_[(i + skins_.size() - 1) % skins_.size()].id; - } - } - return skins_.front().id; -} diff --git a/source/core/resources/skin_manager.hpp b/source/core/resources/skin_manager.hpp deleted file mode 100644 index b3cc64a..0000000 --- a/source/core/resources/skin_manager.hpp +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -#include -#include - -// Gestor de skins. Una "skin" és un set complet de gràfics (PNGs + .ani) -// emmagatzemat sota `data/skins//gfx/`. El SkinManager: -// -// * descobreix les skins disponibles escanejant `data/skins/*/skin.yaml`, -// * recorda quina skin està activa (`current_id_`), -// * composa els paths perquè Asset/Resource sàpiguen on llegir. -// -// L'arrencada típica és: Director crida `init(executable_path, asset_prefix)` -// (escaneja manifests) i acte seguit `setCurrent(Options::settings.skin)`. -// Després registra els assets via `Asset::addSkinAware("balloon1.png", ...)` -// que utilitza internament `gfxPath()` del SkinManager. -// -// Per al canvi en calent, Resource crida `setCurrent(new_id)`, després -// `Asset::onSkinChanged()` per a actualitzar paths registrats, i recarrega -// cada Texture via `reLoadFromPath`. - -class SkinManager { - public: - struct SkinInfo { - std::string id; // Carpeta dins data/skins/ (ex: "classic") - std::string display_name; // Etiqueta visible a la UI (ex: "Classic") - std::string gfx_dir; // Subcarpeta amb els gfx (default: "gfx") - }; - - // executable_path: acabat amb '/' (típicament SDL_GetBasePath()). - // asset_prefix: prefix relatiu per a paths registrats a Asset - // (ex: "" en Linux/Win, "/../Resources" dins el bundle de macOS). - static void init(const std::string &executable_path, const std::string &asset_prefix); - static void destroy(); - static auto get() -> SkinManager *; - - void scan(); - [[nodiscard]] auto available() const -> const std::vector & { return skins_; } - [[nodiscard]] auto current() const -> const std::string & { return current_id_; } - [[nodiscard]] auto currentDisplayName() const -> std::string; - [[nodiscard]] auto displayNameOf(const std::string &id) const -> std::string; - [[nodiscard]] auto exists(const std::string &id) const -> bool; - - void setCurrent(const std::string &id); - - // Compon el path relatiu d'un gràfic dins la skin activa, amb el format - // que Asset::add espera (relatiu amb prefix de plataforma): - // "/data/skins///" - [[nodiscard]] auto gfxPath(const std::string &basename) const -> std::string; - - // Cíclic. Si només hi ha una skin, retorna la mateixa. - [[nodiscard]] auto nextSkinId() const -> std::string; - [[nodiscard]] auto prevSkinId() const -> std::string; - - private: - SkinManager(std::string executable_path, std::string asset_prefix); - - [[nodiscard]] auto gfxDirOf(const std::string &id) const -> std::string; - - std::string executable_path_; // Acabat amb '/' (per a scan filesystem) - std::string asset_prefix_; // PREFIX per a paths registrats - std::vector skins_; - std::string current_id_{"classic"}; - - static SkinManager *instance; -}; diff --git a/source/core/system/director.cpp b/source/core/system/director.cpp index 7dc0112..bb0abef 100644 --- a/source/core/system/director.cpp +++ b/source/core/system/director.cpp @@ -26,7 +26,6 @@ #include "core/resources/asset.h" // for Asset, Asset::Type #include "core/resources/resource.h" #include "core/resources/resource_helper.h" -#include "core/resources/skin_manager.hpp" #include "game/defaults.hpp" // for SECTION_PROG_LOGO, GAMECANVAS_H... #include "game/game.h" // for Game #include "game/options.hpp" // for Options::init, loadFromFile... @@ -107,22 +106,6 @@ Director::Director(int argc, const char *argv[]) { Asset::init(executable_path_); Asset::get()->setVerbose(Options::settings.console); - // Inicialitza el gestor de skins ANTES de registrar assets: setFileList - // composa els paths gfx via SkinManager::gfxPath(). Si la skin del config - // no existeix, caiem a "classic". -#ifdef MACOS_BUNDLE - SkinManager::init(executable_path_, "/../Resources"); -#else - SkinManager::init(executable_path_, ""); -#endif - if (!SkinManager::get()->exists(Options::settings.skin)) { - if (Options::settings.console) { - std::cout << "Skin '" << Options::settings.skin << "' not found, falling back to 'classic'.\n"; - } - Options::settings.skin = "classic"; - } - SkinManager::get()->setCurrent(Options::settings.skin); - // Si falta algún fichero no inicia el programa if (!setFileList()) { exit(EXIT_FAILURE); @@ -201,7 +184,6 @@ Director::~Director() { Resource::destroy(); Asset::destroy(); - SkinManager::destroy(); Input::destroy(); Lang::destroy(); delete section_; @@ -249,7 +231,6 @@ void Director::initInput() { Input::get()->bindKey(Input::Action::TOGGLE_SHADER, SDL_SCANCODE_F4); Input::get()->bindKey(Input::Action::TOGGLE_SHADER_TYPE, SDL_SCANCODE_F5); Input::get()->bindKey(Input::Action::NEXT_SHADER_PRESET, SDL_SCANCODE_F6); - Input::get()->bindKey(Input::Action::NEXT_SKIN, SDL_SCANCODE_F7); // Mando - Movimiento del jugador Input::get()->bindGameControllerButton(Input::Action::UP, SDL_GAMEPAD_BUTTON_DPAD_UP); @@ -382,66 +363,66 @@ auto Director::setFileList() -> bool { Asset::get()->add(PREFIX + "/data/sound/clock.wav", Asset::Type::SOUND); Asset::get()->add(PREFIX + "/data/sound/powerball.wav", Asset::Type::SOUND); - // Texturas (skin-aware: viuen sota data/skins//gfx/) - Asset::get()->addSkinAware("balloon1.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("balloon1.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("balloon2.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("balloon2.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("balloon3.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("balloon3.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("balloon4.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("balloon4.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("bullet.png", Asset::Type::BITMAP); + // Texturas + Asset::get()->add(PREFIX + "/data/gfx/balloon1.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/balloon1.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/balloon2.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/balloon2.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/balloon3.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/balloon3.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/balloon4.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/balloon4.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/bullet.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("game_buildings.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("game_clouds.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("game_grass.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("game_power_meter.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("game_sky_colors.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("game_text.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/game_buildings.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/game_clouds.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/game_grass.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/game_power_meter.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/game_sky_colors.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/game_text.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("intro.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("logo.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("menu_game_over.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("menu_game_over_end.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/intro.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/logo.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/menu_game_over.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/menu_game_over_end.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("item_points1_disk.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("item_points1_disk.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("item_points2_gavina.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("item_points2_gavina.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("item_points3_pacmar.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("item_points3_pacmar.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("item_clock.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("item_clock.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("item_coffee.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("item_coffee.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("item_coffee_machine.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("item_coffee_machine.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/item_points1_disk.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/item_points1_disk.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/item_points2_gavina.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/item_points2_gavina.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/item_points3_pacmar.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/item_points3_pacmar.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/item_clock.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/item_clock.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/item_coffee.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/item_coffee.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/item_coffee_machine.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/item_coffee_machine.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("title_bg_tile.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("title_coffee.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("title_crisis.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("title_dust.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("title_dust.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("title_gradient.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/title_bg_tile.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/title_coffee.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/title_crisis.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/title_dust.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/title_dust.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/title_gradient.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("player_head.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("player_body.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("player_legs.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("player_death.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("player_fire.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/player_head.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/player_body.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/player_legs.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/player_death.ani", Asset::Type::DATA); + Asset::get()->add(PREFIX + "/data/gfx/player_fire.ani", Asset::Type::DATA); - Asset::get()->addSkinAware("player_bal1_head.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("player_bal1_body.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("player_bal1_legs.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("player_bal1_death.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("player_bal1_fire.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/player_bal1_head.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/player_bal1_body.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/player_bal1_legs.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/player_bal1_death.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/player_bal1_fire.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("player_arounder_head.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("player_arounder_body.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("player_arounder_legs.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("player_arounder_death.png", Asset::Type::BITMAP); - Asset::get()->addSkinAware("player_arounder_fire.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/player_arounder_head.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/player_arounder_body.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/player_arounder_legs.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/player_arounder_death.png", Asset::Type::BITMAP); + Asset::get()->add(PREFIX + "/data/gfx/player_arounder_fire.png", Asset::Type::BITMAP); // Fuentes Asset::get()->add(PREFIX + "/data/font/8bithud.png", Asset::Type::FONT); diff --git a/source/game/options.cpp b/source/game/options.cpp index fcde0f8..16cc1d2 100644 --- a/source/game/options.cpp +++ b/source/game/options.cpp @@ -151,7 +151,6 @@ namespace Options { } settings.language = static_cast(language_int); parseIntField(st, "player_selected", settings.player_selected); - parseStringField(st, "skin", settings.skin); } void loadGameplayFromYaml(const fkyaml::node &yaml) { @@ -323,8 +322,7 @@ namespace Options { file << "settings:\n"; file << " difficulty: " << settings.difficulty << "\n"; file << " language: " << static_cast(settings.language) << "\n"; - file << " player_selected: " << settings.player_selected << "\n"; - file << " skin: \"" << settings.skin << "\"\n\n"; + file << " player_selected: " << settings.player_selected << "\n\n"; // GAMEPLAY file << "# GAMEPLAY\n"; diff --git a/source/game/options.hpp b/source/game/options.hpp index d6bb551..bcf0c11 100644 --- a/source/game/options.hpp +++ b/source/game/options.hpp @@ -78,7 +78,6 @@ namespace Options { bool console = false; int player_selected = 0; std::string config_file; - std::string skin = "classic"; }; struct Gameplay {