2017-02-26 16:00:41 +00:00
|
|
|
#ifndef __SDL_PRINTER_H
|
|
|
|
#define __SDL_PRINTER_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2017-07-14 00:31:47 +00:00
|
|
|
#include <SDL.h>
|
|
|
|
#include <SDL_mutex.h>
|
|
|
|
#include <SDL_events.h>
|
2017-02-26 16:00:41 +00:00
|
|
|
|
|
|
|
#include "physicalprinter.h"
|
|
|
|
|
|
|
|
#define HEIGHT 800
|
|
|
|
#define NATIVEWIDTH 960 // FIXME: printer can change density...
|
|
|
|
|
|
|
|
|
|
|
|
//#define WIDTH 384 // emulating the teeny printer I've got
|
|
|
|
#define WIDTH 960
|
|
|
|
|
|
|
|
|
|
|
|
class SDLPrinter : public PhysicalPrinter {
|
|
|
|
public:
|
|
|
|
SDLPrinter();
|
|
|
|
virtual ~SDLPrinter();
|
|
|
|
|
|
|
|
virtual void addLine(uint8_t *rowOfBits); // must be 960 pixels wide (120 bytes)
|
|
|
|
|
|
|
|
virtual void update();
|
|
|
|
|
|
|
|
virtual void moveDownPixels(uint8_t p);
|
|
|
|
|
2018-02-19 20:48:50 +00:00
|
|
|
void savePageAsBitmap(uint32_t pageno);
|
|
|
|
|
2017-02-26 16:00:41 +00:00
|
|
|
private:
|
|
|
|
bool isDirty;
|
|
|
|
uint16_t ypos;
|
|
|
|
|
|
|
|
SDL_Window *window;
|
|
|
|
SDL_Renderer *renderer;
|
2018-02-19 20:48:50 +00:00
|
|
|
volatile uint8_t _hackyBitmap[WIDTH * HEIGHT];
|
|
|
|
|
|
|
|
SDL_mutex *printerMutex;
|
|
|
|
uint32_t currentPageNumber;
|
2017-02-26 16:00:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|