2017-02-26 16:00:41 +00:00
|
|
|
#ifndef __SDL_DISPLAY_H
|
|
|
|
#define __SDL_DISPLAY_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2017-07-14 00:31:47 +00:00
|
|
|
#include <SDL.h>
|
|
|
|
#include <SDL_events.h>
|
2017-02-26 16:00:41 +00:00
|
|
|
|
|
|
|
#include "physicaldisplay.h"
|
|
|
|
|
2022-01-22 00:11:05 +00:00
|
|
|
#define SDL_WIDTH 800
|
|
|
|
#define SDL_HEIGHT 480
|
|
|
|
|
2017-02-26 16:00:41 +00:00
|
|
|
class SDLDisplay : public PhysicalDisplay {
|
|
|
|
public:
|
|
|
|
SDLDisplay();
|
|
|
|
virtual ~SDLDisplay();
|
|
|
|
|
2020-07-07 01:31:37 +00:00
|
|
|
virtual void blit();
|
2017-02-26 16:00:41 +00:00
|
|
|
|
2018-02-07 15:20:26 +00:00
|
|
|
virtual void flush();
|
|
|
|
|
2022-01-26 18:49:28 +00:00
|
|
|
virtual void drawUIImage(uint8_t imageIdx);
|
2021-01-21 02:16:32 +00:00
|
|
|
virtual void drawImageOfSizeAt(const uint8_t *img, uint16_t sizex, uint16_t sizey, uint16_t wherex, uint16_t wherey);
|
2018-01-07 19:43:17 +00:00
|
|
|
|
|
|
|
virtual void drawPixel(uint16_t x, uint16_t y, uint16_t color);
|
|
|
|
virtual void drawPixel(uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint8_t b);
|
2017-02-26 16:00:41 +00:00
|
|
|
|
2021-01-09 12:14:14 +00:00
|
|
|
virtual void clrScr(uint8_t coloridx);
|
2017-02-26 16:00:41 +00:00
|
|
|
|
2018-02-18 01:44:04 +00:00
|
|
|
virtual void cachePixel(uint16_t x, uint16_t y, uint8_t color);
|
|
|
|
virtual void cacheDoubleWidePixel(uint16_t x, uint16_t y, uint8_t color);
|
2021-01-19 14:35:25 +00:00
|
|
|
void cacheDoubleWidePixel(uint16_t x, uint16_t y, uint32_t packedColor);
|
2018-02-18 01:44:04 +00:00
|
|
|
|
2021-01-21 01:55:11 +00:00
|
|
|
void windowResized(uint32_t w, uint32_t h);
|
2018-02-18 01:44:04 +00:00
|
|
|
|
2017-02-26 16:00:41 +00:00
|
|
|
private:
|
2022-01-22 00:11:05 +00:00
|
|
|
uint32_t videoBuffer[SDL_HEIGHT][SDL_WIDTH];
|
2018-02-18 01:44:04 +00:00
|
|
|
|
2017-02-26 16:00:41 +00:00
|
|
|
SDL_Window *screen;
|
|
|
|
SDL_Renderer *renderer;
|
2021-01-21 01:55:11 +00:00
|
|
|
SDL_Texture *buffer;
|
2022-01-26 18:49:28 +00:00
|
|
|
|
|
|
|
uint8_t *shellImage;
|
|
|
|
uint16_t shellWidth, shellHeight;
|
|
|
|
uint8_t *d1OpenImage;
|
|
|
|
uint16_t driveWidth, driveHeight; // assume all the latches are the
|
|
|
|
// same width/height no matter
|
|
|
|
// what position
|
|
|
|
uint8_t *d1ClosedImage;
|
|
|
|
uint8_t *d2OpenImage;
|
|
|
|
uint8_t *d2ClosedImage;
|
|
|
|
uint8_t *appleImage;
|
|
|
|
uint16_t appleImageWidth, appleImageHeight;
|
2017-02-26 16:00:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|