-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp~
More file actions
55 lines (38 loc) · 826 Bytes
/
Copy pathmain.cpp~
File metadata and controls
55 lines (38 loc) · 826 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <iostream>
#include "ncurses.h"
using namespace std;
#define static global
using real = float;
struct Buffers {
real* depth_buffer;
short* pixel_buffer;
};
int terminal_width;
int terminal_height;
void initColors();
void initBuffers(Buffers* buffers);
int main()
{
initscr();
raw();
noecho();
start_color();
initColors();
getmaxyx(stdscr, terminal_height, terminal_width);
Buffers buffers;
initBuffers(&buffers);
refresh();
getch();
endwin();
return 0;
}
void initColors() {
for(int i = 0;i < 1000; ++i) {
init_color(i + 10, i, i, i);
}
}
void initBuffers(Buffers* buffers) {
int total_size = terminal_width * terminal_height;
buffers->depth_buffer = new real[total_size];
buffers->pixel_buffer = new short[total_size];
}