-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRender.cpp
More file actions
56 lines (44 loc) · 1.17 KB
/
Render.cpp
File metadata and controls
56 lines (44 loc) · 1.17 KB
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
#include "Render.h"
#include <iostream>
#include <io.h>
#include <fcntl.h>
#include <Windows.h>
using namespace std;
void gotoxy(const short x, const short y) {
const COORD pos = {x, y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
void disableCursor() {
CONSOLE_CURSOR_INFO ConsoleCursor;
HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
ConsoleCursor.bVisible = 0;
ConsoleCursor.dwSize = 1;
SetConsoleCursorInfo(console, &ConsoleCursor);
}
void Render::init() {
_setmode(_fileno(stdout), _O_U16TEXT);
SetConsoleOutputCP(CP_UTF8);
SetConsoleCP(CP_UTF8);
disableCursor();
system("mode con cols=20 lines=20 | title Tetris 20307");
}
void Render::draw() {
gotoxy(0, 0);
int column = 0;
for (const auto& rows: this->map) {
for (const auto& row: rows) {
if (row == 1)
wcout << L"■"; //■
else if (row == 0)
wcout << " ";
else if (row == 2)
wcout << L"□"; // □
else if (row == 3)
wcout << "3";
}
wcout << endl;
++column;
}
}
void Render::queue() {
}