This commit is contained in:
2026-02-05 14:40:45 +01:00
parent 84a047f67b
commit 88bf1e3bb2
9 changed files with 305 additions and 125 deletions
+1
View File
@@ -8,6 +8,7 @@
#define DISPLAY_MAX_Y PANEL_PIXEL_COUNT - 1 #define DISPLAY_MAX_Y PANEL_PIXEL_COUNT - 1
#define TEXT_MAX_LENGTH 64 #define TEXT_MAX_LENGTH 64
#define MAX_MULTI_COLOR_TEXT_NODES_COUNT $
#define MAX_TEXT_NODES_COUNT 4 #define MAX_TEXT_NODES_COUNT 4
#define MAX_IMAGES_SAVED 2 #define MAX_IMAGES_SAVED 2
+34 -18
View File
@@ -21,11 +21,16 @@ const char index_html[] PROGMEM = R"rawliteral(
height: 200px; height: 200px;
margin-top: 20px; margin-top: 20px;
} }
.text-controls {
margin-top: 20px;
}
.text-input-group {
margin-bottom: 10px;
}
</style> </style>
</head> </head>
<body> <body>
<h1>LED Panel Control</h1> <h1>LED Panel Control</h1>
<button class="button" onclick="showSavedPixels()">Show Saved Pixels</button>
<button class="button" onclick="location.href='/upload-page'">Upload Image</button> <button class="button" onclick="location.href='/upload-page'">Upload Image</button>
<br> <br>
<div> <div>
@@ -34,25 +39,20 @@ const char index_html[] PROGMEM = R"rawliteral(
<span id="brightnessValue">100</span> <span id="brightnessValue">100</span>
</div> </div>
<br> <br>
<textarea id="jsonInput" placeholder="Paste your JSON image data here..."></textarea> <div class="text-controls">
<h3>Send Text</h3>
<div class="text-input-group">
<input type="text" id="textInput" placeholder="Enter text...">
<input type="color" id="textColorPicker" value="#ffffff">
<input type="number" id="slownessInput" placeholder="Slowness" value="2" min="0" max="255">
</div>
<div class="text-buttons">
<button class="button" onclick="sendText('top')">Send to Top</button>
<button class="button" onclick="sendText('bottom')">Send to Bottom</button>
</div>
</div>
<br> <br>
<button class="button" onclick="uploadAndDraw()">Upload and Draw</button>
<script> <script>
function showSavedPixels() {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/show-saved", true);
xhr.send();
}
function uploadAndDraw() {
var jsonData = document.getElementById("jsonInput").value;
var xhr = new XMLHttpRequest();
xhr.open("POST", "/upload", true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(jsonData);
}
function updateBrightness() { function updateBrightness() {
var brightness = document.getElementById("brightness").value; var brightness = document.getElementById("brightness").value;
document.getElementById("brightnessValue").innerText = brightness; document.getElementById("brightnessValue").innerText = brightness;
@@ -61,6 +61,22 @@ const char index_html[] PROGMEM = R"rawliteral(
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("value=" + brightness); xhr.send("value=" + brightness);
} }
function sendText(position) {
const text = document.getElementById('textInput').value;
const color = document.getElementById('textColorPicker').value;
const slowness = document.getElementById('slownessInput').value;
if (!text) {
alert('Please enter some text.');
return;
}
var xhr = new XMLHttpRequest();
xhr.open("POST", "/text", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("text=" + encodeURIComponent(text) + "&color=" + encodeURIComponent(color) + "&position=" + position + "&slowness=" + slowness);
}
</script> </script>
</body> </body>
</html> </html>
+122 -13
View File
@@ -16,8 +16,10 @@
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
TextNode text_nodes[MAX_TEXT_NODES_COUNT]; TextNode text_nodes[MAX_TEXT_NODES_COUNT];
MultiColorTextNode multi_color_text_node[MAX_TEXT_NODES_COUNT];
Cursor cursor; Cursor cursor;
short ever_created_text_nodes = 0; unsigned char ever_created_text_nodes = 0;
unsigned char ever_created_multi_color_text_nodes = 0;
Image saved_images[MAX_IMAGES_SAVED] = { Image saved_images[MAX_IMAGES_SAVED] = {
{},{} {},{}
@@ -133,6 +135,121 @@ void scrollAllScrollableTexts(bool split_scroll_mode = false)
} }
} }
void addNewMultiColor
(
char text[TEXT_MAX_LENGTH + 1], RGBWithIndex colors[4], unsigned char color_count, bool handle_pos_via_cursor = true, short pos_x = 0, short pos_y = 0,
unsigned char scroll_slowness = 1, bool is_scrolling = true, bool is_small = true
)
{
unsigned char text_length = strlen(text);
if (text_length == 0){return;}
for (unsigned char i = 0; i < MAX_TEXT_NODES_COUNT; i++)
{
if (multi_color_text_node[i].is_deleted)
{
strncpy(multi_color_text_node[i].content, text, TEXT_MAX_LENGTH);
multi_color_text_node[i].color_count = color_count;
for(int j = 0; j < color_count; j++)
{
multi_color_text_node[i].colors[j] = colors[j];
}
if (handle_pos_via_cursor)
{
multi_color_text_node[i].pos_x = cursor.x;
multi_color_text_node[i].pos_y = cursor.y;
}
else
{
multi_color_text_node[i].pos_x = pos_x;
multi_color_text_node[i].pos_y = pos_y;
}
multi_color_text_node[i].characterSize.height = is_small ? SMALL_TEXT_HEIGHT : MEDIUM_TEXT_HEIGHT;
multi_color_text_node[i].characterSize.width = is_small ? SMALL_TEXT_WIDTH : MEDIUM_TEXT_WIDTH;
multi_color_text_node[i].character_count = text_length;
multi_color_text_node[i].scroll_slowness = scroll_slowness;
multi_color_text_node[i].is_scrolling = is_scrolling;
multi_color_text_node[i].is_deleted = false;
ever_created_multi_color_text_nodes++;
if (handle_pos_via_cursor)
{
cursor.x += (multi_color_text_node[i].characterSize.width + 1) * text_length;
}
break;
}
}
}
short getMultiColorTextNodeX2(MultiColorTextNode *node)
{
if (node->character_count == 0) return node->pos_x;
return node->pos_x + (node->characterSize.width * node->character_count) + (node->character_count - 1) - 1;
}
void scrollAllMultiColorTexts(bool split_scroll_mode = false)
{
for (unsigned char i = 0; i < MAX_TEXT_NODES_COUNT; i++)
{
if (multi_color_text_node[i].is_deleted) {continue;}
if (multi_color_text_node[i].is_scrolling)
{
if (multi_color_text_node[i].scroll_slowness > multi_color_text_node[i].scroll_progress)
{
multi_color_text_node[i].scroll_progress++;
}
else
{
multi_color_text_node[i].scroll_progress = 0;
short x1 = multi_color_text_node[i].pos_x;
short x2 = getMultiColorTextNodeX2(&multi_color_text_node[i]);
if (split_scroll_mode || multi_color_text_node[i].pos_y < 7)
{
if (x2 < 0)
{
multi_color_text_node[i].is_deleted = true;
continue;
}
multi_color_text_node[i].pos_x--;
}
else
{
if (x1 > DISPLAY_MAX_X)
{
multi_color_text_node[i].is_deleted = true;
continue;
}
multi_color_text_node[i].pos_x++;
}
}
}
cursor.x = multi_color_text_node[i].pos_x;
cursor.y = multi_color_text_node[i].pos_y;
uint32_t current_color = pixels.Color(multi_color_text_node[i].colors[0].r, multi_color_text_node[i].colors[0].g, multi_color_text_node[i].colors[0].b);
unsigned char color_index = 0;
for (unsigned char j = 0; j < multi_color_text_node[i].character_count; j++)
{
if (color_index < multi_color_text_node[i].color_count - 1 && multi_color_text_node[i].colors[color_index+1].start_index == j)
{
color_index++;
current_color = pixels.Color(multi_color_text_node[i].colors[color_index].r, multi_color_text_node[i].colors[color_index].g, multi_color_text_node[i].colors[color_index].b);
}
char ch = multi_color_text_node[i].content[j];
if (ch < '!' || ch > '~')
{
ch = ' ';
}
drawCharacter(font7x5[ch - ' '], multi_color_text_node[i].characterSize.height, multi_color_text_node[i].characterSize.width, current_color, &cursor);
}
}
}
void drawImageFromMemoryByIndex(unsigned char image_index, short pos_x, short pos_y, unsigned char brightness) void drawImageFromMemoryByIndex(unsigned char image_index, short pos_x, short pos_y, unsigned char brightness)
{ {
Image* img = &saved_images[image_index]; Image* img = &saved_images[image_index];
@@ -162,6 +279,9 @@ void setup()
addNewTextNode("NET", 0xFF050505, false, 0, 0); addNewTextNode("NET", 0xFF050505, false, 0, 0);
addNewTextNode("AWAIT", 0xFF050505, false, 0, 9); addNewTextNode("AWAIT", 0xFF050505, false, 0, 9);
RGBWithIndex colors[2] = {RGBWithIndex(255, 0, 0, 0), RGBWithIndex(0, 0, 255, 6)};
addNewMultiColor("HELLO WORLD", colors, 2, false, 0, 0, 1, true, true);
pixels.show(); pixels.show();
start_server(); start_server();
} }
@@ -170,19 +290,8 @@ void loop()
{ {
pixels.clear(); pixels.clear();
handle_server(); handle_server();
if (saved_images[0].width > 0)
{
drawImageFromMemoryByIndex(0, 0, 0, brightness);
}
else
{
if (text_nodes[0].is_deleted && text_nodes[2].is_deleted)
{
}
scrollAllScrollableTexts(); scrollAllScrollableTexts();
} scrollAllMultiColorTexts();
pixels.show(); pixels.show();
} }
-3
View File
@@ -6,14 +6,11 @@
#include "structs.h" #include "structs.h"
extern Adafruit_NeoPixel pixels; extern Adafruit_NeoPixel pixels;
extern unsigned char saved_images_count;
extern Cursor cursor1; extern Cursor cursor1;
extern uint32_t saved_imaged[2][16][16];
// Function declarations // Function declarations
void setPixel(short x, short y, uint32_t color); void setPixel(short x, short y, uint32_t color);
uint32_t getPixelColor(short x, short y); uint32_t getPixelColor(short x, short y);
void drawImageFromSaved(short offset_x, short offset_y, unsigned char i);
void drawCharacterPart(const bool* character_row, unsigned char width, uint32_t color, short start_x, short start_y); void drawCharacterPart(const bool* character_row, unsigned char width, uint32_t color, short start_x, short start_y);
void drawCharacter(const bool (*character)[5], unsigned char height, unsigned char width, uint32_t color, Cursor (*used_cursor)); void drawCharacter(const bool (*character)[5], unsigned char height, unsigned char width, uint32_t color, Cursor (*used_cursor));
void fillPixels(short x1, short y1, short x2, short y2, uint32_t color); void fillPixels(short x1, short y1, short x2, short y2, uint32_t color);
-75
View File
@@ -1,60 +1,6 @@
#include "lowLevel.h" #include "lowLevel.h"
unsigned char saved_images_count = 0;
uint32_t saved_imaged[2][16][16] =
{
{
{
0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFFFFFF00, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000
},
{
0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000
}
}
};
void setPixel(short x, short y, uint32_t color) void setPixel(short x, short y, uint32_t color)
{ {
@@ -76,28 +22,7 @@ uint32_t getPixelColor(short x, short y)
return pixels.getPixelColor(y + (x * PANEL_PIXEL_COUNT)); return pixels.getPixelColor(y + (x * PANEL_PIXEL_COUNT));
} }
void drawImageFromSaved(short offset_x, short offset_y, unsigned char i)
{
for (int row = 0; row < 16; row++)
{
for (int col = 0; col < 16; col++)
{
uint32_t px_color = saved_imaged[i][row][col];
if (!px_color)
{
continue;
}
short pixel_x = col + offset_x;
short pixel_y = row + offset_y;
if (pixel_x >= 0 && pixel_x < NUMPIXELS &&
pixel_y >= 0 && pixel_y < NUMPIXELS)
{
setPixel(pixel_x, pixel_y, px_color);
}
}
}
}
void drawCharacterPart(const bool* character_row, unsigned char height, uint32_t color, short start_x, short start_y) void drawCharacterPart(const bool* character_row, unsigned char height, uint32_t color, short start_x, short start_y)
{ {
+76
View File
@@ -230,6 +230,41 @@
.copied-message.show { .copied-message.show {
opacity: 1; opacity: 1;
} }
.text-controls {
margin: 20px 0;
padding: 20px;
background-color: #161b22;
border-radius: 8px;
border: 1px solid #30363d;
text-align: center;
}
.text-controls h3 {
margin-top: 0;
color: #c9d1d9;
}
.text-input-group {
display: flex;
justify-content: center;
gap: 15px;
margin: 15px 0;
}
.text-input-group input[type="text"] {
width: 300px;
padding: 8px;
font-size: 16px;
border: 1px solid #30363d;
border-radius: 6px;
background-color: #0d1117;
color: #c9d1d9;
}
.text-buttons {
margin-top: 15px;
}
</style> </style>
</head> </head>
<body> <body>
@@ -265,6 +300,18 @@
<button onclick="fillAll()">Fill All</button> <button onclick="fillAll()">Fill All</button>
</div> </div>
<div class="text-controls">
<h3>Send Text</h3>
<div class="text-input-group">
<input type="text" id="textInput" placeholder="Enter text...">
<input type="color" id="textColorPicker" value="#ffffff">
</div>
<div class="text-buttons">
<button onclick="sendText('top')">Send to Top</button>
<button onclick="sendText('bottom')">Send to Bottom</button>
</div>
</div>
<div class="export-section"> <div class="export-section">
<h3>Export Format</h3> <h3>Export Format</h3>
<div class="export-options"> <div class="export-options">
@@ -513,6 +560,35 @@
}); });
} }
function sendText(position) {
const text = document.getElementById('textInput').value;
const color = document.getElementById('textColorPicker').value;
if (!text) {
alert('Please enter some text.');
return;
}
const formData = new FormData();
formData.append('text', text);
formData.append('color', color);
formData.append('position', position);
fetch('/text', {
method: 'POST',
body: new URLSearchParams(formData)
})
.then(response => {
if (!response.ok) {
alert('Error sending text.');
}
})
.catch(error => {
console.error('Error:', error);
alert('Error sending text.');
});
}
// Clear all cells // Clear all cells
function clearGrid() { function clearGrid() {
for (let i = 0; i < currentRows; i++) { for (let i = 0; i < currentRows; i++) {
+3 -1
View File
@@ -6,8 +6,8 @@
extern Adafruit_NeoPixel pixels; extern Adafruit_NeoPixel pixels;
extern Image saved_images[MAX_IMAGES_SAVED]; extern Image saved_images[MAX_IMAGES_SAVED];
extern unsigned char saved_images_count;
extern TextNode text_nodes[MAX_TEXT_NODES_COUNT]; extern TextNode text_nodes[MAX_TEXT_NODES_COUNT];
extern MultiColorTextNode multi_color_text_node[MAX_TEXT_NODES_COUNT];
extern Cursor cursor; extern Cursor cursor;
extern unsigned char brightness; extern unsigned char brightness;
@@ -18,6 +18,8 @@ void start_server();
void handle_server(); void handle_server();
void addNewTextNode(char text[TEXT_MAX_LENGTH + 1], uint32_t color, bool handle_pos_via_cursor, short pos_x, short pos_y, unsigned char scroll_slowness, bool is_scrolling, bool is_small); void addNewTextNode(char text[TEXT_MAX_LENGTH + 1], uint32_t color, bool handle_pos_via_cursor, short pos_x, short pos_y, unsigned char scroll_slowness, bool is_scrolling, bool is_small);
void scrollAllScrollableTexts(bool split_scroll_mode); void scrollAllScrollableTexts(bool split_scroll_mode);
void addNewMultiColor(char text[TEXT_MAX_LENGTH + 1], RGBWithIndex colors[4], unsigned char color_count, bool handle_pos_via_cursor, short pos_x, short pos_y, unsigned char scroll_slowness, bool is_scrolling, bool is_small);
void scrollAllMultiColorTexts(bool split_scroll_mode);
void drawCharacter(const bool (*character)[5], unsigned char height, unsigned char width, uint32_t color, Cursor (*used_cursor)); void drawCharacter(const bool (*character)[5], unsigned char height, unsigned char width, uint32_t color, Cursor (*used_cursor));
+25 -6
View File
@@ -96,14 +96,33 @@ void handleBmpUpload() {
void handleShowSaved()
{ void handleText() {
pixels.clear(); if (server.hasArg("text") && server.hasArg("color") && server.hasArg("position") && server.hasArg("slowness")) {
drawImageFromMemoryByIndex(0, 0, 0, brightness); String text_str = server.arg("text");
pixels.show(); String colorStr = server.arg("color");
String position = server.arg("position");
unsigned char slowness = server.arg("slowness").toInt();
char text[TEXT_MAX_LENGTH + 1];
text_str.toCharArray(text, TEXT_MAX_LENGTH + 1);
uint32_t color = strtol(colorStr.substring(1).c_str(), NULL, 16);
if (position == "top") {
addNewTextNode(text, color, false, 43, 0, slowness, true, false);
} else if (position == "bottom") {
addNewTextNode(text, color, false, -text_str.length() * 6, 9, slowness, true, false);
}
server.send(200, "text/plain", "OK"); server.send(200, "text/plain", "OK");
} else {
server.send(400, "text/plain", "Invalid arguments");
}
} }
void start_server() void start_server()
{ {
WiFi.begin(ssid, password); WiFi.begin(ssid, password);
@@ -116,8 +135,8 @@ void start_server()
Serial.println(WiFi.localIP()); Serial.println(WiFi.localIP());
server.on("/", handleRoot); server.on("/", handleRoot);
server.on("/text", HTTP_POST, handleText);
server.on("/brightness", HTTP_POST, handleBrightness); server.on("/brightness", HTTP_POST, handleBrightness);
server.on("/show-saved", handleShowSaved);
server.on("/upload-page", HTTP_GET, handleUploadPage); server.on("/upload-page", HTTP_GET, handleUploadPage);
server.on("/upload-bmp", HTTP_POST, []() { server.on("/upload-bmp", HTTP_POST, []() {
if (upload_error_message.length() > 0) { if (upload_error_message.length() > 0) {
+38 -3
View File
@@ -22,13 +22,13 @@ struct TextNode
{ {
char content[TEXT_MAX_LENGTH]; char content[TEXT_MAX_LENGTH];
uint32_t color; uint32_t color;
short pos_x;
short pos_y;
struct CharacterSize struct CharacterSize
{ {
unsigned short height; unsigned short height;
unsigned short width; unsigned short width;
} characterSize; } characterSize;
short pos_x;
short pos_y;
unsigned char character_count; unsigned char character_count;
unsigned char scroll_slowness; unsigned char scroll_slowness;
unsigned char scroll_progress; unsigned char scroll_progress;
@@ -36,7 +36,7 @@ struct TextNode
bool is_scrolling; bool is_scrolling;
TextNode() : color(0), pos_x(0), pos_y(0), character_count(0), scroll_slowness(0), scroll_progress(0), characterSize({7,5}), is_deleted(true), is_scrolling() {} TextNode() : color(0), pos_x(0), pos_y(0), character_count(0), scroll_slowness(0), scroll_progress(0), characterSize({7,5}), is_deleted(true), is_scrolling(true) {}
}; };
struct RGB struct RGB
@@ -44,6 +44,41 @@ struct RGB
unsigned char r; unsigned char r;
unsigned char g; unsigned char g;
unsigned char b; unsigned char b;
RGB() : r(0), g(0), b(0) {}
};
struct RGBWithIndex
{
unsigned char r;
unsigned char g;
unsigned char b;
unsigned char start_index;
RGBWithIndex() : r(0), g(0), b(0), start_index(0) {}
RGBWithIndex(unsigned char r, unsigned char g, unsigned char b, unsigned char start_index) : r(r), g(g), b(b), start_index(start_index) {}
};
struct MultiColorTextNode
{
char content[TEXT_MAX_LENGTH];
RGBWithIndex colors[4];
struct CharacterSize
{
unsigned short height;
unsigned short width;
} characterSize;
short pos_x;
short pos_y;
unsigned char color_count;
unsigned char character_count;
unsigned char scroll_slowness;
unsigned char scroll_progress;
bool is_deleted;
bool is_scrolling;
MultiColorTextNode() : pos_x(0), pos_y(0), character_count(0), scroll_slowness(0), scroll_progress(0), characterSize({7,5}), is_deleted(true), is_scrolling(true), color_count(0) {}
}; };
struct Image struct Image