aboutsummaryrefslogtreecommitdiff
path: root/src/Text.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text.cpp')
-rw-r--r--src/Text.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/Text.cpp b/src/Text.cpp
index 2292a4e..025cb92 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -31,6 +31,7 @@ namespace dchat
dirtyCaret(false),
plainText(false),
editable(false),
+ visible(true),
caretMoveDirection(CaretMoveDirection::NONE),
caretIndex(0)
{
@@ -49,6 +50,7 @@ namespace dchat
dirtyCaret(false),
plainText(_plainText),
editable(false),
+ visible(true),
caretMoveDirection(CaretMoveDirection::NONE),
lineSpacing(0.0f),
caretIndex(0)
@@ -906,21 +908,24 @@ namespace dchat
//sf::FloatRect textRect(pos.x, pos.y, maxWidth, )
//colRect.contains()
//if(pos.x + maxWidth <= 0.0f || pos.x >= maxWidth || pos.y + totalHeight <= 0.0f || pos.y >= target.getSize().y) return;
- if(pos.y + getHeight() <= 0.0f || pos.y >= target.getSize().y) return false;
- /*
- if(editable)
+ if(pos.y + getHeight() <= 0.0f || pos.y >= target.getSize().y)
{
- sf::RectangleShape editBox(sf::Vector2f(std::max(maxWidth, boundingBox.width), boundingBox.height));
- editBox.setPosition(pos.x, pos.y - floor(vspace));
- editBox.setFillColor(ColorScheme::getBackgroundColor() + sf::Color(10, 10, 10));
- target.draw(editBox);
+ if(!editable && visible && lastSeenTimer.getElapsedTime().asMilliseconds() > 3000)
+ {
+ visible = false;
+ vertices.resize(0);
+ }
+ return false;
}
- */
+ if(!visible)
+ updateGeometry();
states.transform.translate(pos);
states.texture = &font->getTexture(characterSize);
target.draw(vertices, states);
+ lastSeenTimer.restart();
+ visible = true;
pos.y -= floor(vspace);
for(TextElement &textElement : textElements)