diff --git a/c_projects/tiktaktoe/Makefile b/c_projects/tiktaktoe/Makefile index 3fd87d8..90f1387 100644 --- a/c_projects/tiktaktoe/Makefile +++ b/c_projects/tiktaktoe/Makefile @@ -28,7 +28,7 @@ CC := gcc INCLUDE_LIST := $(foreach m,$(SUBMODULES),$(m)/$(INCLUDE_DIR)) $(INCLUDE_DIR) $(TESTS_INCL_DIR) INCLUDES := $(addprefix -I,$(INCLUDE_LIST)) CFLAGS := -ggdb -Wall -Wextra -MMD -MP -lncurses -fsanitize=address -DFLAGS := +DFLAGS := -D_DEBUG # Main Executable Filename MAIN := main.c diff --git a/c_projects/tiktaktoe/include/tiktaktoe.c b/c_projects/tiktaktoe/include/tiktaktoe.c deleted file mode 100644 index bd508f3..0000000 --- a/c_projects/tiktaktoe/include/tiktaktoe.c +++ /dev/null @@ -1,5 +0,0 @@ -#include "tiktaktoe.h" - -int start_tiktaktoe(){ - return 0; -} diff --git a/c_projects/tiktaktoe/include/tiktaktoe.h b/c_projects/tiktaktoe/include/tiktaktoe.h index d8ab180..cac9901 100644 --- a/c_projects/tiktaktoe/include/tiktaktoe.h +++ b/c_projects/tiktaktoe/include/tiktaktoe.h @@ -1,3 +1,14 @@ -#include +#ifndef TIKTAKTOE_H +#define TIKTAKTOE_H -int start_tiktaktoe(); +#include +#include + +#define GRIDSIZE 3 + +extern const char part; + +void draw_initial_board(WINDOW*); +int start_tiktaktoe(void); + +#endif diff --git a/c_projects/tiktaktoe/src/tiktaktoe.c b/c_projects/tiktaktoe/src/tiktaktoe.c index 0ef9bac..2341ba7 100644 --- a/c_projects/tiktaktoe/src/tiktaktoe.c +++ b/c_projects/tiktaktoe/src/tiktaktoe.c @@ -1,10 +1,30 @@ #include "tiktaktoe.h" -int start_tiktaktoe(){ +const char part = '-'; + +int start_tiktaktoe(void){ + WINDOW *board = NULL; initscr(); - printw("Hello World !!!"); - refresh(); + + draw_initial_board(board); + getch(); endwin(); return 0; } + +void draw_initial_board(WINDOW *board){ + int hline_pos = 0; + int vline_pos = 0; + board = newwin(0,0,0,0); + + for (int i = 0; i < GRIDSIZE - 1; i++){ + hline_pos += LINES/GRIDSIZE; + mvwhline(board, hline_pos,0,0,COLS); + vline_pos += COLS/GRIDSIZE; + mvwvline(board, 0,vline_pos,0,LINES); + } + + wrefresh(board); + wgetch(board); +}