Mercurial > love-experiments
comparison src/modules/timer/sdl/Timer.cpp @ 1418:357697c2e2a8
More internal code cleanup
| author | Alex Szpakowski <slime73@gmail.com> |
|---|---|
| date | Sun, 31 Mar 2013 19:02:27 -0300 |
| parents | db0719826fa5 |
| children |
comparison
equal
deleted
inserted
replaced
| 1417:c70c9e4d10f3 | 1418:357697c2e2a8 |
|---|---|
| 36 { | 36 { |
| 37 namespace sdl | 37 namespace sdl |
| 38 { | 38 { |
| 39 | 39 |
| 40 Timer::Timer() | 40 Timer::Timer() |
| 41 : currTime(getMicroTime()) | 41 : currTime(0) |
| 42 , prevFpsUpdate(currTime) | 42 , prevFpsUpdate(0) |
| 43 , fps(0) | 43 , fps(0) |
| 44 , averageDelta(0) | 44 , averageDelta(0) |
| 45 , fpsUpdateFrequency(1) | 45 , fpsUpdateFrequency(1) |
| 46 , frames(0) | 46 , frames(0) |
| 47 , dt(0) | 47 , dt(0) |
| 48 { | 48 { |
| 49 // Init the SDL timer system. | 49 // Init the SDL timer system. |
| 50 if (SDL_InitSubSystem(SDL_INIT_TIMER) < 0) | 50 if (SDL_InitSubSystem(SDL_INIT_TIMER) < 0) |
| 51 throw Exception(SDL_GetError()); | 51 throw Exception(SDL_GetError()); |
| 52 | |
| 53 prevFpsUpdate = currTime = getMicroTime(); | |
| 52 } | 54 } |
| 53 | 55 |
| 54 Timer::~Timer() | 56 Timer::~Timer() |
| 55 { | 57 { |
| 56 // Quit SDL timer. | 58 // Quit SDL timer. |
