-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathScene.cpp
More file actions
29 lines (26 loc) · 798 Bytes
/
Scene.cpp
File metadata and controls
29 lines (26 loc) · 798 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
#include "Scene.h"
Scene::Scene(int cols, int lines, int time) : COLS{cols}, generator{lines}, millisec(time), scene(lines), column(cols, Column(lines, Char(Generator::EMPTY, SysTool::COLOR_EMPTY)))
{
std::for_each(scene.begin(), scene.end(), [=](std::unique_ptr<Char *[]> & up){ up = std::make_unique<Char *[]>(cols); });
for (int i = 0; i < column.size(); ++i)
{
column[i].init(generator);
for (int j = 0; j < scene.size(); ++j)
{
scene[j][i] = const_cast<Char *>(column[i].getElement(lines - j - 1));
}
}
}
void Scene::showScene()
{
for (int i = 0; i < scene.size(); ++i)
{
for (int j = 0; j < COLS; ++j)
{
SysTool::setColor(scene[i][j]->getColor());
SysTool::setPosition(i, j);
SysTool::print("%c", scene[i][j]->getChar());
}
SysTool::refreshScreen();
}
}