aboutsummaryrefslogtreecommitdiff
path: root/src/Vsync.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-09-14 15:46:35 +0200
committerdec05eba <dec05eba@protonmail.com>2020-09-14 15:46:35 +0200
commit497a8e9971d935be4c3d75cbebf862b645bc02a5 (patch)
tree310ce1e2d3bebce94317253a93e6374acf7b39d1 /src/Vsync.cpp
parent46c0e4438c7092a5f45468475f0dffcc3dad041c (diff)
Try vsync, fallback to fps limit if vsync fails
Diffstat (limited to 'src/Vsync.cpp')
-rw-r--r--src/Vsync.cpp20
1 files changed, 0 insertions, 20 deletions
diff --git a/src/Vsync.cpp b/src/Vsync.cpp
deleted file mode 100644
index d46f9fa..0000000
--- a/src/Vsync.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "../include/Vsync.hpp"
-#include <time.h>
-#include <unistd.h>
-
-namespace QuickMedia {
- VSync::VSync(int framerate) : target_frame_delta_micro(1000.0 / (double)framerate * 1000.0), overflow(0) {
-
- }
-
- void VSync::display(sf::RenderWindow &window) {
- window.display();
- sf::Int64 sleep_time_micro = target_frame_delta_micro - timer.getElapsedTime().asMicroseconds();
- if(sleep_time_micro > 0) {
- if(usleep(sleep_time_micro) != 0) {
- fprintf(stderr, "failed to sleep!\n");
- }
- }
- timer.restart();
- }
-} \ No newline at end of file