Game can be fluid in IUT's PC

origin/fixingSettings
marouault 4 years ago
parent 9eb65816df
commit 8cb3ccef1b

@ -90,7 +90,6 @@ void changePhaseOrPlayerTurn(Game* game)
game->board.nbPieces)); game->board.nbPieces));
fprintf(stderr, "Player n°%ld turn\n", game->currentPlayerID);
fflush(stderr); fflush(stderr);
if (anyOfPlayersPiecesCanMove(game->currentPlayerID, &game->board)) if (anyOfPlayersPiecesCanMove(game->currentPlayerID, &game->board))

@ -4,7 +4,6 @@
void drawRemoveBridge(SDL_Renderer* renderer, const SDL_Rect* boardRect, SDL_Texture* water, const Coord* coordBridge) { void drawRemoveBridge(SDL_Renderer* renderer, const SDL_Rect* boardRect, SDL_Texture* water, const Coord* coordBridge) {
const SDL_Rect destRect = coordToRect(boardRect, coordBridge); const SDL_Rect destRect = coordToRect(boardRect, coordBridge);
SDL_RenderCopy(renderer, water, NULL, &destRect); 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) bool drawFullBoard(SDL_Renderer* renderer, const SDL_Rect* boardRect, const Board* board, SDL_Texture* island, SDL_Texture* bridge, SDL_Texture* water)

@ -5,12 +5,13 @@
#include "engine/TextureHandler.h" #include "engine/TextureHandler.h"
#include "model/Game.h" #include "model/Game.h"
#include "model/arrayCoord.h" #include "model/arrayCoord.h"
#include "debug/printer.h"
#include "view/PiecesDrawer.h" #include "view/PiecesDrawer.h"
#include "view/BoardDrawer.h" #include "view/BoardDrawer.h"
#include "view/GameDrawer.h" #include "view/GameDrawer.h"
SDL_Rect boardRectFromWindowSize(int windowW, int windowH) { 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}; 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; break;
case InputType_MoveGame: { 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); const GameAction actionRealized = moveOnBoard(inputElement.data.move.start, inputElement.data.move.end, &game);
switch (actionRealized) switch (actionRealized)
{ {
@ -82,11 +79,7 @@ void gameView(GeneralState* generalState, SDL_Window* window, SDL_Renderer* rend
break; break;
} }
case InputType_ClickGame: { 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)) { if(!array_Coord_Contains(&interactiveCases, inputElement.data.coord, *coordEqual)) {
fprintf(stderr, "\tselected case reset\n");
inputProcessor.selectedCase = newCoord(-1,-1); inputProcessor.selectedCase = newCoord(-1,-1);
} }
@ -104,7 +97,6 @@ void gameView(GeneralState* generalState, SDL_Window* window, SDL_Renderer* rend
} }
if (actionRealized != GameAction_None) { if (actionRealized != GameAction_None) {
fprintf(stderr, "\tselected case reset\n");
inputProcessor.selectedCase = newCoord(-1,-1); inputProcessor.selectedCase = newCoord(-1,-1);
} }
@ -117,12 +109,9 @@ void gameView(GeneralState* generalState, SDL_Window* window, SDL_Renderer* rend
array_Coord_Free(&interactiveCases); array_Coord_Free(&interactiveCases);
interactiveCases = getInteractiveCases(&game, inputProcessor.selectedCase); 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); freeTextureHandler(&textureHandler);

Loading…
Cancel
Save