-
Notifications
You must be signed in to change notification settings - Fork 0
/
screen.c
140 lines (114 loc) · 3.04 KB
/
screen.c
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// 2018113528 심재헌
// screen code file
#include <stdio.h>
#include <curses.h>
#include <signal.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include "game.h"
void grid_screen();
int value;
void start_screen() // print start screen
{
initscr();
clear();
grid_screen();
move(row_value+2, col_start+col_last/6);
addstr("======== ========== = ======= ==========");
move(row_value+3, col_start+col_last/6);
addstr("= == = = = = ==");
move(row_value+4, col_start+col_last/6);
addstr("======== == ===== ======= ==");
move(row_value+5, col_start+col_last/6);
addstr(" = == = = = = ==");
move(row_value+6, col_start+col_last/6);
addstr("======== == = = = = ==");
move(row_last-3, col_start+col_last/3.3);
addstr("press any button!!!!\n");
move(LINES, 0);
refresh();
getch();
out_condition();
}
void explain_rules(){
initscr();
clear();
// grid
grid_screen();
// explain about game
move(row_value, col_value);
addstr("SYSTEM PROGRAMMING TEST!!!!!!!!!!!!!!!!!!!");
move(row_value+1, col_value);
addstr("There are two types of problems and each has a 10 Question...");
move(row_value+4, col_value);
addstr("-------------------------------game rules------------------------------------");
move(row_value+6, col_value);
addstr("A sentence explaining the term will be printed for 5 seconds...");
move(row_value+7, col_value);
addstr("You can enter the term after 5 seconds.");
move(row_value+8, col_value);
addstr("If it's correct, you'll get points and move on to the next question...");
move(row_value+9, col_value);
addstr("If it's incorrect, the game will end...");
move(row_value+12, col_value);
standout();
addstr("If you're ready, press any button!!!!!!");
standend();
move(LINES, 0);
refresh();
getch();
out_condition();
}
int type_input(){
int value=-1;
initscr();
crmode();
noecho();
clear();
grid_screen();
fflush(stdout);
move(row_start+row_last/3, col_start+col_last/4+1);
standout();
addstr("Choose Question Type!!!");
move(row_start+row_last/3+1, col_start+col_last/4+1);
addstr("Input 0 or 1.");
standend();
rewind(stdin);
move(row_start+row_last/3+3, col_start+col_last/4+1);
addstr("0. Command 1. Terminology");
move(row_start+row_last/3+5, col_start+col_last/4+3);
refresh();
int c = getch(); /* grab the char */
if(c == '1'){ // 종료조건 처리하기
value=1;
}else if( c == '0'){
value=0;
}else{
value=-1;
}
return value;
}
void error_screen(){
int row_middle = (row_start+row_last)/2;
clear();
grid_screen();
move(row_middle, col_start+col_last/4);
standout();
addstr("ONLY INPUT 1 OR 2!!!!!!!!!!!!!!!");
standend();
refresh();
sleep(5);
out_condition();
}
void grid_screen(){
move(row_start,col_start);
for(int i=col_start;i<=col_last;i++){
addstr("*");
}
move(row_last,col_start);
for(int i=col_start;i<=col_last;i++){
addstr("*");
}
}