Browse Source

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.

Alex Szpakowski 9 years ago
parent
commit
36cc48d306

+ 7 - 0
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;

+ 1 - 1
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

+ 0 - 10
src/modules/timer/sdl/Timer.cpp

@@ -20,10 +20,6 @@
 
 // LOVE
 #include "Timer.h"
-#include "common/delay.h"
-
-// SDL
-#include <SDL.h>
 
 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

+ 0 - 3
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