mirror of
https://github.com/usatiuk/cardboy.git
synced 2025-10-28 23:27:49 +01:00
51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
//
|
|
// Created by Stepan Usatiuk on 02.03.2025.
|
|
//
|
|
|
|
#ifndef CB_DISP_TOOLS_HPP
|
|
#define CB_DISP_TOOLS_HPP
|
|
|
|
#include <display.hpp>
|
|
|
|
class DispTools {
|
|
public:
|
|
static DispTools& get();
|
|
|
|
void clear() {
|
|
for (int y = 0; y < DISP_HEIGHT; y++) {
|
|
for (int x = 0; x < DISP_WIDTH; x++) {
|
|
SMD::get().set_pixel(x, y, true);
|
|
}
|
|
}
|
|
}
|
|
bool get_pixel(int x, int y) {
|
|
if (x < 0 || x >= DISP_WIDTH || y < 0 || y >= DISP_HEIGHT)
|
|
assert(false);
|
|
assert(false); // Not implemented
|
|
return true;
|
|
// return disp_frame[y][x];
|
|
}
|
|
void reset_pixel(int x, int y) {
|
|
if (x < 0 || x >= DISP_WIDTH || y < 0 || y >= DISP_HEIGHT)
|
|
assert(false);
|
|
SMD::get().set_pixel(x, y, false);
|
|
}
|
|
void set_pixel(int x, int y) {
|
|
if (x < 0 || x >= DISP_WIDTH || y < 0 || y >= DISP_HEIGHT)
|
|
assert(false);
|
|
|
|
SMD::get().set_pixel(x, y, true);
|
|
}
|
|
void set_pixel(int x, int y, bool on) {
|
|
if (on) {
|
|
set_pixel(x, y);
|
|
} else {
|
|
reset_pixel(x, y);
|
|
}
|
|
}
|
|
void draw_to_display();
|
|
};
|
|
|
|
|
|
#endif // DISP_TOOLS_HPP
|