From c064e80be2e04aae67cd07f7544b4d76f7ad9868 Mon Sep 17 00:00:00 2001 From: Joaquin Gottlebe Date: Fri, 12 Dec 2025 20:58:53 +0100 Subject: [PATCH] refactor: appTypes.c to app.h --- include/{appTypes.h => app.h} | 18 ++++++++++++++++++ src/app.c | 4 +--- src/appGame.c | 3 +-- src/appGameBirds.c | 3 +-- src/appGameEnemies.c | 7 ++++--- src/appGameFloor.c | 3 +-- src/appGameIslands.c | 2 +- src/appGamePlayer.c | 2 +- src/appGameShoot.c | 2 +- src/appLogo.c | 2 +- src/appMenu.c | 2 +- src/appMenuMain.c | 2 +- src/appMenuMainBackground.c | 2 +- src/appMenuSettings.c | 2 +- src/appState.c | 2 +- src/main.c | 2 +- 16 files changed, 36 insertions(+), 22 deletions(-) rename include/{appTypes.h => app.h} (96%) diff --git a/include/appTypes.h b/include/app.h similarity index 96% rename from include/appTypes.h rename to include/app.h index e83c720..1d2836f 100644 --- a/include/appTypes.h +++ b/include/app.h @@ -153,10 +153,28 @@ typedef enum ENEMIES_TEX_COUNT } enemiesTextureID; +typedef enum +{ + START, + SHIP_COUNT +} shipID; + +typedef struct +{ + int id; + char* assetPath; + int frameSize; + int speed0; + int speed1; + int speed2; + int rotationSpeed; +}Ship; + #define MAX_ENEMIES 100 typedef struct { + Config config; int count; Sprite sprite[MAX_ENEMIES]; Animation animation[MAX_ENEMIES]; diff --git a/src/app.c b/src/app.c index f7a45d8..bb752b2 100644 --- a/src/app.c +++ b/src/app.c @@ -1,6 +1,4 @@ -#include - -#include "appTypes.h" +#include "app.h" void ConfigApp(App* app){ InitConfig(&app->config, "config/config.ini"); diff --git a/src/appGame.c b/src/appGame.c index cb6921a..237d0ac 100644 --- a/src/appGame.c +++ b/src/appGame.c @@ -1,5 +1,4 @@ -#include "engine.h" -#include "appTypes.h" +#include "app.h" const ShaderAsset shaderAssets[SHADER_COUNT] = { {"shaders/postfx.fs"} diff --git a/src/appGameBirds.c b/src/appGameBirds.c index 083b740..e9f1699 100644 --- a/src/appGameBirds.c +++ b/src/appGameBirds.c @@ -1,5 +1,4 @@ -#include "appTypes.h" -#include "engine.h" +#include "app.h" const TextureAsset birdsTextureAssets[BIRDS_TEX_COUNT] = { diff --git a/src/appGameEnemies.c b/src/appGameEnemies.c index 5a76c19..ec52555 100644 --- a/src/appGameEnemies.c +++ b/src/appGameEnemies.c @@ -1,11 +1,12 @@ -#include "appTypes.h" -#include "engine.h" +#include "app.h" + + const TextureAsset enemiesTextureAssets[ENEMIES_TEX_COUNT] = { {"assets/ship_start.png", 16.0f, 16.0f, 90.0f} }; -Enemies CreateEnemies(void){ +Enemies CreateEnemies(void){ Enemies enemies = {.count = MAX_ENEMIES}; TextureAsset textureAsset = enemiesTextureAssets[BOAT]; Texture2D texture = LoadTexture(textureAsset.path); diff --git a/src/appGameFloor.c b/src/appGameFloor.c index 3644f1d..d8a7e60 100644 --- a/src/appGameFloor.c +++ b/src/appGameFloor.c @@ -1,5 +1,4 @@ -#include "engine.h" -#include "appTypes.h" +#include "app.h" Floor CreateFloor(void) { diff --git a/src/appGameIslands.c b/src/appGameIslands.c index 45b591e..6398757 100644 --- a/src/appGameIslands.c +++ b/src/appGameIslands.c @@ -1,4 +1,4 @@ -#include "appTypes.h" +#include "app.h" const TextureAsset islandsTextureAssets[ISLANDS_TEX_COUNT] = { {"assets/island.png", 16.0f, 16.0f, 0.0f} diff --git a/src/appGamePlayer.c b/src/appGamePlayer.c index 0b094a7..93608cb 100644 --- a/src/appGamePlayer.c +++ b/src/appGamePlayer.c @@ -1,4 +1,4 @@ -#include "appTypes.h" +#include "app.h" const TextureAsset playerTextureAssets[PLAYER_TEX_COUNT] = { {"assets/ship_start.png", 16.0f, 16.0f, 0.0f} diff --git a/src/appGameShoot.c b/src/appGameShoot.c index ff8ae30..90353e2 100644 --- a/src/appGameShoot.c +++ b/src/appGameShoot.c @@ -1,3 +1,3 @@ -#include "appTypes.h" +#include "app.h" diff --git a/src/appLogo.c b/src/appLogo.c index 3787c00..9e2e653 100644 --- a/src/appLogo.c +++ b/src/appLogo.c @@ -1,4 +1,4 @@ -#include "appTypes.h" +#include "app.h" void InitLogo(LogoState *l) { SetTargetFPS(60); diff --git a/src/appMenu.c b/src/appMenu.c index 59ae4b6..2bcc27c 100644 --- a/src/appMenu.c +++ b/src/appMenu.c @@ -1,4 +1,4 @@ -#include "appTypes.h" +#include "app.h" void InitMenu(MenuState *m) { diff --git a/src/appMenuMain.c b/src/appMenuMain.c index 556b224..f6949d6 100644 --- a/src/appMenuMain.c +++ b/src/appMenuMain.c @@ -1,4 +1,4 @@ -#include "appTypes.h" +#include "app.h" const TextureAsset menuTextureAssets[MENU_TEX_COUNT] = { diff --git a/src/appMenuMainBackground.c b/src/appMenuMainBackground.c index 1cd99aa..c7bbbe0 100644 --- a/src/appMenuMainBackground.c +++ b/src/appMenuMainBackground.c @@ -1,4 +1,4 @@ -#include "appTypes.h" +#include "app.h" void InitBackground(float scrollSpeed, Background *bg, Texture2D *texture, const TextureAsset *backgroundAsset){ bg->scrolling = 0.0f; diff --git a/src/appMenuSettings.c b/src/appMenuSettings.c index 161b4b5..c7ea923 100644 --- a/src/appMenuSettings.c +++ b/src/appMenuSettings.c @@ -1,4 +1,4 @@ -#include "appTypes.h" +#include "app.h" void InitMenuSettings(MenuSettings *s) { diff --git a/src/appState.c b/src/appState.c index dedbded..b5114f8 100644 --- a/src/appState.c +++ b/src/appState.c @@ -1,4 +1,4 @@ -#include "appTypes.h" +#include "app.h" void OnEscapeChangeView(App *app, View view) { diff --git a/src/main.c b/src/main.c index ee9ad5f..bdcab9d 100644 --- a/src/main.c +++ b/src/main.c @@ -1,4 +1,4 @@ -#include "appTypes.h" +#include "app.h" int main(void) {