-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathExampleFullscreen.cpp
More file actions
executable file
·45 lines (35 loc) · 1007 Bytes
/
ExampleFullscreen.cpp
File metadata and controls
executable file
·45 lines (35 loc) · 1007 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
// Fullscreen Example.
// Opens a display for fullscreen output in floating point color mode.
// Part of the PixelToaster Framebuffer Library - http://www.pixeltoaster.com
#include "PixelToaster.h"
#ifdef PIXELTOASTER_NO_STL
# include <vector>
using std::vector;
#endif
using namespace PixelToaster;
int main()
{
const int width = 320;
const int height = 240;
Display display("Fullscreen Example", width, height, Output::Fullscreen);
vector<Pixel> pixels(width * height);
while (display.open())
{
unsigned int index = 0;
for (int y = 0; y < height; ++y)
{
for (int x = 0; x < width; ++x)
{
pixels[index].r = 0.8f + y * 0.0015f;
pixels[index].g = 0.2f + y * 0.00075f;
pixels[index].b = 0.1f + y * 0.0005f;
++index;
}
}
#ifdef PIXELTOASTER_NO_STL
display.update(pixels.data());
#else
display.update(pixels);
#endif
}
}