29 #ifndef _NANO_ENGINE_TILER_H_ 30 #define _NANO_ENGINE_TILER_H_ 49 #define TILE_128x64_MONO NanoCanvas1, 128, 64, 7 50 #define TILE_8x8_MONO NanoCanvas1, 8, 8, 3 51 #define TILE_16x16_MONO NanoCanvas1, 16, 16, 4 52 #define TILE_32x32_MONO NanoCanvas1, 32, 32, 4 53 // Tiles for 8-bit displays 54 #define TILE_8x8_RGB8 NanoCanvas8, 8, 8, 3 55 #define TILE_16x16_RGB8 NanoCanvas8, 16, 16, 4 56 #define TILE_32x32_RGB8 NanoCanvas8, 32, 32, 5 57 #define TILE_8x8_MONO_8 NanoCanvas1_8,8, 8, 3 58 // Tiles for 16-bit displays 59 #define TILE_8x8_RGB16 NanoCanvas16, 8, 8, 3 61 #define ADATILE_8x8_MONO AdafruitCanvas1, 8, 8, 3 62 #define ADATILE_8x8_RGB8 AdafruitCanvas8, 8, 8, 3 63 #define ADATILE_8x8_RGB16 AdafruitCanvas16, 8, 8, 3 79 template<
class C, u
int8_t W, u
int8_t H, u
int8_t B>
134 static void refresh(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
141 for (uint8_t y=y1; y<=y2; y++)
143 for(uint8_t x=x1>>B; x<=(x2>>B); x++)
165 static void refreshWorld(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
167 refresh(x1 - offset.
x, y1 - offset.
y, x2 - offset.
x, y2 - offset.
y);
280 static uint8_t m_buffer[W * H * C::BITS_PER_PIXEL / 8];
285 template<
class C, u
int8_t W, u
int8_t H, u
int8_t B>
288 template<
class C, u
int8_t W, u
int8_t H, u
int8_t B>
291 template<
class C, u
int8_t W, u
int8_t H, u
int8_t B>
294 template<
class C, u
int8_t W, u
int8_t H, u
int8_t B>
297 template<
class C, u
int8_t W, u
int8_t H, u
int8_t B>
300 template<
class C, u
int8_t W, u
int8_t H, u
int8_t B>
310 uint16_t flag = m_refreshFlags[y >> NE_TILE_SIZE_BITS];
311 m_refreshFlags[y >> NE_TILE_SIZE_BITS] = 0;
316 canvas.setOffset(x, y);
319 canvas.setOffset(x, y);
328 template<
class C, u
int8_t W, u
int8_t H, u
int8_t B>
337 uint16_t flag = m_refreshFlags[y >> NE_TILE_SIZE_BITS];
338 m_refreshFlags[y >> NE_TILE_SIZE_BITS] = 0;
343 canvas.setOffset(x, y);
344 if (m_onDraw) m_onDraw();
345 canvas.setOffset(x, y);
347 canvas.fillRect(rect);
349 canvas.drawRect(rect);
350 canvas.printFixed( textPos.
x, textPos.
y, msg);
static const uint8_t NE_TILE_SIZE_BITS
static void moveToAndRefresh(const NanoPoint &position)
const NanoPoint & getPosition() const
static void refresh(const NanoPoint &point)
static void refreshWorld(const NanoPoint &point)
#define RGB_COLOR8(r, g, b)
static bool collision(NanoPoint &p, NanoRect &rect)
Returns true if point is inside the rectangle area. Returns true if point is inside the rectangle are...
bool collision(const NanoPoint &p) const
ssd1306_lcd_t ssd1306_lcd
static void refresh(const NanoRect &rect)
static void worldCoordinates()
static void drawCallback(TNanoEngineOnDraw callback)
uint8_t width
width in pixels
static void localCoordinates()
static const uint8_t NE_TILE_HEIGHT
static void displayBuffer()
refreshes content on oled display. Refreshes content on oled display. Call it, if you want to update ...
SFixedFontInfo s_fixedFont
static void refreshWorld(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
static void displayPopup(const char *msg)
prints popup message over display content prints popup message over display content ...
static void refreshWorld(const NanoRect &rect)
static TNanoEngineOnDraw m_onDraw
static void refresh(lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
static void moveTo(const NanoPoint &position)
bool(* TNanoEngineOnDraw)(void)
static const uint8_t NE_MAX_TILES_NUM
static uint16_t m_refreshFlags[NE_MAX_TILES_NUM]
static const uint8_t NE_TILE_WIDTH