summaryrefslogtreecommitdiff
path: root/src/timer.cpp
blob: c775a739f8fb553c197fe3be73558e0df2296c66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "timer.h"

Timer::Timer(): t0 {0} {}

void Timer::start(){
    t0 = SDL_GetTicks();
}
unsigned int Timer::elapsed(){
    return SDL_GetTicks() - t0;
}
void Timer::restart(){
    start();
}
void Timer::wait(unsigned int millis){
    SDL_Delay(millis);
}
void Timer::waitUntil(unsigned int millis){
    wait( millis - elapsed() );
}