mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-06 17:41:04 +00:00
Clean up getTime helpers
This increases size of the getTime return values to 64 bits. It also removes the TimeGetter classes since the getTime functions are now very precise.
This commit is contained in:
parent
7f4cdbcbe9
commit
b662a4577d
22 changed files with 116 additions and 216 deletions
|
@ -24,42 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "client/inputhandler.h"
|
||||
#include "gameparams.h"
|
||||
|
||||
// A small helper class
|
||||
class TimeGetter
|
||||
{
|
||||
public:
|
||||
virtual u32 getTime(TimePrecision prec) = 0;
|
||||
};
|
||||
|
||||
// A precise irrlicht one
|
||||
class IrrlichtTimeGetter: public TimeGetter
|
||||
{
|
||||
public:
|
||||
IrrlichtTimeGetter(IrrlichtDevice *device):
|
||||
m_device(device)
|
||||
{}
|
||||
u32 getTime(TimePrecision prec)
|
||||
{
|
||||
if (prec == PRECISION_MILLI) {
|
||||
if (m_device == NULL)
|
||||
return 0;
|
||||
return m_device->getTimer()->getRealTime();
|
||||
} else {
|
||||
return porting::getTime(prec);
|
||||
}
|
||||
}
|
||||
private:
|
||||
IrrlichtDevice *m_device;
|
||||
};
|
||||
// Not so precise one which works without irrlicht
|
||||
class SimpleTimeGetter: public TimeGetter
|
||||
{
|
||||
public:
|
||||
u32 getTime(TimePrecision prec)
|
||||
{
|
||||
return porting::getTime(prec);
|
||||
}
|
||||
};
|
||||
|
||||
class ClientLauncher
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue