From 36cc48d306afe8f97bbfaa05d01699e88c489904 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Fri, 18 Mar 2016 23:01:49 -0300 Subject: [PATCH] Move the Timer::sleep implementation up from timer/sdl/Timer.cpp to timer/Timer.cpp, since it doesn't directly use any SDL-specific code. --- src/modules/timer/Timer.cpp | 7 +++++++ src/modules/timer/Timer.h | 2 +- src/modules/timer/sdl/Timer.cpp | 10 ---------- src/modules/timer/sdl/Timer.h | 3 --- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/modules/timer/Timer.cpp b/src/modules/timer/Timer.cpp index c9737842d..ce5cc7307 100644 --- a/src/modules/timer/Timer.cpp +++ b/src/modules/timer/Timer.cpp @@ -21,6 +21,7 @@ // LOVE #include "common/config.h" #include "common/int.h" +#include "common/delay.h" #include "Timer.h" #if defined(LOVE_WINDOWS) @@ -85,6 +86,12 @@ void Timer::step() } } +void Timer::sleep(double seconds) const +{ + if (seconds > 0) + love::sleep((unsigned int)(seconds*1000)); +} + double Timer::getDelta() const { return dt; diff --git a/src/modules/timer/Timer.h b/src/modules/timer/Timer.h index 53d94e843..760b9d8c1 100644 --- a/src/modules/timer/Timer.h +++ b/src/modules/timer/Timer.h @@ -50,7 +50,7 @@ public: * usually 1ms. * @param seconds The number of seconds to sleep for. **/ - virtual void sleep(double seconds) const = 0; + virtual void sleep(double seconds) const; /** * Gets the time between the last two frames, assuming step is called diff --git a/src/modules/timer/sdl/Timer.cpp b/src/modules/timer/sdl/Timer.cpp index a4d778b37..7a6f9ff37 100644 --- a/src/modules/timer/sdl/Timer.cpp +++ b/src/modules/timer/sdl/Timer.cpp @@ -20,10 +20,6 @@ // LOVE #include "Timer.h" -#include "common/delay.h" - -// SDL -#include namespace love { @@ -47,12 +43,6 @@ const char *Timer::getName() const return "love.timer.sdl"; } -void Timer::sleep(double seconds) const -{ - if (seconds > 0) - love::sleep((unsigned int)(seconds*1000)); -} - } // sdl } // timer } // love diff --git a/src/modules/timer/sdl/Timer.h b/src/modules/timer/sdl/Timer.h index 95571d7c1..cd5e2ea10 100644 --- a/src/modules/timer/sdl/Timer.h +++ b/src/modules/timer/sdl/Timer.h @@ -37,11 +37,8 @@ public: Timer(); virtual ~Timer(); - const char *getName() const override; - void sleep(double seconds) const override; - }; // Timer } // sdl