diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-05-20 23:53:36 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-05-20 23:55:38 +0200 |
commit | 746687800ff205b22316157c86c8b816307d3aa7 (patch) | |
tree | 2d4893048d1908b4372270b3b2b54efb10dfdb8c /include | |
parent | 0fb56002dd2f02ad9d10b1017a221936a194992c (diff) |
Improve performance and cpu usage
Remove Text vertices if text has not been visible on the freen for a
while.
Stop rendering when window has lost focus for awhile, reducing cpu usage
to 0
Diffstat (limited to 'include')
-rw-r--r-- | include/Text.hpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/Text.hpp b/include/Text.hpp index 925dc94..286a0b1 100644 --- a/include/Text.hpp +++ b/include/Text.hpp @@ -7,6 +7,7 @@ #include <SFML/Graphics/RenderTarget.hpp> #include <SFML/Window/Event.hpp> #include <SFML/System/String.hpp> +#include <SFML/System/Clock.hpp> #include <vector> namespace dchat @@ -98,6 +99,7 @@ namespace dchat bool dirtyCaret; bool plainText; bool editable; + bool visible; CaretMoveDirection caretMoveDirection; sf::FloatRect boundingBox; float lineSpacing; @@ -105,5 +107,6 @@ namespace dchat int caretIndex; sf::Vector2f caretPosition; + sf::Clock lastSeenTimer; }; } |