-
Notifications
You must be signed in to change notification settings - Fork 0
/
board_button.h
36 lines (30 loc) · 1.41 KB
/
board_button.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef BOARD_BUTTON_H
#define BOARD_BUTTON_H
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
typedef struct {
SDL_Rect rect;
SDL_Texture* emptyTexture; //Texture for empty (state 0)
SDL_Texture* xTexture; // Texture for X symbol (state 1)
SDL_Texture* oTexture; // Texture for O symbol (state 2)
int cellID;
int isOccupied;
SDL_Color bgColor;
} BoardButton;
// Initialize the game board buttons
// - boardButtons: An array of BoardButton structures representing the game board buttons
// - gridWidth: The width (number of columns) of the game board
// - gridHeight: The height (number of rows) of the game board
void initBoardButtons( SDL_Renderer* renderer, BoardButton* boardButtons);
// render the game board buttons
// - renderer: The SDL_Renderer used for rendering
// - boardButtons: An array of BoardButton structures representing the game board buttons
// - gridWidth: The width (number of columns) of the game board
// - gridHeight: The height (number of rows) of the game board
void renderBoardButtons(SDL_Renderer* renderer, BoardButton* boardButtons);
// Handle button clicks when the user interacts with the game board
// - boardButtons: An array of BoardButton structures representing the game board buttons
// - mouseX: The x-coordinate of the mouse click
// - mouseY: The y-coordinate of the mouse click
void handleBoardButtonClick(BoardButton* boardButtons, int mouseX, int mouseY);
#endif