Added function to draw initial board
This commit is contained in:
parent
8a0dd6f7f8
commit
f4a8a340a6
@ -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
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
#include "tiktaktoe.h"
|
||||
|
||||
int start_tiktaktoe(){
|
||||
return 0;
|
||||
}
|
||||
@ -1,3 +1,14 @@
|
||||
#include <ncurses.h>
|
||||
#ifndef TIKTAKTOE_H
|
||||
#define TIKTAKTOE_H
|
||||
|
||||
int start_tiktaktoe();
|
||||
#include <ncurses.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define GRIDSIZE 3
|
||||
|
||||
extern const char part;
|
||||
|
||||
void draw_initial_board(WINDOW*);
|
||||
int start_tiktaktoe(void);
|
||||
|
||||
#endif
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user