From 746687800ff205b22316157c86c8b816307d3aa7 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 20 May 2018 23:53:36 +0200 Subject: 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 --- include/Text.hpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') 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 #include #include +#include #include 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; }; } -- cgit v1.2.3