From f515432af0ade3382bcc2106f4a625fbe570a059 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 22 Jan 2023 22:27:38 +0100 Subject: [PATCH] definitions verschoben --- Ui/button.c | 2 -- Ui/button.h | 9 --------- Ui/debug.h | 1 - Ui/screenIDs.h | 13 ------------- Ui/selectable.h | 5 ----- Ui/uiContainer.c | 1 - definitions.h | 28 ++++++++++++++++++++++++++++ game.c | 1 - game.h | 2 +- main.c | 1 - 10 files changed, 29 insertions(+), 34 deletions(-) delete mode 100644 Ui/screenIDs.h diff --git a/Ui/button.c b/Ui/button.c index 714617b..222dea5 100644 --- a/Ui/button.c +++ b/Ui/button.c @@ -1,6 +1,5 @@ #include "button.h" #include "../game.h" -#include "screenIDs.h" #include "stdio.h" #include "stdlib.h" #include "raylib.h" @@ -33,7 +32,6 @@ void ButtonExecuteButton(Button *button, Game *game){ game->screen = SCREEN_GAME; break; case BUTTON_ID_EXIT: - // wahrscheinlich kein guter stil, es muss noch zeug freigegeben werden oder soos... keine Ahnung game->screen = SCREEN_EXIT; break; case BUTTON_ID_START_GAME: diff --git a/Ui/button.h b/Ui/button.h index 23fb19c..1cff561 100644 --- a/Ui/button.h +++ b/Ui/button.h @@ -4,15 +4,6 @@ #include "raylib.h" #include "../game.h" -#define BUTTON_STATE_DEFAULT 0 // button is just there -#define BUTTON_STATE_HOVERED 1 // mouse is being hovered over the button -#define BUTTON_STATE_PRESSED 2 // left mouse button is down while hovering the button -#define BUTTON_STATE_RELEASED 3 // left mouse button is released while hovering the button, button code will be executed - -#define BUTTON_ID_CONTINUE 0 // going to game screen, supposed to be used from pause screen -#define BUTTON_ID_EXIT 1 // closing the game using exit code 0 -#define BUTTON_ID_START_GAME 2 // going to game screen, supposed to be used from mainmenu screen - typedef struct Button{ Texture2D textures[4]; // [0]: Normal [1]: Hovered [2]: Pressed [3]: Released Vector2 position; // Linke obere Ecke des Buttons diff --git a/Ui/debug.h b/Ui/debug.h index d1f2933..a1df213 100644 --- a/Ui/debug.h +++ b/Ui/debug.h @@ -4,7 +4,6 @@ #include "../game.h" #include "uiContainer.h" -#define DEBUG_FONT_SIZE 20 // Font size of the Debug window // Drawed das Debug Fenster in die obere Linke Ecke void DebugDraw(Game *game); diff --git a/Ui/screenIDs.h b/Ui/screenIDs.h deleted file mode 100644 index a97f4fe..0000000 --- a/Ui/screenIDs.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef SCREENIDS_H_ -#define SCREENIDS_H_ - -// Keinen Platz zwischen den IDs lassen! Jede Zahl nutzen! - -#define SCREEN_AMOUNT 5 // AUCH IN GAME.H ÄNDERN!!! -#define SCREEN_EXIT 0 // Will exit the game using code 0 -#define SCREEN_MAINMENU 1 -#define SCREEN_OPTIONS 2 -#define SCREEN_GAME 3 -#define SCREEN_PAUSE 4 - -#endif \ No newline at end of file diff --git a/Ui/selectable.h b/Ui/selectable.h index 51086eb..870cf2a 100644 --- a/Ui/selectable.h +++ b/Ui/selectable.h @@ -4,11 +4,6 @@ #include "raylib.h" #include "../game.h" -#define SELECTABLE_STATE_DEFAULT 0 -#define SELECTABLE_STATE_HOVERED 1 -#define SELECTABLE_STATE_SELECTED 2 - -#define SELECTABLE_ID_TEST 0 typedef struct Selectable{ Vector2 position; // Linke obere Ecke diff --git a/Ui/uiContainer.c b/Ui/uiContainer.c index 02d1bbd..a48d149 100644 --- a/Ui/uiContainer.c +++ b/Ui/uiContainer.c @@ -4,7 +4,6 @@ #include "raylib.h" #include "stdlib.h" #include "stdio.h" -#include "screenIDs.h" static UiContainer * UiContainerInitEmptyUiContainer(){ UiContainer *uiContainer = malloc(sizeof(UiContainer)); diff --git a/definitions.h b/definitions.h index b6f4bc4..cbfe052 100644 --- a/definitions.h +++ b/definitions.h @@ -32,5 +32,33 @@ #define AN_ENTITY_DIE 2 +// Definitions for Screen / View / Ui Stuff + +#define DEBUG_FONT_SIZE 20 + +#define SCREEN_AMOUNT 5 + +#define SCREEN_EXIT 0 // Will exit the game using code 0 +#define SCREEN_MAINMENU 1 +#define SCREEN_OPTIONS 2 +#define SCREEN_GAME 3 +#define SCREEN_PAUSE 4 + +#define BUTTON_STATE_DEFAULT 0 +#define BUTTON_STATE_HOVERED 1 +#define BUTTON_STATE_PRESSED 2 +#define BUTTON_STATE_RELEASED 3 + +#define BUTTON_ID_CONTINUE 0 +#define BUTTON_ID_EXIT 1 +#define BUTTON_ID_START_GAME 2 + +#define SELECTABLE_STATE_DEFAULT 0 +#define SELECTABLE_STATE_HOVERED 1 +#define SELECTABLE_STATE_SELECTED 2 + +#define SELECTABLE_ID_TEST 0 + + #endif diff --git a/game.c b/game.c index e3e7c0d..9974b8b 100644 --- a/game.c +++ b/game.c @@ -6,7 +6,6 @@ #include "IsometricMap/isometricMap.h" #include "Textures/textureatlas.h" #include "stdio.h" -#include "Ui/screenIDs.h" #include "Entity/entity.h" #include "MapObject/mapobject.h" #include "Ui/uiContainer.h" diff --git a/game.h b/game.h index 6368b3f..5bad9bd 100644 --- a/game.h +++ b/game.h @@ -2,8 +2,8 @@ #define GAME_H_ #include "raylib.h" +#include "definitions.h" -#define SCREEN_AMOUNT 5 //AUCH IN SCREENIDS ÄNDERN typedef struct Game{ Texture2D worker[8]; diff --git a/main.c b/main.c index 790dde1..d601301 100644 --- a/main.c +++ b/main.c @@ -8,7 +8,6 @@ #include "raymath.h" #include "IsometricMap/isometricMap.h" #include "game.h" -#include "Ui/screenIDs.h" #include "Ui/button.h" #include "Ui/uiContainer.h" #include "Ui/debug.h"