38 #define LOG_SECTION_HEIGHT 4
40 #define MIN_ROWS ((2 * (CARD_HEIGHT + 4)) + (LOG_SECTION_HEIGHT + 2))
42 #define MIN_COLUMNS 141
96 void navigatePages(
PageData* pagesData,
int totalPages,
int maxRows,
int maxColumns,
int bestStartColumn,
int playerIndex,
Game* game);
115 void drawLine(
int startingX,
int startingY,
int length,
char direction,
char borders);
125 void drawCard(
int startingX,
int startingY,
int suit,
int rank);
138 PageData*
getPageData(
int maxRows,
int maxColumns,
Player** players,
int totalPlayers,
int* totalPages,
int* bestStartColumn);
Implemented following https://en.wikipedia.org/wiki/ANSI_escape_code.
Declaration of constant values for ANSI module.
Declaration of constants used by the modules.
Declaration of game-related constants, definition of game-related structures and functions.
Defines a structure for the game.
Struct to represent the layout and data of a page containing player information.
int playerPerRow
The number of players displayed per row.
int playerRows
The number of rows used to display players on the page.
int playerCount
The total number of players on the page.
Player ** players
An array of pointers to the players displayed on the page.
int rowSpacing
The vertical spacing between rows, including card height and player details.
Defines a structure for the player's info.
void drawPageFrame(int maxRows, int maxColumns)
Draws the frame for a page, including borders and separators.
int getPageContainingPlayer(PageData *pagesData, int totalPages, int id)
Determines which page contains a player by their ID.
PageData * getPageData(int maxRows, int maxColumns, Player **players, int totalPlayers, int *totalPages, int *bestStartColumn)
Computes the page layout for players and allocates memory for the page data.
void drawCard(int startingX, int startingY, int suit, int rank)
Draws a card at a specified position.
void freePageData(PageData *pages, int totalPages)
Frees the memory allocated for page data.
void drawLine(int startingX, int startingY, int length, char direction, char borders)
Draws a line in the terminal.
int getCardColor(int cardRank)
Retrieves the color associated with a card rank.
void displayPage(PageData *page, int maxRows, int maxColumns, int bestStartColumn)
Displays a page of cards and player information.
void drawCardsForPage(PageData *page, int startX, int bestStartColumn)
Draws all cards for the current page.
bool isTerminalSizeValid(int maxRows, int maxColumns)
Checks if the terminal size meets the minimum requirements.
void navigatePages(PageData *pagesData, int totalPages, int maxRows, int maxColumns, int bestStartColumn, int playerIndex, Game *game)
Navigates between pages and handles player actions during their turn.