Chip8-CPP/include/display.h

42 lines
839 B
C
Raw Permalink Normal View History

2023-09-09 17:57:57 +00:00
#ifndef CHIP8_DISPLAY_H
#define CHIP8_DISPLAY_H
#define STATE_ON 1
#define STATE_OFF 0
#include <SDL2/SDL.h>
/**
* The display class used to handle drawing pixels to the SDL renderer
*/
2023-09-09 17:57:57 +00:00
class Display {
private:
/**
* Flag whether the display should be redrawn
*/
2023-09-09 17:57:57 +00:00
bool flagRedraw = false;
/**
* The 64x32-pixel monochrome display
*/
2023-09-09 17:57:57 +00:00
bool display[64 * 32] = {};
public:
/**
* Draws the current display to the SDL renderer
* @param renderer the SDL renderer to draw to
*/
void draw(SDL_Renderer* renderer);
/**
* Gets whether the display should be redrawn
* @return true if the display should be redrawn, false otherwise
*/
2023-09-09 17:57:57 +00:00
[[nodiscard]] bool needsRedraw() const;
/**
* Clears the display
*/
2023-09-09 17:57:57 +00:00
void clear();
};
#endif //CHIP8_DISPLAY_H