Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
55 lines (43 loc) · 1.61 KB
/
Copy pathmain.cpp
File metadata and controls
55 lines (43 loc) · 1.61 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
#include <iostream>
#include <fstream>
#include <cstdint>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <thread>
#include <cmath>
#include "include/renderer.h"
#include "include/utils.h"
int main()
{
// ! SEEDING
std::srand(static_cast<unsigned int>(std::time(nullptr)));
// Renderer r{96, 96};
// Renderer r{220, 220};
// Renderer r{128, 128};
Renderer r{64, 64};
r.clearScreen();
r.resetCursor();
int DELAY = 150;
std::size_t frameCount = 0;
while (true)
{
r.resetBuffer(Pixel{0, 0, 0});
// * DRAWING CODE GOES HERE --------------------------------------->
for (int i = 0; i < 10; ++i)
{
r.circleFill(randomInteger(0, r.width), randomInteger(0, r.height), randomInteger(0, 24), {
(unsigned char)randomInteger(0, 255),
(unsigned char)randomInteger(0, 255),
(unsigned char)randomInteger(0, 255),
});
}
//*---------------------------------------------------------------->
r.swapBuffers();
r.resetCursor();
r.render();
std::this_thread::sleep_for(std::chrono::milliseconds(DELAY)); // Control main loop delay
++frameCount;
}
return EXIT_SUCCESS;
}