-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui.cpp
More file actions
40 lines (32 loc) · 932 Bytes
/
ui.cpp
File metadata and controls
40 lines (32 loc) · 932 Bytes
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
// Created by Srijita Mallick on 18/10/20.
#include "ui.h"
// Prints the border in UI
void PrintBorder() {
for(int i = 0; i < COLS; i++) {
move(0, i);
addstr("\u2588");
move(LINES - 1, i);
addstr("\u2588");
}
for(int i = 0; i < LINES; i++) {
move(i, 0);
addstr("\u2588");
move(i, COLS - 1);
addstr("\u2588");
}
refresh();
}
// Initialises the UI
void InitUi() {
setlocale(LC_ALL, ""); // override the default locale
initscr(); // initilizes the ncurses mode
curs_set(0); // hide the cursor
noecho(); // prevents printing out whatever you typed
cbreak(); // generate an interrupt on ctrl+c
nodelay(stdscr, TRUE);
keypad(stdscr, TRUE);
}
// Exits the ncurses mode and restores the previous terminal
void TearDownUi() {
endwin();
}