From 4c04ac8268ea57dafb85d3256a160627a43ed4b2 Mon Sep 17 00:00:00 2001 From: marouault Date: Mon, 6 Dec 2021 12:06:20 +0100 Subject: [PATCH] Partial merge of different Coord --- Pontu/include/engine/Coord.h | 18 ------------------ Pontu/include/engine/InputProcessor.h | 6 +++--- Pontu/include/model/Coord.h | 17 ++++++++++++++++- 3 files changed, 19 insertions(+), 22 deletions(-) delete mode 100644 Pontu/include/engine/Coord.h diff --git a/Pontu/include/engine/Coord.h b/Pontu/include/engine/Coord.h deleted file mode 100644 index e9cd137..0000000 --- a/Pontu/include/engine/Coord.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef COORD_INPUT -#define COORD_INPUT - -struct p_coord -{ - int x; - int y; -}; - -bool coordValide(struct p_coord coord) { - return coord.x>=0 && coord.y>=0; -} - -bool coordEqual(struct p_coord a, struct p_coord b) { - return a.x == b.x && a.y == b.y; -} - -#endif //COORD_INPUT \ No newline at end of file diff --git a/Pontu/include/engine/InputProcessor.h b/Pontu/include/engine/InputProcessor.h index 2861fab..b831dab 100644 --- a/Pontu/include/engine/InputProcessor.h +++ b/Pontu/include/engine/InputProcessor.h @@ -2,16 +2,16 @@ #define INPUT_PROCESSOR_INCLUDED #include "Button.h" -#include "Coord.h" +#include "model/Coord.h" #include "InputElement.h" typedef struct { ArrayButton tabButton; - struct p_coord selectedCase; ///< Board , (-1;-1) si inexistant + struct Coord selectedCase; ///< Board , (-1;-1) si inexistant } InputProcessor; -struct p_coord screenCoordToGameCoord(const SDL_Point* point, const SDL_Rect* boardRect); +struct Coord screenCoordToGameCoord(const SDL_Point* point, const SDL_Rect* boardRect); InputElement proccessInput(InputProcessor *inputProcessor, const SDL_Rect* boardRect); diff --git a/Pontu/include/model/Coord.h b/Pontu/include/model/Coord.h index c261716..3b9d8d8 100644 --- a/Pontu/include/model/Coord.h +++ b/Pontu/include/model/Coord.h @@ -5,8 +5,23 @@ * \date 06/12/2021 */ +#ifndef COORD_INCLUDED +#define COORD_INCLUDED + +#include + typedef struct { int x; ///< Coordinate on the X-axis int y; ///< Coordinate on the Y-axis -} Coord +} Coord; + + +bool coordValide(const Coord coord) { + return coord.x>=0 && coord.y>=0; +} + +bool coordEqual(const Coord a, const Coord b) { + return a.x == b.x && a.y == b.y; +} +#endif //COORD_INCLUDED