13#include "AnimationWindow.h"
14#include "widgets/Button.h"
19using namespace TDT4102;
35 TicTacToeWindow(
int x,
int y,
int width,
int height,
const std::string& title);
98 std::vector<std::vector<char>>
board;
void play()
Starts the game loop.
Definition TicTacToeWindow.cpp:48
std::pair< Point, Point > winning_line
Coordinates for the winning line.
Definition TicTacToeWindow.h:105
void reset_game()
Resets the game to its initial state.
Definition TicTacToeWindow.cpp:189
TicTacToeWindow(int x, int y, int width, int height, const std::string &title)
Constructs a TicTacToeWindow object.
Definition TicTacToeWindow.cpp:36
bool check_draw()
Checks if the game is a draw.
Definition TicTacToeWindow.cpp:175
bool game_over
Flag indicating if the game is over.
Definition TicTacToeWindow.h:103
void cb_reset()
Callback function for the reset button.
Definition TicTacToeWindow.cpp:217
void handle_click(int x, int y)
Handles mouse click events to place marks.
Definition TicTacToeWindow.cpp:126
void draw_marks()
Draws the marks (X and O) on the board.
Definition TicTacToeWindow.cpp:101
void write_result_to_file(const std::string &result)
Writes the game result to a file.
Definition TicTacToeWindow.cpp:202
std::string result_text
Text indicating the winner.
Definition TicTacToeWindow.h:104
Button reset_button
Button to reset the game.
Definition TicTacToeWindow.h:101
std::vector< std::vector< char > > board
3x3 board representation.
Definition TicTacToeWindow.h:98
Button quit_button
Button to quit the game.
Definition TicTacToeWindow.h:102
void draw_winning_line()
Draws a line to indicate the winning combination.
Definition TicTacToeWindow.cpp:116
char current_player
Current player ('X' or 'O').
Definition TicTacToeWindow.h:99
void draw_board()
Draws the Tic Tac Toe board.
Definition TicTacToeWindow.cpp:91
void cb_quit()
Callback function for the quit button.
Definition TicTacToeWindow.cpp:225
bool check_winner()
Checks if there is a winner.
Definition TicTacToeWindow.cpp:145
char last_player
Last player to have made a move.
Definition TicTacToeWindow.h:100