mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -37,11 +37,8 @@ public:
|
||||
|
||||
Timer();
|
||||
virtual ~Timer();
|
||||
|
||||
const char *getName() const override;
|
||||
|
||||
void sleep(double seconds) const override;
|
||||
|
||||
}; // Timer
|
||||
|
||||
} // sdl
|
||||
|
||||
Reference in New Issue
Block a user