deleting works

This commit is contained in:
2026-01-28 15:02:01 +01:00
parent cee3b737d0
commit 24cb0fd56b
2 changed files with 22 additions and 4 deletions
+21 -3
View File
@@ -77,15 +77,33 @@ void scrollAllScrollableTexts()
{
if (!text_nodes[i].is_deleted && text_nodes[i].is_scrolling)
{
short x1 = text_nodes[i].pos_x;
short y1 = text_nodes[i].pos_y;
short x2 = text_nodes[i].pos_x + text_nodes[i].characterSize.width * text_nodes[i].character_count + text_nodes[i].character_count - 1;
short y2 = text_nodes[i].pos_y + text_nodes[i].characterSize.height - 1;
// If the text is scrolling on the upper part of the screen, scroll it to the left.
if (text_nodes[i].pos_y < 7)
{
shiftGivenRectangleLeft(text_nodes[i].pos_x, text_nodes[i].pos_y, text_nodes[i].pos_x + text_nodes[i].characterSize.width * text_nodes[i].character_count + text_nodes[i].character_count - 1, text_nodes[i].pos_y + text_nodes[i].characterSize.height - 1, text_nodes[i].scroll_slowness);
// If the text is completely out of the screen, mark it as deleted.
if (x2 < 0)
{
text_nodes[i].is_deleted = true;
continue;
}
shiftGivenRectangleLeft(x1, y1, x2, y2, text_nodes[i].scroll_slowness);
text_nodes[i].pos_x -= text_nodes[i].scroll_slowness;
}
// If the text is scrolling on the lower part of the screen, scroll it to the right.
else
{
shiftGivenRectangleRight(text_nodes[i].pos_x, text_nodes[i].pos_y, text_nodes[i].pos_x + text_nodes[i].characterSize.width * text_nodes[i].character_count + text_nodes[i].character_count - 1, text_nodes[i].pos_y + text_nodes[i].characterSize.height - 1, text_nodes[i].scroll_slowness);
text_nodes[i].pos_x += text_6nodes[i].scroll_slowness;
// If the text is completely out of the screen, mark it as deleted.
if (x1 > PANEL_MAX_X)
{
text_nodes[i].is_deleted = true;
continue;
}
shiftGivenRectangleRight(x1, y1, x2, y2, text_nodes[i].scroll_slowness);
text_nodes[i].pos_x += text_nodes[i].scroll_slowness;
}
}
}
+1 -1
View File
@@ -35,7 +35,7 @@ struct TextNode
bool is_scrolling;
TextNode() : color(0), pos_x(0), pos_y(0), character_count(0), scroll_slowness(1), characterSize({7,5}), is_deleted(true), is_scrolling(true) {}
TextNode() : color(0), pos_x(0), pos_y(0), character_count(0), scroll_slowness(1), characterSize({7,5}), is_deleted(true), is_scrolling() {}
};
#endif // STRUCTS_H