1 #include <Interface/Layout.hpp> 2 #include <Interface/Ncurses.hpp> 3 #include <Config/Globals.hpp> 4 #include <Misc/Utils.hpp> 12 static int intendedWidth;
13 static int intendedHeight;
15 Layout::Layout(
int width,
int height):
18 intendedWidth = width;
19 intendedHeight = height;
23 void Layout::windowsInit()
28 int current_height, current_width;
29 getmaxyx(stdscr, current_height, current_width);
31 if ((current_width < intendedWidth) ||
32 (current_height < intendedHeight))
35 std::cerr <<
"Error! Your console screen is smaller than" 36 << intendedWidth <<
"x" << intendedHeight <<
"\n" 37 <<
"Please resize your window and try again" 52 if (Globals::Screen::center_horizontally)
53 main_x = current_width/2 - intendedWidth/2;
55 if (Globals::Screen::center_vertically)
56 main_y = current_height/2 - intendedHeight/2;
58 this->main =
new Window(main_x,
63 if ((Globals::Screen::outer_border) &&
64 (Globals::Screen::show_borders))
66 this->main->borders(Globals::Screen::fancy_borders ?
67 Window::BORDER_FANCY :
68 Window::BORDER_REGULAR);
71 this->main->refresh();
73 void Layout::windowsExit()
75 SAFE_DELETE(this->main);
void exit()
Warns the user about any errors and warnings found during the program's execution.
A segment of the terminal screen (2D char matrix).
static int screenWidth
Full width of the terminal right now.
void exit()
Quits Ncurses mode.
static int screenHeight
Full height of the terminal right now.