31 lines
665 B
C++
31 lines
665 B
C++
#ifndef FRAMEBUFFER_H
|
|
#define FRAMEBUFFER_H
|
|
|
|
#include <string>
|
|
|
|
const unsigned int COLOR_RED = 0xFFFF0000;
|
|
const unsigned int COLOR_GREEN = 0xFF00FF00;
|
|
const unsigned int COLOR_BLUE = 0xFF0000FF;
|
|
|
|
class Framebuffer {
|
|
public:
|
|
Framebuffer(std::string devicePath);
|
|
int init();
|
|
int getWidth();
|
|
int getHeight();
|
|
int getBytesPerPixel();
|
|
int setPixel(int x, int y, unsigned int color);
|
|
int clear(unsigned int color);
|
|
void done();
|
|
void mmapData();
|
|
void munmapData();
|
|
private:
|
|
unsigned int *data;
|
|
int device, width, height, bitsPerPixel, bytesPerPixel;
|
|
bool isDataMapped = false;
|
|
bool isDeviceOpen = false;
|
|
const char *devicePath;
|
|
};
|
|
|
|
#endif
|