reestructuració

This commit is contained in:
2026-04-17 17:15:38 +02:00
parent 55caef3210
commit 5fec0110b3
66 changed files with 221 additions and 217 deletions

View File

@@ -4,67 +4,67 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Project Overview
Coffee Crisis is a C++20 arcade game built with SDL2. The player controls a character defending the UPV (university) from bouncing coffee-ball enemies across 10 stages. Supports 1-2 players, keyboard and gamepad input, and multiple languages (Spanish, Basque, English).
Coffee Crisis is a C++20 arcade game built with SDL3. The player controls a character defending the UPV (university) from bouncing coffee-ball enemies across 10 stages. Supports 1-2 players, keyboard and gamepad input, and multiple languages (Spanish, Basque, English).
## Build Commands
Dependencies: `libsdl2-dev` and `g++` (Linux) or `clang++` (macOS).
Dependencies: `libsdl3-dev` and `g++` (Linux) or `clang++` (macOS). Build system is CMake (driven by `Makefile` wrappers).
```bash
# Linux
make linux # Release build → ./coffee_crisis
make linux_debug # Debug build (defines DEBUG and PAUSE) → ./coffee_crisis_debug
# macOS
make macos # Release build with clang++
make macos_debug # Debug build
# Windows (MinGW)
make windows # Release build → coffee_crisis.exe
make windows_debug # Debug build
# Release packaging
make linux_release # Builds and creates .tar.gz
make macos_release # Builds Intel + Apple Silicon .dmg files
make windows_release # Builds and creates .zip
make # Release build
make debug # Debug build (defines DEBUG and PAUSE)
make release # Empaqueta .tar.gz / .dmg / .zip segons SO
make pack # Regenera resources.pack
make controllerdb # Descarga gamecontrollerdb.txt
make format # clang-format -i
make tidy # clang-tidy
make cppcheck # cppcheck
```
There is also a CMakeLists.txt available as an alternative build system.
There are no tests or linter configured.
## Architecture
All source code is in `source/`. The game uses a section-based architecture controlled by the **Director** class:
Source layout (alineat amb la resta de projectes germans):
- **Director** (`director.h/cpp`): Top-level controller. Initializes SDL, manages the window/renderer, and runs sections in sequence: Logo → Intro → Title → Game → Quit. Owns all shared objects (Screen, Input, Lang, Asset).
- **Game** (`game.h/cpp`): Core gameplay logic. Manages players, balloons (enemies), bullets, items, stages, menace level, and collision detection. Contains its own update/render loop plus sub-loops for pause and game over screens.
- **Screen** (`screen.h/cpp`): Rendering abstraction. Manages a virtual canvas (256×192) that gets scaled to the actual window. Handles fullscreen/windowed modes, border rendering, and fade effects.
- **Input** (`input.h/cpp`): Abstracts keyboard and gamepad input.
- **Asset** (`asset.h/cpp`): Resource file index. Files are registered with `add()` and retrieved by name with `get()`. All paths are relative to the executable.
- **Lang** (`lang.h/cpp`): i18n system loading text strings from files in `data/lang/`.
```
source/
├── main.cpp
├── core/
│ ├── audio/ jail_audio.hpp
│ ├── input/ input.*, mouse.*
│ ├── locale/ lang.*
│ ├── rendering/ screen, fade, text, writer, texture, sprite + animated/moving/smart
│ ├── resources/ asset, resource, resource_pack, resource_loader, resource_helper
│ └── system/ director
├── game/
│ ├── defaults.hpp (constants de gameplay: block size, canvas, áreas, colors)
│ ├── game.* (hub de gameplay)
│ ├── entities/ player, balloon, bullet, item
│ ├── scenes/ logo, intro, title, instructions
│ └── ui/ menu
├── utils/
│ ├── defines.hpp (macros de build)
│ └── utils.* (helpers, enum de dificultat, circle_t, ...)
└── external/ (stb_image, stb_vorbis — protegits amb dummies `.clang-*`)
```
### Sprite hierarchy
Flux general controlat per la classe **Director** (`core/system/director.h`): inicialitza SDL, finestra/renderer i executa seccions en seqüència **Logo → Intro → Title → Game → Quit**. Les classes principals:
- **Sprite** → base class for drawing from a PNG spritesheet
- **AnimatedSprite** → extends Sprite with frame-based animation (loaded from `.ani` files)
- **MovingSprite** → sprite with movement
- **SmartSprite** → sprite with autonomous behavior (score popups, thrown items)
- **Game** (`game/game.h`): gameplay nuclear. Gestiona jugadors, balloons, bullets, items, stages, nivell d'amenaça i col·lisions. Té el seu bucle d'update/render i sub-bucles per pausa i game-over.
- **Screen** (`core/rendering/screen.h`): abstracció de render. Canvas virtual 256×192 escalat a la finestra. Fullscreen/windowed, borders, fades.
- **Input** (`core/input/input.h`): abstracció de teclat i gamepad.
- **Asset** (`core/resources/asset.h`): índex de fitxers de recurs (`add`/`get` per nom).
- **Lang** (`core/locale/lang.h`): i18n, carrega strings des de `data/lang/`.
### Game entities
### Sprite hierarchy (`core/rendering/`)
- **Player** (`player.h/cpp`): Player character state and rendering
- **Balloon** (`balloon.h/cpp`): Enemy entities with multiple types and split-on-pop behavior
- **Bullet** (`bullet.h/cpp`): Projectiles fired by the player (left/center/right)
- **Item** (`item.h/cpp`): Collectible items (points, clock, coffee, power-ups)
- **Sprite** → base per dibuixar des d'un spritesheet PNG
- **AnimatedSprite** → afegeix animació per frames (arxius `.ani`)
- **MovingSprite** → sprite amb posició/velocitat
- **SmartSprite** → sprite autònom (score popups, objectes llençats)
### Audio
**jail_audio** (`jail_audio.h/cpp`): Custom audio library wrapping SDL2 audio. Uses stb_vorbis for OGG decoding. Provides `JA_*` functions for music and sound effects with channel-based mixing.
### Key constants
Defined in `const.h`: block size (8px), virtual canvas (256×192), play area bounds, section/subsection IDs, and color definitions.
**jail_audio** (`core/audio/jail_audio.hpp`): wrapper audio SDL3 first-party. Usa stb_vorbis per OGG. API `JA_*` per música i efectes amb mesclat per canals.
## Data Directory

View File

@@ -26,8 +26,9 @@ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os -ffunction-sections
# Define el directorio de los archivos fuente
set(DIR_SOURCES "${CMAKE_SOURCE_DIR}/source")
# Cargar todos los archivos fuente en DIR_SOURCES
file(GLOB SOURCES "${DIR_SOURCES}/*.cpp")
# Cargar todos los archivos fuente en DIR_SOURCES (recursivo, sin external/)
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS "${DIR_SOURCES}/*.cpp")
list(FILTER SOURCES EXCLUDE REGEX "${DIR_SOURCES}/external/.*")
# Verificar si se encontraron archivos fuente
if(NOT SOURCES)
@@ -57,6 +58,9 @@ endif()
# Añadir ejecutable principal
add_executable(${PROJECT_NAME} ${SOURCES})
# Includes relatius a source/ (p.e. `#include "core/rendering/texture.h"`)
target_include_directories(${PROJECT_NAME} PRIVATE ${DIR_SOURCES})
# Configuración de salida: el ejecutable principal va a la raíz del proyecto.
# Per-target (no global) perquè `pack_resources` acabe a `build/` com la resta
# de projectes.
@@ -204,7 +208,7 @@ endif()
if(NOT EMSCRIPTEN)
add_executable(pack_resources EXCLUDE_FROM_ALL
tools/pack_resources/pack_resources.cpp
source/resource_pack.cpp
source/core/resources/resource_pack.cpp
)
target_include_directories(pack_resources PRIVATE "${CMAKE_SOURCE_DIR}/source")
target_compile_options(pack_resources PRIVATE -Wall)

View File

@@ -19,9 +19,9 @@ RESOURCE_FILE := release/windows/coffee.res
# VERSION (extracted from defines.hpp)
# ==============================================================================
ifeq ($(OS),Windows_NT)
VERSION := $(shell powershell -Command "(Select-String -Path 'source/defines.hpp' -Pattern 'constexpr const char\* VERSION = \"(.+?)\"').Matches.Groups[1].Value")
VERSION := $(shell powershell -Command "(Select-String -Path 'source/utils/defines.hpp' -Pattern 'constexpr const char\* VERSION = \"(.+?)\"').Matches.Groups[1].Value")
else
VERSION := $(shell grep 'constexpr const char\* VERSION' source/defines.hpp | sed -E 's/.*VERSION = "([^"]+)".*/\1/')
VERSION := $(shell grep 'constexpr const char\* VERSION' source/utils/defines.hpp | sed -E 's/.*VERSION = "([^"]+)".*/\1/')
endif
# ==============================================================================

View File

@@ -1,4 +1,4 @@
#include "input.h"
#include "core/input/input.h"
#include <SDL3/SDL.h>

View File

@@ -1,4 +1,4 @@
#include "mouse.hpp"
#include "core/input/mouse.hpp"
namespace Mouse {
Uint32 cursorHideTime = 3000; // Tiempo en milisegundos para ocultar el cursor por inactividad

View File

@@ -1,10 +1,10 @@
#include "lang.h"
#include "core/locale/lang.h"
#include <fstream> // for basic_ifstream, basic_istream, ifstream
#include <sstream>
#include "asset.h" // for Asset
#include "resource_helper.h"
#include "core/resources/asset.h" // for Asset
#include "core/resources/resource_helper.h"
// Constructor
Lang::Lang(Asset *mAsset) {

View File

@@ -1,10 +1,10 @@
#include "animatedsprite.h"
#include "core/rendering/animatedsprite.h"
#include <fstream> // for basic_ostream, operator<<, basic_istream, basic...
#include <iostream> // for cout
#include <sstream> // for basic_stringstream
#include "texture.h" // for Texture
#include "core/rendering/texture.h" // for Texture
// Parser compartido: lee un istream con el formato .ani
static animatedSprite_t parseAnimationStream(std::istream &file, Texture *texture, const std::string &filename, bool verbose) {

View File

@@ -6,7 +6,7 @@
#include <string> // for string, basic_string
#include <vector> // for vector
#include "movingsprite.h" // for MovingSprite
#include "core/rendering/movingsprite.h" // for MovingSprite
class Texture;
struct animation_t {

View File

@@ -1,11 +1,11 @@
#include "fade.h"
#include "core/rendering/fade.h"
#include <SDL3/SDL.h>
#include <stdlib.h> // for rand
#include <iostream> // for char_traits, basic_ostream, operator<<
#include "const.h" // for GAMECANVAS_HEIGHT, GAMECANVAS_WIDTH
#include "game/defaults.hpp" // for GAMECANVAS_HEIGHT, GAMECANVAS_WIDTH
// Constructor
Fade::Fade(SDL_Renderer *renderer) {

View File

@@ -1,6 +1,6 @@
#include "movingsprite.h"
#include "core/rendering/movingsprite.h"
#include "texture.h" // for Texture
#include "core/rendering/texture.h" // for Texture
// Constructor
MovingSprite::MovingSprite(float x, float y, int w, int h, float velx, float vely, float accelx, float accely, Texture *texture, SDL_Renderer *renderer) {

View File

@@ -2,7 +2,7 @@
#include <SDL3/SDL.h>
#include "sprite.h" // for Sprite
#include "core/rendering/sprite.h" // for Sprite
class Texture;
// Clase MovingSprite. Añade posicion y velocidad en punto flotante

View File

@@ -1,4 +1,4 @@
#include "screen.h"
#include "core/rendering/screen.h"
#include <SDL3/SDL.h>
@@ -6,10 +6,10 @@
#include <iostream> // for basic_ostream, operator<<, cout, endl
#include <string> // for basic_string, char_traits, string
#include "asset.h" // for Asset
#include "mouse.hpp" // for Mouse::cursorVisible, Mouse::lastMouseMoveTime
#include "resource.h"
#include "text.h" // for Text, TXT_CENTER, TXT_COLOR, TXT_STROKE
#include "core/input/mouse.hpp" // for Mouse::cursorVisible, Mouse::lastMouseMoveTime
#include "core/rendering/text.h" // for Text, TXT_CENTER, TXT_COLOR, TXT_STROKE
#include "core/resources/asset.h" // for Asset
#include "core/resources/resource.h"
#ifdef __EMSCRIPTEN__
#include <emscripten.h>

View File

@@ -4,7 +4,7 @@
#include <string> // for string
#include "utils.h" // for color_t
#include "utils/utils.h" // for color_t
class Asset;
class Text;

View File

@@ -1,6 +1,6 @@
#include "smartsprite.h"
#include "core/rendering/smartsprite.h"
#include "movingsprite.h" // for MovingSprite
#include "core/rendering/movingsprite.h" // for MovingSprite
class Texture;
// Constructor

View File

@@ -2,7 +2,7 @@
#include <SDL3/SDL.h>
#include "animatedsprite.h" // for AnimatedSprite
#include "core/rendering/animatedsprite.h" // for AnimatedSprite
class Texture;
// Clase SmartSprite

View File

@@ -1,6 +1,6 @@
#include "sprite.h"
#include "core/rendering/sprite.h"
#include "texture.h" // for Texture
#include "core/rendering/texture.h" // for Texture
// Constructor
Sprite::Sprite(int x, int y, int w, int h, Texture *texture, SDL_Renderer *renderer) {

View File

@@ -1,13 +1,13 @@
#include "text.h"
#include "core/rendering/text.h"
#include <fstream> // for char_traits, basic_ostream, basic_ifstream, ope...
#include <iostream> // for cout
#include <sstream>
#include "sprite.h" // for Sprite
#include "texture.h" // for Texture
#include "utils.h" // for color_t
#include "core/rendering/sprite.h" // for Sprite
#include "core/rendering/texture.h" // for Texture
#include "utils/utils.h" // for color_t
// Parser compartido: rellena un textFile_t desde cualquier istream
static void parseTextFileStream(std::istream &rfile, textFile_t &tf) {

View File

@@ -7,7 +7,7 @@
#include <vector>
class Sprite;
class Texture;
#include "utils.h"
#include "utils/utils.h"
// Opciones de texto
constexpr int TXT_COLOR = 1;

View File

@@ -1,5 +1,5 @@
#include "texture.h"
#include "core/rendering/texture.h"
#include <SDL3/SDL.h>
#include <stdlib.h> // for exit

View File

@@ -1,6 +1,6 @@
#include "writer.h"
#include "core/rendering/writer.h"
#include "text.h" // for Text
#include "core/rendering/text.h" // for Text
// Constructor
Writer::Writer(Text *text) {

View File

@@ -1,11 +1,11 @@
#include "asset.h"
#include "core/resources/asset.h"
#include <SDL3/SDL.h>
#include <stddef.h> // for size_t
#include <iostream> // for basic_ostream, operator<<, cout, endl
#include "resource_helper.h"
#include "core/resources/resource_helper.h"
// Constructor
Asset::Asset(std::string executablePath) {

View File

@@ -1,16 +1,16 @@
#include "resource.h"
#include "core/resources/resource.h"
#include <algorithm>
#include <filesystem>
#include <iostream>
#include <sstream>
#include "asset.h"
#include "jail_audio.hpp"
#include "menu.h"
#include "resource_helper.h"
#include "text.h"
#include "texture.h"
#include "core/audio/jail_audio.hpp"
#include "core/rendering/text.h"
#include "core/rendering/texture.h"
#include "core/resources/asset.h"
#include "core/resources/resource_helper.h"
#include "game/ui/menu.h"
Resource *Resource::instance_ = nullptr;

View File

@@ -1,11 +1,11 @@
#include "resource_helper.h"
#include "core/resources/resource_helper.h"
#include <algorithm>
#include <cstddef>
#include <fstream>
#include <iostream>
#include "resource_loader.h"
#include "core/resources/resource_loader.h"
namespace ResourceHelper {
static bool resource_system_initialized = false;

View File

@@ -1,11 +1,11 @@
#include "resource_loader.h"
#include "core/resources/resource_loader.h"
#include <algorithm>
#include <filesystem>
#include <fstream>
#include <iostream>
#include "resource_pack.h"
#include "core/resources/resource_pack.h"
std::unique_ptr<ResourceLoader> ResourceLoader::instance = nullptr;

View File

@@ -1,4 +1,4 @@
#include "resource_pack.h"
#include "core/resources/resource_pack.h"
#include <algorithm>
#include <array>

View File

@@ -1,4 +1,4 @@
#include "director.h"
#include "core/system/director.h"
#include <SDL3/SDL.h>
#include <errno.h> // for errno, EEXIST, EACCES, ENAMETOO...
@@ -17,21 +17,21 @@
#include <string> // for basic_string, operator+, char_t...
#include <vector> // for vector
#include "asset.h" // for Asset, assetType
#include "const.h" // for SECTION_PROG_LOGO, GAMECANVAS_H...
#include "game.h" // for Game
#include "input.h" // for Input, inputs_e, INPUT_USE_GAME...
#include "intro.h" // for Intro
#include "jail_audio.hpp" // for JA_Init
#include "lang.h" // for Lang, MAX_LANGUAGES, ba_BA, en_UK
#include "logo.h" // for Logo
#include "mouse.hpp" // for Mouse::handleEvent, Mouse::upda...
#include "resource.h"
#include "resource_helper.h"
#include "screen.h" // for FILTER_NEAREST, Screen, FILTER_...
#include "texture.h" // for Texture
#include "title.h" // for Title
#include "utils.h" // for options_t, input_t, boolToString
#include "core/audio/jail_audio.hpp" // for JA_Init
#include "core/input/input.h" // for Input, inputs_e, INPUT_USE_GAME...
#include "core/input/mouse.hpp" // for Mouse::handleEvent, Mouse::upda...
#include "core/locale/lang.h" // for Lang, MAX_LANGUAGES, ba_BA, en_UK
#include "core/rendering/screen.h" // for FILTER_NEAREST, Screen, FILTER_...
#include "core/rendering/texture.h" // for Texture
#include "core/resources/asset.h" // for Asset, assetType
#include "core/resources/resource.h"
#include "core/resources/resource_helper.h"
#include "game/defaults.hpp" // for SECTION_PROG_LOGO, GAMECANVAS_H...
#include "game/game.h" // for Game
#include "game/scenes/intro.h" // for Intro
#include "game/scenes/logo.h" // for Logo
#include "game/scenes/title.h" // for Title
#include "utils/utils.h" // for options_t, input_t, boolToString
#if !defined(_WIN32) && !defined(__EMSCRIPTEN__)
#include <pwd.h>

View File

@@ -2,8 +2,8 @@
#include <SDL3/SDL.h>
#include "lang.h"
#include "utils.h"
#include "core/locale/lang.h"
#include "utils/utils.h"
// Tamaño de bloque
constexpr int BLOCK = 8;

View File

@@ -1,12 +1,12 @@
#include "balloon.h"
#include "game/entities/balloon.h"
#include <math.h> // for abs
#include "animatedsprite.h" // for AnimatedSprite
#include "const.h" // for PLAY_AREA_LEFT, PLAY_AREA_RIGHT, PLAY_AR...
#include "movingsprite.h" // for MovingSprite
#include "sprite.h" // for Sprite
#include "texture.h" // for Texture
#include "core/rendering/animatedsprite.h" // for AnimatedSprite
#include "core/rendering/movingsprite.h" // for MovingSprite
#include "core/rendering/sprite.h" // for Sprite
#include "core/rendering/texture.h" // for Texture
#include "game/defaults.hpp" // for PLAY_AREA_LEFT, PLAY_AREA_RIGHT, PLAY_AR...
// Constructor
Balloon::Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 creationtimer, Texture *texture, std::vector<std::string> *animation, SDL_Renderer *renderer) {

View File

@@ -5,7 +5,7 @@
#include <string> // for string
#include <vector> // for vector
#include "utils.h" // for circle_t
#include "utils/utils.h" // for circle_t
class AnimatedSprite;
class Texture;

View File

@@ -1,7 +1,7 @@
#include "bullet.h"
#include "game/entities/bullet.h"
#include "const.h" // for NO_KIND, PLAY_AREA_LEFT, PLAY_AREA_RIGHT, PLAY_A...
#include "sprite.h" // for Sprite
#include "core/rendering/sprite.h" // for Sprite
#include "game/defaults.hpp" // for NO_KIND, PLAY_AREA_LEFT, PLAY_AREA_RIGHT, PLAY_A...
class Texture;
// Constructor

View File

@@ -2,7 +2,7 @@
#include <SDL3/SDL.h>
#include "utils.h" // for circle_t
#include "utils/utils.h" // for circle_t
class Sprite;
class Texture;

View File

@@ -1,9 +1,9 @@
#include "item.h"
#include "game/entities/item.h"
#include <stdlib.h> // for rand
#include "animatedsprite.h" // for AnimatedSprite
#include "const.h" // for PLAY_AREA_LEFT, PLAY_AREA_RIGHT, PLAY_AR...
#include "core/rendering/animatedsprite.h" // for AnimatedSprite
#include "game/defaults.hpp" // for PLAY_AREA_LEFT, PLAY_AREA_RIGHT, PLAY_AR...
class Texture;
// Constructor

View File

@@ -5,7 +5,7 @@
#include <string> // for string
#include <vector> // for vector
#include "utils.h" // for circle_t
#include "utils/utils.h" // for circle_t
class AnimatedSprite;
class Texture;

View File

@@ -1,11 +1,11 @@
#include "player.h"
#include "game/entities/player.h"
#include <stdlib.h> // for rand
#include "animatedsprite.h" // for AnimatedSprite
#include "const.h" // for PLAY_AREA_LEFT, PLAY_AREA_RIGHT
#include "input.h" // for inputs_e
#include "texture.h" // for Texture
#include "core/input/input.h" // for inputs_e
#include "core/rendering/animatedsprite.h" // for AnimatedSprite
#include "core/rendering/texture.h" // for Texture
#include "game/defaults.hpp" // for PLAY_AREA_LEFT, PLAY_AREA_RIGHT
// Constructor
Player::Player(float x, int y, SDL_Renderer *renderer, std::vector<Texture *> texture, std::vector<std::vector<std::string> *> animations) {

View File

@@ -5,7 +5,7 @@
#include <string> // for string
#include <vector> // for vector
#include "utils.h" // for circle_t
#include "utils/utils.h" // for circle_t
class AnimatedSprite;
class Texture;

View File

@@ -1,4 +1,4 @@
#include "game.h"
#include "game/game.h"
#include <SDL3/SDL.h>
#include <stdlib.h> // for rand
@@ -7,24 +7,24 @@
#include <fstream> // for basic_ifstream
#include <iostream> // for basic_ostream, char_traits, operator<<
#include "asset.h" // for Asset
#include "balloon.h" // for Balloon, BALLOON_VELX_NEGATIVE, BALLOON_...
#include "bullet.h" // for Bullet, BULLET_LEFT, BULLET_RIGHT, BULLE...
#include "const.h" // for PLAY_AREA_CENTER_X, BLOCK, PLAY_AREA_CEN...
#include "fade.h" // for Fade, FADE_CENTER
#include "input.h" // for inputs_e, Input, REPEAT_TRUE, REPEAT_FALSE
#include "item.h" // for Item, ITEM_COFFEE_MACHINE, ITEM_CLOCK
#include "jail_audio.hpp" // for JA_PlaySound, JA_DeleteSound, JA_LoadSound
#include "lang.h" // for Lang
#include "menu.h" // for Menu
#include "movingsprite.h" // for MovingSprite
#include "player.h" // for Player, DEATH_COUNTER
#include "resource.h"
#include "screen.h" // for Screen
#include "smartsprite.h" // for SmartSprite
#include "sprite.h" // for Sprite
#include "text.h" // for Text, TXT_CENTER
#include "texture.h" // for Texture
#include "core/audio/jail_audio.hpp" // for JA_PlaySound, JA_DeleteSound, JA_LoadSound
#include "core/input/input.h" // for inputs_e, Input, REPEAT_TRUE, REPEAT_FALSE
#include "core/locale/lang.h" // for Lang
#include "core/rendering/fade.h" // for Fade, FADE_CENTER
#include "core/rendering/movingsprite.h" // for MovingSprite
#include "core/rendering/screen.h" // for Screen
#include "core/rendering/smartsprite.h" // for SmartSprite
#include "core/rendering/sprite.h" // for Sprite
#include "core/rendering/text.h" // for Text, TXT_CENTER
#include "core/rendering/texture.h" // for Texture
#include "core/resources/asset.h" // for Asset
#include "core/resources/resource.h"
#include "game/defaults.hpp" // for PLAY_AREA_CENTER_X, BLOCK, PLAY_AREA_CEN...
#include "game/entities/balloon.h" // for Balloon, BALLOON_VELX_NEGATIVE, BALLOON_...
#include "game/entities/bullet.h" // for Bullet, BULLET_LEFT, BULLET_RIGHT, BULLE...
#include "game/entities/item.h" // for Item, ITEM_COFFEE_MACHINE, ITEM_CLOCK
#include "game/entities/player.h" // for Player, DEATH_COUNTER
#include "game/ui/menu.h" // for Menu
struct JA_Sound_t;
// Constructor

View File

@@ -5,7 +5,7 @@
#include <string> // for string, basic_string
#include <vector> // for vector
#include "utils.h" // for demoKeys_t, color_t
#include "utils/utils.h" // for demoKeys_t, color_t
class Asset;
class Balloon;
class Bullet;

View File

@@ -1,4 +1,4 @@
#include "instructions.h"
#include "game/scenes/instructions.h"
#include <SDL3/SDL.h>
@@ -6,17 +6,17 @@
#include <iostream> // for char_traits, basic_ostream, operator<<
#include <string> // for basic_string
#include "asset.h" // for Asset
#include "const.h" // for shdwTxtColor, GAMECANVAS_CENTER_X, GAME...
#include "input.h" // for Input, REPEAT_FALSE, inputs_e
#include "jail_audio.hpp" // for JA_StopMusic
#include "lang.h" // for Lang
#include "resource.h"
#include "screen.h" // for Screen
#include "sprite.h" // for Sprite
#include "text.h" // for Text, TXT_CENTER, TXT_COLOR, TXT_SHADOW
#include "texture.h" // for Texture
#include "utils.h" // for color_t, section_t
#include "core/audio/jail_audio.hpp" // for JA_StopMusic
#include "core/input/input.h" // for Input, REPEAT_FALSE, inputs_e
#include "core/locale/lang.h" // for Lang
#include "core/rendering/screen.h" // for Screen
#include "core/rendering/sprite.h" // for Sprite
#include "core/rendering/text.h" // for Text, TXT_CENTER, TXT_COLOR, TXT_SHADOW
#include "core/rendering/texture.h" // for Texture
#include "core/resources/asset.h" // for Asset
#include "core/resources/resource.h"
#include "game/defaults.hpp" // for shdwTxtColor, GAMECANVAS_CENTER_X, GAME...
#include "utils/utils.h" // for color_t, section_t
// Constructor
Instructions::Instructions(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, section_t *section) {

View File

@@ -1,21 +1,21 @@
#include "intro.h"
#include "game/scenes/intro.h"
#include <SDL3/SDL.h>
#include <string> // for basic_string
#include "asset.h" // for Asset
#include "const.h" // for GAMECANVAS_CENTER_X, GAMECANVAS_FIRST_QU...
#include "input.h" // for Input, REPEAT_FALSE, inputs_e
#include "jail_audio.hpp" // for JA_StopMusic, JA_DeleteMusic, JA_LoadMusic
#include "lang.h" // for Lang
#include "resource.h"
#include "screen.h" // for Screen
#include "smartsprite.h" // for SmartSprite
#include "text.h" // for Text
#include "texture.h" // for Texture
#include "utils.h" // for section_t, color_t
#include "writer.h" // for Writer
#include "core/audio/jail_audio.hpp" // for JA_StopMusic, JA_DeleteMusic, JA_LoadMusic
#include "core/input/input.h" // for Input, REPEAT_FALSE, inputs_e
#include "core/locale/lang.h" // for Lang
#include "core/rendering/screen.h" // for Screen
#include "core/rendering/smartsprite.h" // for SmartSprite
#include "core/rendering/text.h" // for Text
#include "core/rendering/texture.h" // for Texture
#include "core/rendering/writer.h" // for Writer
#include "core/resources/asset.h" // for Asset
#include "core/resources/resource.h"
#include "game/defaults.hpp" // for GAMECANVAS_CENTER_X, GAMECANVAS_FIRST_QU...
#include "utils/utils.h" // for section_t, color_t
// Constructor
Intro::Intro(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, Lang *lang, section_t *section) {

View File

@@ -1,19 +1,19 @@
#include "logo.h"
#include "game/scenes/logo.h"
#include <SDL3/SDL.h>
#include <algorithm> // for min
#include <string> // for basic_string
#include "asset.h" // for Asset
#include "const.h" // for bgColor, SECTION_PROG_LOGO, SECTION_PROG...
#include "input.h" // for Input, REPEAT_FALSE, inputs_e
#include "jail_audio.hpp" // for JA_StopMusic
#include "resource.h"
#include "screen.h" // for Screen
#include "sprite.h" // for Sprite
#include "texture.h" // for Texture
#include "utils.h" // for section_t, color_t
#include "core/audio/jail_audio.hpp" // for JA_StopMusic
#include "core/input/input.h" // for Input, REPEAT_FALSE, inputs_e
#include "core/rendering/screen.h" // for Screen
#include "core/rendering/sprite.h" // for Sprite
#include "core/rendering/texture.h" // for Texture
#include "core/resources/asset.h" // for Asset
#include "core/resources/resource.h"
#include "game/defaults.hpp" // for bgColor, SECTION_PROG_LOGO, SECTION_PROG...
#include "utils/utils.h" // for section_t, color_t
// Valores de inicialización y fin
constexpr int INIT_FADE = 100;

View File

@@ -1,4 +1,4 @@
#include "title.h"
#include "game/scenes/title.h"
#include <SDL3/SDL.h>
#include <stdlib.h> // for rand
@@ -6,21 +6,21 @@
#include <iostream> // for basic_ostream, operator<<, basic_ostrea...
#include <string> // for basic_string, operator+, char_traits
#include "animatedsprite.h" // for AnimatedSprite
#include "asset.h" // for Asset
#include "const.h" // for GAMECANVAS_CENTER_X, SECTION_PROG_QUIT
#include "fade.h" // for Fade
#include "game.h" // for Game
#include "input.h" // for Input, INPUT_USE_GAMECONTROLLER, INPUT_...
#include "jail_audio.hpp" // for JA_StopMusic, JA_GetMusicState, JA_Play...
#include "lang.h" // for Lang, ba_BA, en_UK, es_ES
#include "menu.h" // for Menu
#include "resource.h"
#include "screen.h" // for Screen, FILTER_LINEAL, FILTER_NEAREST
#include "smartsprite.h" // for SmartSprite
#include "sprite.h" // for Sprite
#include "text.h" // for Text, TXT_CENTER, TXT_SHADOW
#include "texture.h" // for Texture
#include "core/audio/jail_audio.hpp" // for JA_StopMusic, JA_GetMusicState, JA_Play...
#include "core/input/input.h" // for Input, INPUT_USE_GAMECONTROLLER, INPUT_...
#include "core/locale/lang.h" // for Lang, ba_BA, en_UK, es_ES
#include "core/rendering/animatedsprite.h" // for AnimatedSprite
#include "core/rendering/fade.h" // for Fade
#include "core/rendering/screen.h" // for Screen, FILTER_LINEAL, FILTER_NEAREST
#include "core/rendering/smartsprite.h" // for SmartSprite
#include "core/rendering/sprite.h" // for Sprite
#include "core/rendering/text.h" // for Text, TXT_CENTER, TXT_SHADOW
#include "core/rendering/texture.h" // for Texture
#include "core/resources/asset.h" // for Asset
#include "core/resources/resource.h"
#include "game/defaults.hpp" // for GAMECANVAS_CENTER_X, SECTION_PROG_QUIT
#include "game/game.h" // for Game
#include "game/ui/menu.h" // for Menu
// Constructor
Title::Title(SDL_Renderer *renderer, Screen *screen, Input *input, Asset *asset, options_t *options, Lang *lang, section_t *section) {

View File

@@ -4,8 +4,8 @@
#include <vector> // for vector
#include "instructions.h" // for mode_e
#include "utils.h" // for input_t, options_t, section_t
#include "game/scenes/instructions.h" // for mode_e
#include "utils/utils.h" // for input_t, options_t, section_t
class AnimatedSprite;
class Asset;
class Fade;

View File

@@ -1,14 +1,14 @@
#include "menu.h"
#include "game/ui/menu.h"
#include <algorithm> // for max, min
#include <fstream> // for char_traits, basic_ifstream, basic_istream
#include <sstream> // for basic_stringstream
#include "asset.h" // for Asset
#include "input.h" // for Input, REPEAT_FALSE, inputs_e
#include "jail_audio.hpp" // for JA_LoadSound, JA_PlaySound, JA_DeleteSound
#include "resource_helper.h"
#include "text.h" // for Text
#include "core/audio/jail_audio.hpp" // for JA_LoadSound, JA_PlaySound, JA_DeleteSound
#include "core/input/input.h" // for Input, REPEAT_FALSE, inputs_e
#include "core/rendering/text.h" // for Text
#include "core/resources/asset.h" // for Asset
#include "core/resources/resource_helper.h"
// Constructor
Menu::Menu(SDL_Renderer *renderer, Asset *asset, Input *input, std::string file) {

View File

@@ -6,7 +6,7 @@
#include <string> // for string, basic_string
#include <vector> // for vector
#include "utils.h" // for color_t
#include "utils/utils.h" // for color_t
class Asset;
class Input;
class Text;

View File

@@ -42,7 +42,7 @@ Reescribiendo el código el 27/09/2022
#define SDL_MAIN_USE_CALLBACKS 1
#include <SDL3/SDL_main.h>
#include "director.h"
#include "core/system/director.h"
#include "external/stb_vorbis.c"
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) {

View File

@@ -1,4 +1,4 @@
#include "utils.h"
#include "utils/utils.h"
#include <stdlib.h> // for abs, free, malloc

View File

@@ -1,7 +1,7 @@
#include <filesystem>
#include <iostream>
#include "resource_pack.h"
#include "core/resources/resource_pack.h"
static constexpr const char* APP_NAME = "Coffee Crisis";