mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add framerate control
This commit is contained in:
parent
a2f011fc96
commit
c0ba5be458
4 changed files with 20 additions and 6 deletions
|
|
@ -325,7 +325,6 @@ bool Window::isFullscreen() {
|
|||
void Window::swapBuffers() {
|
||||
double currentTime = time();
|
||||
if (framerate > 0 && currentTime - prevSwap < (1.0 / framerate)) {
|
||||
std::cout << static_cast<int>((1.0/framerate - (currentTime-prevSwap))*1000) << std::endl;
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(
|
||||
static_cast<int>((1.0/framerate - (currentTime-prevSwap))*1000)));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue