-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMISC.h
More file actions
78 lines (68 loc) · 1.46 KB
/
MISC.h
File metadata and controls
78 lines (68 loc) · 1.46 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include <stdio.h>
#include <string.h>
#include <ncurses.h>
#include <time.h>
#include <stdlib.h>
WINDOW *create_newwin(int height, int width, int starty, int startx)
{
WINDOW *local_win;
local_win = newwin(height, width, starty, startx);
box(local_win, 0 , 0);
wrefresh(local_win);
return local_win;
}
void destroy_win(WINDOW *local_win)
{
wborder(local_win, ' ', ' ', ' ',' ',' ',' ',' ',' ');
wrefresh(local_win);
delwin(local_win);
}
typedef struct player
{
int remaining;
int **map, **ships;
int **chosen;
int score;
}player;
typedef struct computer
{
int remaining;
int **map, **ships;
}computer;
void highlight_matrix_element(int h,int w,int x,int y,int **chosen,int x_sel,int y_sel)
{
start_color();
int j,k,l=0,m=0;
init_pair(1, COLOR_RED, COLOR_BLACK);
init_pair(2, COLOR_GREEN, COLOR_BLACK);
init_pair(3, COLOR_CYAN, COLOR_BLACK);
init_pair(4, COLOR_BLUE, COLOR_BLACK);
for(j=0;j<10;j++)
{
for(k=0;k<10;k++)
{
if(j==x_sel&&k==y_sel)
{
attron(A_STANDOUT);
mvprintw(x+j+m,y+k+l,"%c",' ');
mvprintw(x+j+m,y+k+l+1,"%c",' ');
if(w>80||h>=36)
{
mvprintw(x+m+j,y+k+l+2,"%c",' ');
mvprintw(x+m+j+1,y+k+l,"%c",' ');
mvprintw(x+m+j+1,y+k+l+1,"%c",' ');
mvprintw(x+m+j+1,y+k+l+2,"%c",' ');
//l++;
}
attroff(A_STANDOUT);
}
if(w>80)l+=2;
else l++;
if(k==9)
{
if(w>80)m+=1;
l=0;
}
}
}
}