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"
|
|
|
|
|
2020-07-09 06:38:03 +00:00
|
|
|
// scale can be 1,2,4. '1' is half-width at the highest resolution
|
|
|
|
// (80-col mode). '2' is full width. '4' is double full width.
|
2020-07-11 11:39:56 +00:00
|
|
|
#define SDLDISPLAY_SCALE 2
|
2020-07-09 06:38:03 +00:00
|
|
|
#define SDLDISPLAY_WIDTH (320*SDLDISPLAY_SCALE)
|
|
|
|
#define SDLDISPLAY_HEIGHT (240*SDLDISPLAY_SCALE)
|
2017-02-28 13:15:11 +00:00
|
|
|
|
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
|
|
|
virtual void blit(AiieRect r);
|
|
|
|
virtual void redraw();
|
|
|
|
|
2018-02-07 15:20:26 +00:00
|
|
|
virtual void flush();
|
|
|
|
|
2018-01-07 19:43:17 +00:00
|
|
|
virtual void drawImageOfSizeAt(const uint8_t *img, uint16_t sizex, uint8_t sizey, uint16_t wherex, uint8_t wherey);
|
|
|
|
|
|
|
|
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
|
|
|
|
2018-02-18 01:44:04 +00:00
|
|
|
virtual void drawUIPixel(uint16_t x, uint16_t y, uint16_t color);
|
|
|
|
|
2017-02-26 16:00:41 +00:00
|
|
|
virtual void drawCharacter(uint8_t mode, uint16_t x, uint8_t y, char c);
|
|
|
|
virtual void drawString(uint8_t mode, uint16_t x, uint8_t y, const char *str);
|
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);
|
|
|
|
virtual void cache2DoubleWidePixels(uint16_t x, uint16_t y, uint8_t colorA, uint8_t colorB);
|
|
|
|
|
|
|
|
|
2017-02-26 16:00:41 +00:00
|
|
|
private:
|
2018-02-18 01:44:04 +00:00
|
|
|
uint8_t videoBuffer[SDLDISPLAY_HEIGHT * SDLDISPLAY_WIDTH];
|
|
|
|
|
2017-02-26 16:00:41 +00:00
|
|
|
SDL_Window *screen;
|
|
|
|
SDL_Renderer *renderer;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|