From 8cb3ccef1b6cbca73f1b28ffc35921575f711b62 Mon Sep 17 00:00:00 2001 From: marouault Date: Mon, 7 Feb 2022 17:38:21 +0100 Subject: [PATCH] Game can be fluid in IUT's PC --- Pontu/entryPoints/main.c | 2 +- Pontu/src/model/Game.c | 1 - Pontu/src/view/BoardDrawer.c | 1 - Pontu/src/view/GameMain.c | 17 +++-------------- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/Pontu/entryPoints/main.c b/Pontu/entryPoints/main.c index a35636a..369db60 100644 --- a/Pontu/entryPoints/main.c +++ b/Pontu/entryPoints/main.c @@ -11,7 +11,7 @@ int main(int argc, char *argv[]) { GeneralState generalState; - + SDL_Window* window = NULL; SDL_Rect windowSize = {10, 10, 900, 900}; SDL_Renderer* renderer = NULL; diff --git a/Pontu/src/model/Game.c b/Pontu/src/model/Game.c index 07cf702..015e871 100644 --- a/Pontu/src/model/Game.c +++ b/Pontu/src/model/Game.c @@ -90,7 +90,6 @@ void changePhaseOrPlayerTurn(Game* game) game->board.nbPieces)); - fprintf(stderr, "Player n°%ld turn\n", game->currentPlayerID); fflush(stderr); if (anyOfPlayersPiecesCanMove(game->currentPlayerID, &game->board)) diff --git a/Pontu/src/view/BoardDrawer.c b/Pontu/src/view/BoardDrawer.c index bf80d9f..1e7d0a2 100644 --- a/Pontu/src/view/BoardDrawer.c +++ b/Pontu/src/view/BoardDrawer.c @@ -4,7 +4,6 @@ void drawRemoveBridge(SDL_Renderer* renderer, const SDL_Rect* boardRect, SDL_Texture* water, const Coord* coordBridge) { const SDL_Rect destRect = coordToRect(boardRect, coordBridge); SDL_RenderCopy(renderer, water, NULL, &destRect); - fprintf(stderr, "RedrawWater\n"); fflush(stderr); } bool drawFullBoard(SDL_Renderer* renderer, const SDL_Rect* boardRect, const Board* board, SDL_Texture* island, SDL_Texture* bridge, SDL_Texture* water) diff --git a/Pontu/src/view/GameMain.c b/Pontu/src/view/GameMain.c index cefef67..bdddc2a 100644 --- a/Pontu/src/view/GameMain.c +++ b/Pontu/src/view/GameMain.c @@ -5,12 +5,13 @@ #include "engine/TextureHandler.h" #include "model/Game.h" #include "model/arrayCoord.h" -#include "debug/printer.h" #include "view/PiecesDrawer.h" #include "view/BoardDrawer.h" #include "view/GameDrawer.h" + + SDL_Rect boardRectFromWindowSize(int windowW, int windowH) { SDL_Rect boardRect = {.x=windowW/10.0, .y=windowH/10, .w=windowW*8.0/10.0, .h=windowH*8.0/10.0}; @@ -66,10 +67,6 @@ void gameView(GeneralState* generalState, SDL_Window* window, SDL_Renderer* rend } break; case InputType_MoveGame: { - fprintf(stderr, "Move on board\n"); - fprintf(stderr, "From (%d; %d)\n", inputElement.data.move.start.x, inputElement.data.move.start.y); - fprintf(stderr, "To (%d; %d)\n", inputElement.data.move.end.x, inputElement.data.move.end.y); - const GameAction actionRealized = moveOnBoard(inputElement.data.move.start, inputElement.data.move.end, &game); switch (actionRealized) { @@ -82,11 +79,7 @@ void gameView(GeneralState* generalState, SDL_Window* window, SDL_Renderer* rend break; } case InputType_ClickGame: { - fprintf(stderr, "Clic on board (%d; %d)\n", inputElement.data.coord.x, inputElement.data.coord.y); - fprintf(stderr, "\tSelected case : (%d; %d)\n", inputProcessor.selectedCase.x, inputProcessor.selectedCase.y); - if(!array_Coord_Contains(&interactiveCases, inputElement.data.coord, *coordEqual)) { - fprintf(stderr, "\tselected case reset\n"); inputProcessor.selectedCase = newCoord(-1,-1); } @@ -104,7 +97,6 @@ void gameView(GeneralState* generalState, SDL_Window* window, SDL_Renderer* rend } if (actionRealized != GameAction_None) { - fprintf(stderr, "\tselected case reset\n"); inputProcessor.selectedCase = newCoord(-1,-1); } @@ -117,12 +109,9 @@ void gameView(GeneralState* generalState, SDL_Window* window, SDL_Renderer* rend array_Coord_Free(&interactiveCases); interactiveCases = getInteractiveCases(&game, inputProcessor.selectedCase); - fprintf(stderr, "Interactive cases : {"); - array_Coord_Foreach(&interactiveCases, *printCoord); - fprintf(stderr, "}\n"); } - SDL_Delay(20); + SDL_Delay(5); } freeTextureHandler(&textureHandler);