aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 4440315..cf916e2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -117,11 +117,11 @@ int main(int argc, char **argv)
boost::filesystem::current_path(parentPath); // Ensures loading of resources works no matter which path we run this executable from
*/
- const int FRAMERATE_FOCUSED = 200;
- const int FRAMERATE_NOT_FOCUSED = 30;
+ const sf::Int64 FRAMERATE_FOCUSED = 144;
+ const sf::Int64 FRAMERATE_NOT_FOCUSED = 10;
XInitThreads();
- sf::RenderWindow window(sf::VideoMode(1920, 1080), "dchat");
+ sf::RenderWindow window(sf::VideoMode(1280, 768), "dchat");
window.setVerticalSyncEnabled(false);
window.setFramerateLimit(FRAMERATE_FOCUSED);
@@ -659,8 +659,12 @@ int main(int argc, char **argv)
Channel::getCurrent()->addLocalMessage(msg, Channel::getCurrent()->getSystemUser());
});
+ sf::Clock lastFocusedTimer;
+ sf::Clock frameTimer;
+
while (window.isOpen())
{
+ frameTimer.restart();
Channel *currentChannel = Channel::getCurrent();
sf::Event event;
@@ -702,8 +706,16 @@ int main(int argc, char **argv)
GlobalContextMenu::processEvent(event);
currentChannel->processEvent(event, cache);
}
+
+ lastFocusedTimer.restart();
}
+ if(lastFocusedTimer.getElapsedTime().asMilliseconds() > 3000)
+ {
+ this_thread::sleep_for(chrono::seconds(1));
+ continue;
+ }
+
window.clear(ColorScheme::getBackgroundColor());
ChannelSidePanel::draw(window);
currentChannel->draw(window, cache);