*******************************************************************************/
#include <cstdlib> // exit
*******************************************************************************/
#include <cstdlib> // exit
- EngineImpl(int argc, char* argv[], const std::string& configFile,
+ Impl(int argc, char* argv[], const std::string& configFile,
- if (SDL_Init(SDL_INIT_EVERYTHING | SDL_INIT_EVENTTHREAD) != 0)
+#if defined(_WIN32) || defined (_WIN64) || defined(__WIN32__)
+ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0)
+#else
+ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTTHREAD) != 0)
+#endif
* The main loop. This just calls dispatchEvents(), update(), and draw()
* over and over again. The timing of the update and draw are decoupled.
* The actual frame rate is also calculated here. This function will return
* The main loop. This just calls dispatchEvents(), update(), and draw()
* over and over again. The timing of the update and draw are decoupled.
* The actual frame rate is also calculated here. This function will return
deltaTime = newTicks - ticksNow;
ticksNow = newTicks;
if (deltaTime >= 0.25) deltaTime = 0.25;
accumulator += deltaTime;
deltaTime = newTicks - ticksNow;
ticksNow = newTicks;
if (deltaTime >= 0.25) deltaTime = 0.25;
accumulator += deltaTime;
- sleep(std::min(nextStep, nextDraw), true);
+ Timer::sleep(std::min(std::min(nextStep, nextDraw),
+ Timer::getNextFire()), true);
Engine::Engine(int argc, char* argv[], const std::string& configFile,
const std::string& name, const std::string& iconFile) :
Engine::Engine(int argc, char* argv[], const std::string& configFile,
const std::string& name, const std::string& iconFile) :
- impl_(new Engine::EngineImpl(argc, argv, configFile, name, iconFile, this))
-{}
+ impl_(new Engine::Impl(argc, argv, configFile, name, iconFile, this)) {}