Created
January 29, 2017 18:21
-
-
Save PoetaKodu/9aad3014430d683e6ce0a70be737bd3a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sf::Clock GameClock; | |
// Pierwszy pomiar zostanie zakonczony dopiero na koncu pierwszej klatki. | |
// Na początku zakładamy, że czas klatki to idealnie 1 / 60 sekundy (60 FPS) | |
float DeltaTime = 1 / 60.f; | |
while(...) | |
{ | |
float frameStartTime = GameClock.getElapsedTime().asSeconds(); | |
// Kod pętli głównej... | |
//float frameEndTime = GameClock.getElapsedTime().asSeconds(); | |
//DeltaTime = frameEndTime - frameStartTime; | |
// Powyższy zapis skraca się do: | |
DeltaTime = GameClock.getElapsedTime().asSeconds() - frameStartTime; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment