1 #include <Interface/LayoutGame.hpp>
2 #include <Config/Globals.hpp>
3 #include <Misc/Utils.hpp>
5 LayoutGame::LayoutGame(
Game* game,
int width,
int height):
17 LayoutGame::~LayoutGame()
21 void LayoutGame::windowsInit()
23 Layout::windowsInit();
36 this->
main->getH() - 3);
40 this->
main->getH() - 2,
46 this->
main->getW() / 4,
47 this->main->getH() / 2 - 1,
48 this->main->getW() / 2,
51 if (Globals::Screen::show_borders)
53 this->
pause->borders(Globals::Screen::fancy_borders ?
54 Window::BORDER_FANCY :
55 Window::BORDER_REGULAR);
61 this->
main->getW() / 4,
62 this->main->getH() / 4,
63 this->main->getW() / 2,
64 this->main->getH() / 2);
66 if (Globals::Screen::show_borders)
68 this->
help->borders(Globals::Screen::fancy_borders ?
69 Window::BORDER_FANCY :
70 Window::BORDER_REGULAR);
76 void LayoutGame::windowsExit()
78 SAFE_DELETE(this->gamewin);
79 SAFE_DELETE(this->info);
80 SAFE_DELETE(this->
pause);
81 SAFE_DELETE(this->
help);
82 SAFE_DELETE(this->boardwin);
83 SAFE_DELETE(this->helpWindows);
86 this->
main->refresh();
88 Layout::windowsExit();
90 void LayoutGame::draw(
Menu* menu)
99 int x = this->gamewin->getW()/2 - this->game->board->getW()/2;
100 int y = this->gamewin->getH()/2 - this->game->board->getH()/2;
101 int w = this->game->board->getW();
102 int h = this->game->board->getH();
104 boardwin =
new Window(this->gamewin, x, y, w, h);
111 if (this->game->
isPaused && this->game->showPauseMenu)
113 this->
pause->clear();
115 this->
pause->refresh();
123 this->helpWindows->
run();
134 this->info->
print(
"a", 0, 0, 0);
136 ColorPair hilite = Globals::Theme::hilite_text;
138 this->info->
print(
"Hi-Score", 0, 0, hilite);
139 this->info->
print(
"Score", this->info->getW()/3, 0, hilite);
140 this->info->
print(
"Speed", this->info->getW()/3 * 2, 0, hilite);
143 wattrset(this->info->
win, COLOR_PAIR(0));
146 mvwprintw(this->info->
win, 0, 9,
"%u", this->game->scores->highScore->points);
148 mvwprintw(this->info->
win, 0, this->info->getW()/3 + 6,
"%u", this->game->currentScore->points);
149 mvwprintw(this->info->
win, 0, this->info->getW()/3 * 2 + 6,
"%d", this->game->currentScore->speed);
179 this->gamewin->clear();
181 this->game->board->draw(boardwin);
182 this->game->player->draw(boardwin);
183 this->game->fruits->draw(boardwin);
185 this->gamewin->refresh();
186 this->info->refresh();
187 this->
main->refresh();