deleting works
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user