DisplayMatrix
This commit is contained in:
parent
a6fb6af1a9
commit
cfcb56898c
@ -1,9 +1,11 @@
|
|||||||
#ifndef NODE_TEST_H
|
#ifndef NODE_TEST_H
|
||||||
#define NODE_TEST_H
|
#define NODE_TEST_H
|
||||||
|
|
||||||
#include <public/node/Node.h>
|
#include <patrix/display/DisplayMatrix.h>
|
||||||
#include <patrix/node/Node.h>
|
#include <patrix/node/Node.h>
|
||||||
|
|
||||||
|
DisplayMatrix<32, 8> display;
|
||||||
|
|
||||||
class NodeTest final : public Node {
|
class NodeTest final : public Node {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
60
src/patrix/display/DisplayMatrix.h
Normal file
60
src/patrix/display/DisplayMatrix.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#ifndef DISPLAY_MATRIX_H
|
||||||
|
#define DISPLAY_MATRIX_H
|
||||||
|
|
||||||
|
#include "DisplayMatrix_FontCommon.h"
|
||||||
|
|
||||||
|
template<int W, int H>
|
||||||
|
class DisplayMatrix {
|
||||||
|
|
||||||
|
Color matrix[H][W] = {};
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Color foreground = White;
|
||||||
|
|
||||||
|
Color background = Transparent;
|
||||||
|
|
||||||
|
uint8_t alpha = 255;
|
||||||
|
|
||||||
|
int cursorX = 0;
|
||||||
|
|
||||||
|
int cursorY = 0;
|
||||||
|
|
||||||
|
// draw -----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
void fillRect(int w = W, int h = H) const;
|
||||||
|
|
||||||
|
// print ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void printf(const char *format, ...);
|
||||||
|
|
||||||
|
void print(const char *str);
|
||||||
|
|
||||||
|
void print(const char **cPP);
|
||||||
|
|
||||||
|
void print(Symbol1 s);
|
||||||
|
|
||||||
|
void print(Symbol2 s);
|
||||||
|
|
||||||
|
void print(Symbol3 s);
|
||||||
|
|
||||||
|
void print(Symbol4 s);
|
||||||
|
|
||||||
|
void print(Symbol5 s);
|
||||||
|
|
||||||
|
void print(bool **s, size_t w, size_t h);
|
||||||
|
|
||||||
|
void print(SymbolRGB8x8 s);
|
||||||
|
|
||||||
|
void print(Color **s, size_t w, size_t h);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// ReSharper disable CppUnusedIncludeDirective
|
||||||
|
#include <patrix/display/DisplayMatrix_draw.h>
|
||||||
|
#include <patrix/display/DisplayMatrix_print.h>
|
||||||
|
// ReSharper restore CppUnusedIncludeDirective
|
||||||
|
|
||||||
|
#endif
|
||||||
13
src/patrix/display/DisplayMatrix_FontCommon.h
Normal file
13
src/patrix/display/DisplayMatrix_FontCommon.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef DISPLAY_MATRIX_FONT_COMMON_H
|
||||||
|
#define DISPLAY_MATRIX_FONT_COMMON_H
|
||||||
|
|
||||||
|
#include "DisplayMatrix_common.h"
|
||||||
|
|
||||||
|
typedef bool Symbol1[5][1];
|
||||||
|
typedef bool Symbol2[5][2];
|
||||||
|
typedef bool Symbol3[5][3];
|
||||||
|
typedef bool Symbol4[5][4];
|
||||||
|
typedef bool Symbol5[5][5];
|
||||||
|
typedef Color SymbolRGB8x8[8][8];
|
||||||
|
|
||||||
|
#endif
|
||||||
186
src/patrix/display/DisplayMatrix_FontLower.cpp
Normal file
186
src/patrix/display/DisplayMatrix_FontLower.cpp
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
#include "DisplayMatrix_FontLower.h"
|
||||||
|
|
||||||
|
Symbol5 FONT_LOWER[] = {
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,X,X,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{_,X,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,X,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{X,X,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,X,X,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{_,X,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,X,_,_},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
{_,X,X,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{_,X,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{X,X,X,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,X,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{X,X,X,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{_,X,X,_,_},
|
||||||
|
{X,X,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,X,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{X,X,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{X,X,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{X,X,X,X,X},
|
||||||
|
{X,_,X,_,X},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,X,X,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{X,X,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{X,X,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,X,X,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{_,X,X,_,_},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{X,X,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{X,X,X,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{X,_,X,_,X},
|
||||||
|
{_,X,_,X,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,_,_,_},
|
||||||
|
{X,X,X,X,_},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{X,X,X,X,_},
|
||||||
|
},
|
||||||
|
};
|
||||||
8
src/patrix/display/DisplayMatrix_FontLower.h
Normal file
8
src/patrix/display/DisplayMatrix_FontLower.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef DISPLAY_MATRIX_FONT_LOWER_H
|
||||||
|
#define DISPLAY_MATRIX_FONT_LOWER_H
|
||||||
|
|
||||||
|
#include "DisplayMatrix_FontCommon.h"
|
||||||
|
|
||||||
|
extern Symbol5 FONT_LOWER[];
|
||||||
|
|
||||||
|
#endif
|
||||||
74
src/patrix/display/DisplayMatrix_FontNumber.cpp
Normal file
74
src/patrix/display/DisplayMatrix_FontNumber.cpp
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
#include "DisplayMatrix_FontNumber.h"
|
||||||
|
|
||||||
|
Symbol4 FONT_NUMBER[] = {
|
||||||
|
{
|
||||||
|
{_,X,X,_},
|
||||||
|
{X,_,_,X},
|
||||||
|
{X,_,_,X},
|
||||||
|
{X,_,_,X},
|
||||||
|
{_,X,X,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,_,X,_},
|
||||||
|
{_,X,X,_},
|
||||||
|
{X,_,X,_},
|
||||||
|
{_,_,X,_},
|
||||||
|
{_,_,X,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,X,X,_},
|
||||||
|
{X,_,_,X},
|
||||||
|
{_,_,X,_},
|
||||||
|
{_,X,_,_},
|
||||||
|
{X,X,X,X},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,X,X,_},
|
||||||
|
{X,_,_,X},
|
||||||
|
{_,_,X,_},
|
||||||
|
{X,_,_,X},
|
||||||
|
{_,X,X,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,X},
|
||||||
|
{X,_,_,X},
|
||||||
|
{X,X,X,X},
|
||||||
|
{_,_,_,X},
|
||||||
|
{_,_,_,X},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,X,X,X},
|
||||||
|
{X,_,_,_},
|
||||||
|
{X,X,X,_},
|
||||||
|
{_,_,_,X},
|
||||||
|
{X,X,X,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,X,X,_},
|
||||||
|
{X,_,_,_},
|
||||||
|
{X,X,X,_},
|
||||||
|
{X,_,_,X},
|
||||||
|
{_,X,X,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,X,X,X},
|
||||||
|
{_,_,_,X},
|
||||||
|
{_,_,X,_},
|
||||||
|
{_,X,_,_},
|
||||||
|
{X,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,X,X,_},
|
||||||
|
{X,_,_,X},
|
||||||
|
{_,X,X,_},
|
||||||
|
{X,_,_,X},
|
||||||
|
{_,X,X,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,X,X,_},
|
||||||
|
{X,_,_,X},
|
||||||
|
{_,X,X,X},
|
||||||
|
{_,_,_,X},
|
||||||
|
{_,X,X,_},
|
||||||
|
},
|
||||||
|
};
|
||||||
8
src/patrix/display/DisplayMatrix_FontNumber.h
Normal file
8
src/patrix/display/DisplayMatrix_FontNumber.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef DISPLAY_MATRIX_FONT_NUMBER_H
|
||||||
|
#define DISPLAY_MATRIX_FONT_NUMBER_H
|
||||||
|
|
||||||
|
#include "DisplayMatrix_FontCommon.h"
|
||||||
|
|
||||||
|
extern Symbol4 FONT_NUMBER[];
|
||||||
|
|
||||||
|
#endif
|
||||||
276
src/patrix/display/DisplayMatrix_FontSpecial.cpp
Normal file
276
src/patrix/display/DisplayMatrix_FontSpecial.cpp
Normal file
@ -0,0 +1,276 @@
|
|||||||
|
#include "DisplayMatrix_FontSpecial.h"
|
||||||
|
|
||||||
|
Symbol3 FONT_CHAR_SPACE = {
|
||||||
|
{_,_,_},
|
||||||
|
{_,_,_},
|
||||||
|
{_,_,_},
|
||||||
|
{_,_,_},
|
||||||
|
{_,_,_},
|
||||||
|
};
|
||||||
|
|
||||||
|
Symbol3 FONT_CHAR_MINUS = {
|
||||||
|
{_,_,_},
|
||||||
|
{_,_,_},
|
||||||
|
{X,X,X},
|
||||||
|
{_,_,_},
|
||||||
|
{_,_,_},
|
||||||
|
};
|
||||||
|
|
||||||
|
Symbol3 FONT_CHAR_PLUS = {
|
||||||
|
{_,_,_},
|
||||||
|
{_,X,_},
|
||||||
|
{X,X,X},
|
||||||
|
{_,X,_},
|
||||||
|
{_,_,_},
|
||||||
|
};
|
||||||
|
|
||||||
|
Symbol3 FONT_CHAR_UNDERLINE = {
|
||||||
|
{_,_,_},
|
||||||
|
{_,_,_},
|
||||||
|
{_,_,_},
|
||||||
|
{_,_,_},
|
||||||
|
{X,X,X},
|
||||||
|
};
|
||||||
|
|
||||||
|
Symbol3 FONT_CHAR_DEGREE = {
|
||||||
|
{_,X,_},
|
||||||
|
{X,_,X},
|
||||||
|
{_,X,_},
|
||||||
|
{_,_,_},
|
||||||
|
{_,_,_},
|
||||||
|
};
|
||||||
|
Symbol4 FONT_CHAR_EURO = {
|
||||||
|
{_,X,X,_},
|
||||||
|
{X,_,_,_},
|
||||||
|
{X,X,_,_},
|
||||||
|
{X,_,_,_},
|
||||||
|
{_,X,X,_},
|
||||||
|
};
|
||||||
|
Symbol4 FONT_CHAR_QUESTION = {
|
||||||
|
{_,X,X,_},
|
||||||
|
{X,_,_,X},
|
||||||
|
{_,_,X,X},
|
||||||
|
{_,_,_,_},
|
||||||
|
{_,_,X,_},
|
||||||
|
};
|
||||||
|
Symbol1 FONT_CHAR_EXCLAMATION = {
|
||||||
|
{X},
|
||||||
|
{X},
|
||||||
|
{X},
|
||||||
|
{_},
|
||||||
|
{X},
|
||||||
|
};
|
||||||
|
Symbol1 FONT_CHAR_POINT = {
|
||||||
|
{_},
|
||||||
|
{_},
|
||||||
|
{_},
|
||||||
|
{_},
|
||||||
|
{X},
|
||||||
|
};
|
||||||
|
Symbol1 FONT_CHAR_COMMA = {
|
||||||
|
{_},
|
||||||
|
{_},
|
||||||
|
{_},
|
||||||
|
{X},
|
||||||
|
{X},
|
||||||
|
};
|
||||||
|
Symbol1 FONT_CHAR_SEMICOLON = {
|
||||||
|
{_},
|
||||||
|
{X},
|
||||||
|
{_},
|
||||||
|
{X},
|
||||||
|
{X},
|
||||||
|
};
|
||||||
|
Symbol1 FONT_CHAR_COLON = {
|
||||||
|
{_},
|
||||||
|
{X},
|
||||||
|
{_},
|
||||||
|
{X},
|
||||||
|
{_},
|
||||||
|
};
|
||||||
|
Symbol5 FONT_CHAR_SHARP = {
|
||||||
|
{_,X,_,X,_},
|
||||||
|
{X,X,X,X,X},
|
||||||
|
{_,X,_,X,_},
|
||||||
|
{X,X,X,X,X},
|
||||||
|
{_,X,_,X,_},
|
||||||
|
};
|
||||||
|
Symbol4 FONT_CHAR_TILDE = {
|
||||||
|
{_,_,_,_},
|
||||||
|
{_,X,_,X},
|
||||||
|
{X,_,X,_},
|
||||||
|
{_,_,_,_},
|
||||||
|
{_,_,_,_},
|
||||||
|
};
|
||||||
|
Symbol3 FONT_CHAR_ASTERISK = {
|
||||||
|
{X,_,X},
|
||||||
|
{_,X,_},
|
||||||
|
{X,_,X},
|
||||||
|
{_,_,_},
|
||||||
|
{_,_,_},
|
||||||
|
};
|
||||||
|
Symbol3 FONT_CHAR_QUOTE_DOUBLE = {
|
||||||
|
{X,_,X},
|
||||||
|
{X,_,X},
|
||||||
|
{_,_,_},
|
||||||
|
{_,_,_},
|
||||||
|
{_,_,_},
|
||||||
|
};
|
||||||
|
Symbol1 FONT_CHAR_QUOTE_SINGLE = {
|
||||||
|
{X},
|
||||||
|
{X},
|
||||||
|
{_},
|
||||||
|
{_},
|
||||||
|
{_},
|
||||||
|
};
|
||||||
|
Symbol3 FONT_CHAR_EQUALS = {
|
||||||
|
{_,_,_},
|
||||||
|
{X,X,X},
|
||||||
|
{_,_,_},
|
||||||
|
{X,X,X},
|
||||||
|
{_,_,_},
|
||||||
|
};
|
||||||
|
Symbol2 FONT_CHAR_PAR_L = {
|
||||||
|
{_,X},
|
||||||
|
{X,_},
|
||||||
|
{X,_},
|
||||||
|
{X,_},
|
||||||
|
{_,X},
|
||||||
|
};
|
||||||
|
Symbol2 FONT_CHAR_PAR_R = {
|
||||||
|
{X,_},
|
||||||
|
{_,X},
|
||||||
|
{_,X},
|
||||||
|
{_,X},
|
||||||
|
{X,_},
|
||||||
|
};
|
||||||
|
Symbol2 FONT_CHAR_BRACKET_L = {
|
||||||
|
{X,X},
|
||||||
|
{X,_},
|
||||||
|
{X,_},
|
||||||
|
{X,_},
|
||||||
|
{X,X},
|
||||||
|
};
|
||||||
|
Symbol2 FONT_CHAR_BRACKET_R = {
|
||||||
|
{X,X},
|
||||||
|
{_,X},
|
||||||
|
{_,X},
|
||||||
|
{_,X},
|
||||||
|
{X,X},
|
||||||
|
};
|
||||||
|
Symbol3 FONT_CHAR_CURL_L = {
|
||||||
|
{_,X,X},
|
||||||
|
{_,X,_},
|
||||||
|
{X,_,_},
|
||||||
|
{_,X,_},
|
||||||
|
{_,X,X},
|
||||||
|
};
|
||||||
|
Symbol3 FONT_CHAR_CURL_R = {
|
||||||
|
{X,X,_},
|
||||||
|
{_,X,_},
|
||||||
|
{_,X,X},
|
||||||
|
{_,X,_},
|
||||||
|
{X,_,_},
|
||||||
|
};
|
||||||
|
Symbol3 FONT_CHAR_SLASH = {
|
||||||
|
{_,_,X},
|
||||||
|
{_,X,_},
|
||||||
|
{_,X,_},
|
||||||
|
{_,X,_},
|
||||||
|
{X,_,_},
|
||||||
|
};
|
||||||
|
Symbol3 FONT_CHAR_BACKSLASH = {
|
||||||
|
{X,_,_},
|
||||||
|
{_,X,_},
|
||||||
|
{_,X,_},
|
||||||
|
{_,X,_},
|
||||||
|
{_,_,X},
|
||||||
|
};
|
||||||
|
Symbol4 FONT_CHAR_AND = {
|
||||||
|
{_,X,_,_},
|
||||||
|
{X,_,X,_},
|
||||||
|
{_,X,_,X},
|
||||||
|
{X,_,X,_},
|
||||||
|
{_,X,_,X},
|
||||||
|
};
|
||||||
|
Symbol1 FONT_CHAR_PIPE = {
|
||||||
|
{X},
|
||||||
|
{X},
|
||||||
|
{X},
|
||||||
|
{X},
|
||||||
|
{X},
|
||||||
|
};
|
||||||
|
Symbol4 FONT_CHAR_DOLLAR = {
|
||||||
|
{_,X,X,X},
|
||||||
|
{X,_,X,_},
|
||||||
|
{_,X,X,_},
|
||||||
|
{_,X,_,X},
|
||||||
|
{X,X,X,_},
|
||||||
|
};
|
||||||
|
Symbol5 FONT_CHAR_AT = {
|
||||||
|
{_,X,X,X,_},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{X,_,X,X,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{_,X,X,X,_},
|
||||||
|
};
|
||||||
|
Symbol2 FONT_CHAR_LT = {
|
||||||
|
{_,_},
|
||||||
|
{_,X},
|
||||||
|
{X,_},
|
||||||
|
{_,X},
|
||||||
|
{_,_},
|
||||||
|
};
|
||||||
|
Symbol2 FONT_CHAR_GT = {
|
||||||
|
{_,_},
|
||||||
|
{X,_},
|
||||||
|
{_,X},
|
||||||
|
{X,_},
|
||||||
|
{_,_},
|
||||||
|
};
|
||||||
|
Symbol4 FONT_ERROR_ = {
|
||||||
|
{X,X,X,X},
|
||||||
|
{X,X,X,X},
|
||||||
|
{X,X,X,X},
|
||||||
|
{X,X,X,X},
|
||||||
|
{X,X,X,X},
|
||||||
|
};
|
||||||
|
|
||||||
|
Symbol5 FONT_CHAR_PERCENT = {
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{_,_,_,X,_},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
};
|
||||||
|
|
||||||
|
//@formatter:off
|
||||||
|
const auto B = Black;
|
||||||
|
Color M{204, 0, 250};
|
||||||
|
Color m{224, 121, 250};
|
||||||
|
Color g{130, 213, 0};
|
||||||
|
Color G{ 48, 89, 55};
|
||||||
|
Color F{ 75, 202, 0};
|
||||||
|
//@formatter:on
|
||||||
|
|
||||||
|
SymbolRGB8x8 FONT_CREEPER = {
|
||||||
|
{g, F, F, F, g, g, g, F},
|
||||||
|
{F, F, F, F, F, g, F, F},
|
||||||
|
{F, G, G, g, g, G, G, F},
|
||||||
|
{F, G, B, g, g, B, G, F},
|
||||||
|
{g, F, F, G, G, F, F, F},
|
||||||
|
{g, F, G, B, B, G, F, g},
|
||||||
|
{g, F, B, B, B, B, F, F},
|
||||||
|
{F, g, G, g, g, G, F, F},
|
||||||
|
};
|
||||||
|
|
||||||
|
SymbolRGB8x8 FONT_ENDERMAN = {
|
||||||
|
{B, B, B, B, B, B, B, B},
|
||||||
|
{B, B, B, B, B, B, B, B},
|
||||||
|
{B, B, B, B, B, B, B, B},
|
||||||
|
{B, B, B, B, B, B, B, B},
|
||||||
|
{m, M, m, B, B, m, M, m},
|
||||||
|
{B, B, B, B, B, B, B, B},
|
||||||
|
{B, B, B, B, B, B, B, B},
|
||||||
|
{B, B, B, B, B, B, B, B},
|
||||||
|
};
|
||||||
43
src/patrix/display/DisplayMatrix_FontSpecial.h
Normal file
43
src/patrix/display/DisplayMatrix_FontSpecial.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#ifndef DISPLAY_MATRIX_FONT_SPECIAL_H
|
||||||
|
#define DISPLAY_MATRIX_FONT_SPECIAL_H
|
||||||
|
|
||||||
|
#include "DisplayMatrix_FontCommon.h"
|
||||||
|
|
||||||
|
extern Symbol3 FONT_CHAR_SPACE;
|
||||||
|
extern Symbol3 FONT_CHAR_MINUS;
|
||||||
|
extern Symbol3 FONT_CHAR_PLUS;
|
||||||
|
extern Symbol3 FONT_CHAR_UNDERLINE;
|
||||||
|
extern Symbol3 FONT_CHAR_DEGREE;
|
||||||
|
extern Symbol4 FONT_CHAR_EURO;
|
||||||
|
extern Symbol4 FONT_CHAR_QUESTION;
|
||||||
|
extern Symbol1 FONT_CHAR_EXCLAMATION;
|
||||||
|
extern Symbol1 FONT_CHAR_POINT;
|
||||||
|
extern Symbol1 FONT_CHAR_COMMA;
|
||||||
|
extern Symbol1 FONT_CHAR_SEMICOLON;
|
||||||
|
extern Symbol1 FONT_CHAR_COLON;
|
||||||
|
extern Symbol5 FONT_CHAR_SHARP;
|
||||||
|
extern Symbol4 FONT_CHAR_TILDE;
|
||||||
|
extern Symbol3 FONT_CHAR_ASTERISK;
|
||||||
|
extern Symbol3 FONT_CHAR_QUOTE_DOUBLE;
|
||||||
|
extern Symbol1 FONT_CHAR_QUOTE_SINGLE;
|
||||||
|
extern Symbol3 FONT_CHAR_EQUALS;
|
||||||
|
extern Symbol2 FONT_CHAR_PAR_L;
|
||||||
|
extern Symbol2 FONT_CHAR_PAR_R;
|
||||||
|
extern Symbol2 FONT_CHAR_BRACKET_L;
|
||||||
|
extern Symbol2 FONT_CHAR_BRACKET_R;
|
||||||
|
extern Symbol3 FONT_CHAR_CURL_L;
|
||||||
|
extern Symbol3 FONT_CHAR_CURL_R;
|
||||||
|
extern Symbol3 FONT_CHAR_SLASH;
|
||||||
|
extern Symbol3 FONT_CHAR_BACKSLASH;
|
||||||
|
extern Symbol4 FONT_CHAR_AND;
|
||||||
|
extern Symbol1 FONT_CHAR_PIPE;
|
||||||
|
extern Symbol4 FONT_CHAR_DOLLAR;
|
||||||
|
extern Symbol5 FONT_CHAR_AT;
|
||||||
|
extern Symbol2 FONT_CHAR_LT;
|
||||||
|
extern Symbol2 FONT_CHAR_GT;
|
||||||
|
extern Symbol4 FONT_ERROR_;
|
||||||
|
extern Symbol5 FONT_CHAR_PERCENT;
|
||||||
|
extern SymbolRGB8x8 FONT_CREEPER;
|
||||||
|
extern SymbolRGB8x8 FONT_ENDERMAN;
|
||||||
|
|
||||||
|
#endif
|
||||||
186
src/patrix/display/DisplayMatrix_FontUpper.cpp
Normal file
186
src/patrix/display/DisplayMatrix_FontUpper.cpp
Normal file
@ -0,0 +1,186 @@
|
|||||||
|
#include "DisplayMatrix_FontUpper.h"
|
||||||
|
|
||||||
|
Symbol5 FONT_UPPER[] = {
|
||||||
|
{
|
||||||
|
{_,_,X,_,_},
|
||||||
|
{_,X,_,X,_},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{X,X,X,X,X},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,X,X,_,_},
|
||||||
|
{X,_,_,X,_},
|
||||||
|
{X,X,X,_,_},
|
||||||
|
{X,_,_,X,_},
|
||||||
|
{X,X,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,X,X,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{_,X,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,X,X,_,_},
|
||||||
|
{X,_,_,X,_},
|
||||||
|
{X,_,_,X,_},
|
||||||
|
{X,_,_,X,_},
|
||||||
|
{X,X,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,X,X,X,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,X,X,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,X,X,X,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,X,X,X,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,X,X,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,X,X,X,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,X,X,X},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{_,X,X,X,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,X,_},
|
||||||
|
{X,_,_,X,_},
|
||||||
|
{X,X,X,X,_},
|
||||||
|
{X,_,_,X,_},
|
||||||
|
{X,_,_,X,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,X,X,_,_},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,X,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{X,X,_,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{X,_,_,X,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,X,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{X,X,_,X,X},
|
||||||
|
{X,_,X,_,X},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{X,X,_,_,X},
|
||||||
|
{X,_,X,_,X},
|
||||||
|
{X,_,_,X,X},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,X,X,X,_},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{_,X,X,X,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,X,X,_,_},
|
||||||
|
{X,_,_,X,_},
|
||||||
|
{X,X,X,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,X,X,X,_},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{X,_,X,_,X},
|
||||||
|
{X,_,_,X,_},
|
||||||
|
{_,X,X,_,X},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,X,X,_,_},
|
||||||
|
{X,_,_,X,_},
|
||||||
|
{X,X,X,_,_},
|
||||||
|
{X,_,X,_,_},
|
||||||
|
{X,_,_,X,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{_,X,X,X,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
{_,X,X,_,_},
|
||||||
|
{_,_,_,X,_},
|
||||||
|
{X,X,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,X,X,X,X},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{_,X,X,X,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{_,X,_,X,_},
|
||||||
|
{_,X,_,X,_},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{X,_,X,_,X},
|
||||||
|
{X,X,_,X,X},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{_,X,_,X,_},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
{_,X,_,X,_},
|
||||||
|
{X,_,_,_,X},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,_,_,_,X},
|
||||||
|
{_,X,_,X,_},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{X,_,_,_,_},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{X,X,X,X,X},
|
||||||
|
{_,_,_,X,_},
|
||||||
|
{_,_,X,_,_},
|
||||||
|
{_,X,_,_,_},
|
||||||
|
{X,X,X,X,X},
|
||||||
|
},
|
||||||
|
};
|
||||||
8
src/patrix/display/DisplayMatrix_FontUpper.h
Normal file
8
src/patrix/display/DisplayMatrix_FontUpper.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef DISPLAY_MATRIX_FONT_UPPER_H
|
||||||
|
#define DISPLAY_MATRIX_FONT_UPPER_H
|
||||||
|
|
||||||
|
#include "DisplayMatrix_FontCommon.h"
|
||||||
|
|
||||||
|
extern Symbol5 FONT_UPPER[];
|
||||||
|
|
||||||
|
#endif
|
||||||
14
src/patrix/display/DisplayMatrix_common.cpp
Normal file
14
src/patrix/display/DisplayMatrix_common.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include "DisplayMatrix_common.h"
|
||||||
|
|
||||||
|
//@formatter:off
|
||||||
|
const Color Transparent { 0, 0, 0, 0};
|
||||||
|
const Color Black { 0, 0, 0, 255};
|
||||||
|
const Color Red {255, 0, 0, 255};
|
||||||
|
const Color Yellow {255, 255, 0, 255};
|
||||||
|
const Color Green { 0, 255, 0, 255};
|
||||||
|
const Color Cyan { 0, 255, 255, 255};
|
||||||
|
const Color Blue { 0, 0, 255, 255};
|
||||||
|
const Color Magenta {255, 0, 255, 255};
|
||||||
|
const Color Gray {127, 127, 127, 255};
|
||||||
|
const Color White {255, 255, 255, 255};
|
||||||
|
//@formatter:on
|
||||||
42
src/patrix/display/DisplayMatrix_common.h
Normal file
42
src/patrix/display/DisplayMatrix_common.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#ifndef DISPLAY_MATRIX_COMMON_H
|
||||||
|
#define DISPLAY_MATRIX_COMMON_H
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
#define _ false
|
||||||
|
#define X true
|
||||||
|
|
||||||
|
#define countof(a) (sizeof(a)/sizeof(a[0]))
|
||||||
|
|
||||||
|
struct Color {
|
||||||
|
uint8_t r;
|
||||||
|
uint8_t g;
|
||||||
|
uint8_t b;
|
||||||
|
uint8_t a;
|
||||||
|
|
||||||
|
void blend(const Color other, const uint8_t alpha) {
|
||||||
|
const auto thisFactor = other.a * alpha / (255.0 * 255.0);
|
||||||
|
const auto otherFactor = 1.0 - thisFactor;
|
||||||
|
blend(&this->r, thisFactor, other.r, otherFactor);
|
||||||
|
blend(&this->g, thisFactor, other.g, otherFactor);
|
||||||
|
blend(&this->b, thisFactor, other.b, otherFactor);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void blend(uint8_t *thisValue, const double thisFactor, const uint8_t otherValue, const double otherFactor) {
|
||||||
|
*thisValue = static_cast<uint8_t>(round(max(0.0, min(255.0, (*thisValue * thisFactor + otherValue * otherFactor) / 2.0))));
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
extern const Color Transparent;
|
||||||
|
extern const Color Black;
|
||||||
|
extern const Color Red;
|
||||||
|
extern const Color Yellow;
|
||||||
|
extern const Color Green;
|
||||||
|
extern const Color Cyan;
|
||||||
|
extern const Color Blue;
|
||||||
|
extern const Color Magenta;
|
||||||
|
extern const Color Gray;
|
||||||
|
extern const Color White;
|
||||||
|
|
||||||
|
#endif
|
||||||
21
src/patrix/display/DisplayMatrix_draw.h
Normal file
21
src/patrix/display/DisplayMatrix_draw.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef DISPLAY_MATRIX_DRAW_H
|
||||||
|
#define DISPLAY_MATRIX_DRAW_H
|
||||||
|
|
||||||
|
template<int W, int H>
|
||||||
|
void DisplayMatrix<W, H>::clear() {
|
||||||
|
const auto backup = foreground;
|
||||||
|
foreground = Black;
|
||||||
|
this->fillRect();
|
||||||
|
foreground = backup;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int W, int H>
|
||||||
|
void DisplayMatrix<W, H>::fillRect(const int w, const int h) const {
|
||||||
|
for (auto y = cursorY; y < cursorY + h; ++y) {
|
||||||
|
for (auto x = cursorX; x < cursorX + w; ++x) {
|
||||||
|
matrix[y][x].blend(foreground, alpha);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
154
src/patrix/display/DisplayMatrix_print.h
Normal file
154
src/patrix/display/DisplayMatrix_print.h
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
#ifndef DISPLAYMATRIX_PRINT_H
|
||||||
|
#define DISPLAYMATRIX_PRINT_H
|
||||||
|
|
||||||
|
#include "DisplayMatrix_FontLower.h"
|
||||||
|
#include "DisplayMatrix_FontNumber.h"
|
||||||
|
#include "DisplayMatrix_FontSpecial.h"
|
||||||
|
#include "DisplayMatrix_FontUpper.h"
|
||||||
|
|
||||||
|
template<int W, int H>
|
||||||
|
void DisplayMatrix<W, H>::printf(const char *format, ...) {
|
||||||
|
char buffer[64];
|
||||||
|
va_list args;
|
||||||
|
va_start(args, format);
|
||||||
|
vsnprintf(buffer, sizeof buffer, format, args);
|
||||||
|
va_end(args);
|
||||||
|
print(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int W, int H>
|
||||||
|
void DisplayMatrix<W, H>::print(const char *str) {
|
||||||
|
while (*str != '\0') {
|
||||||
|
print(&str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int W, int H>
|
||||||
|
void DisplayMatrix<W, H>::print(const char **cPP) {
|
||||||
|
const auto a = *(*cPP)++;
|
||||||
|
auto b = '\0';
|
||||||
|
auto c = '\0';
|
||||||
|
if ('a' <= a && a <= 'z') {
|
||||||
|
return print(FONT_LOWER[a - 'a']);
|
||||||
|
}
|
||||||
|
if ('A' <= a && a <= 'Z') {
|
||||||
|
return print(FONT_UPPER[a - 'A']);
|
||||||
|
}
|
||||||
|
if ('0' <= a && a <= '9') {
|
||||||
|
return print(FONT_NUMBER[a - '0']);
|
||||||
|
}
|
||||||
|
if (a == 0xC2) {
|
||||||
|
b = *(*cPP)++;
|
||||||
|
switch (b) {
|
||||||
|
case 0xB0: return print(FONT_CHAR_DEGREE);
|
||||||
|
default: return print(FONT_ERROR_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (a == 0xE2) {
|
||||||
|
b = *(*cPP)++;
|
||||||
|
switch (b) {
|
||||||
|
case 0x82:
|
||||||
|
c = *(*cPP)++;
|
||||||
|
switch (c) {
|
||||||
|
case 0xAC: return print(FONT_CHAR_EURO);
|
||||||
|
default: return print(FONT_ERROR_);
|
||||||
|
}
|
||||||
|
default: return print(FONT_ERROR_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch (a) {
|
||||||
|
case ' ': return print(FONT_CHAR_SPACE);
|
||||||
|
case '-': return print(FONT_CHAR_MINUS);
|
||||||
|
case '+': return print(FONT_CHAR_PLUS);
|
||||||
|
case '_': return print(FONT_CHAR_UNDERLINE);
|
||||||
|
case '%': return print(FONT_CHAR_PERCENT);
|
||||||
|
case '?': return print(FONT_CHAR_QUESTION);
|
||||||
|
case '!': return print(FONT_CHAR_EXCLAMATION);
|
||||||
|
case '.': return print(FONT_CHAR_POINT);
|
||||||
|
case ',': return print(FONT_CHAR_COMMA);
|
||||||
|
case ';': return print(FONT_CHAR_SEMICOLON);
|
||||||
|
case ':': return print(FONT_CHAR_COLON);
|
||||||
|
case '#': return print(FONT_CHAR_SHARP);
|
||||||
|
case '~': return print(FONT_CHAR_TILDE);
|
||||||
|
case '*': return print(FONT_CHAR_ASTERISK);
|
||||||
|
case '"': return print(FONT_CHAR_QUOTE_DOUBLE);
|
||||||
|
case '\'': return print(FONT_CHAR_QUOTE_SINGLE);
|
||||||
|
case '=': return print(FONT_CHAR_EQUALS);
|
||||||
|
case '(': return print(FONT_CHAR_PAR_L);
|
||||||
|
case ')': return print(FONT_CHAR_PAR_R);
|
||||||
|
case '[': return print(FONT_CHAR_BRACKET_L);
|
||||||
|
case ']': return print(FONT_CHAR_BRACKET_R);
|
||||||
|
case '{': return print(FONT_CHAR_CURL_L);
|
||||||
|
case '}': return print(FONT_CHAR_CURL_R);
|
||||||
|
case '/': return print(FONT_CHAR_SLASH);
|
||||||
|
case '\\': return print(FONT_CHAR_BACKSLASH);
|
||||||
|
case '&': return print(FONT_CHAR_AND);
|
||||||
|
case '|': return print(FONT_CHAR_PIPE);
|
||||||
|
case '$': return print(FONT_CHAR_DOLLAR);
|
||||||
|
case '@': return print(FONT_CHAR_AT);
|
||||||
|
case '<': return print(FONT_CHAR_LT);
|
||||||
|
case '>': return print(FONT_CHAR_GT);
|
||||||
|
default: return print(FONT_ERROR_);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int W, int H>
|
||||||
|
void DisplayMatrix<W, H>::print(Symbol1 s) {
|
||||||
|
print(reinterpret_cast<bool **>(s),countof(Symbol1),countof(Symbol1[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int W, int H>
|
||||||
|
void DisplayMatrix<W, H>::print(Symbol2 s) {
|
||||||
|
print(reinterpret_cast<bool **>(s),countof(Symbol2),countof(Symbol2[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int W, int H>
|
||||||
|
void DisplayMatrix<W, H>::print(Symbol3 s) {
|
||||||
|
print(reinterpret_cast<bool **>(s),countof(Symbol3),countof(Symbol3[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int W, int H>
|
||||||
|
void DisplayMatrix<W, H>::print(Symbol4 s) {
|
||||||
|
print(reinterpret_cast<bool **>(s),countof(Symbol4),countof(Symbol4[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int W, int H>
|
||||||
|
void DisplayMatrix<W, H>::print(Symbol5 s) {
|
||||||
|
print(reinterpret_cast<bool **>(s),countof(Symbol5),countof(Symbol5[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int W, int H>
|
||||||
|
void DisplayMatrix<W, H>::print(bool **s, const size_t w, const size_t h) {
|
||||||
|
auto xMax = 0;
|
||||||
|
for (auto y = 0; y < h; y++) {
|
||||||
|
for (auto x = 0; x < w; x++) {
|
||||||
|
const auto c = s[y][x];
|
||||||
|
if (c) {
|
||||||
|
matrix[y][x].blend(foreground, alpha);
|
||||||
|
xMax = x > xMax ? x : xMax;
|
||||||
|
} else {
|
||||||
|
matrix[y][x].blend(background, alpha);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cursorX += xMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int W, int H>
|
||||||
|
void DisplayMatrix<W, H>::print(SymbolRGB8x8 s) {
|
||||||
|
print(reinterpret_cast<Color **>(s),countof(SymbolRGB8x8),countof(SymbolRGB8x8[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<int W, int H>
|
||||||
|
void DisplayMatrix<W, H>::print(Color **s, const size_t w, const size_t h) {
|
||||||
|
for (auto y = 0; y < h; y++) {
|
||||||
|
for (auto x = 0; x < w; x++) {
|
||||||
|
const auto color = s[y][x];
|
||||||
|
matrix[y][x].blend(color, alpha);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cursorX += w;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue
Block a user