mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
organizing stuff.
This commit is contained in:
parent
3b0bff2f74
commit
3f5bad938a
23 changed files with 805 additions and 374 deletions
|
@ -24,11 +24,48 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#ifndef PORTING_HEADER
|
||||
#define PORTING_HEADER
|
||||
|
||||
// Included for u64 and such
|
||||
#include "common_irrlicht.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SWPRINTF_CHARSTRING L"%S"
|
||||
#else
|
||||
#define SWPRINTF_CHARSTRING L"%s"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#define sleep_ms(x) Sleep(x)
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#define sleep_ms(x) usleep(x*1000)
|
||||
#endif
|
||||
|
||||
namespace porting
|
||||
{
|
||||
|
||||
/*
|
||||
Resolution is 10-20ms.
|
||||
Remember to check for overflows.
|
||||
Overflow can occur at any value higher than 10000000.
|
||||
*/
|
||||
#ifdef _WIN32 // Windows
|
||||
#include <windows.h>
|
||||
inline u32 getTimeMs()
|
||||
{
|
||||
return GetTickCount();
|
||||
}
|
||||
#else // Posix
|
||||
#include <sys/timeb.h>
|
||||
inline u32 getTimeMs()
|
||||
{
|
||||
struct timeb tb;
|
||||
ftime(&tb);
|
||||
return tb.time * 1000 + tb.millitm;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace porting
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue