diff options
author | sapier <Sapier at GMX dot net> | 2014-04-21 14:10:59 +0200 |
---|---|---|
committer | sapier <Sapier at GMX dot net> | 2014-06-29 18:17:56 +0200 |
commit | 1cc40c0a7c260f0562572bc99f39a666a12f1b09 (patch) | |
tree | c5af6b9787f4c69faa634e82f6484ca4540a7f88 /src/porting.h | |
parent | ff36071d93266c1dd18708f8924d80aa1af5b33e (diff) | |
download | minetest-1cc40c0a7c260f0562572bc99f39a666a12f1b09.tar.gz minetest-1cc40c0a7c260f0562572bc99f39a666a12f1b09.tar.bz2 minetest-1cc40c0a7c260f0562572bc99f39a666a12f1b09.zip |
Add support for Android 2.3+
There have been plenty of ppl involved in creating this version.
I don't wanna mention names as I'm sure I'd forget someone so I
just tell where help has been done:
- The partial android versions done by various ppl
- Testing on different android devices
- reviewing code (especially the in core changes)
- testing controls
- reviewing texts
A big thank you to everyone helping this to be completed!
Diffstat (limited to 'src/porting.h')
-rw-r--r-- | src/porting.h | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/porting.h b/src/porting.h index b5a5d00f2..9be09da75 100644 --- a/src/porting.h +++ b/src/porting.h @@ -53,12 +53,12 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifdef _WIN32 #include <windows.h> - + #define sleep_ms(x) Sleep(x) #else #include <unistd.h> #include <stdint.h> //for uintptr_t - + #if (defined(linux) || defined(__linux)) && !defined(_GNU_SOURCE) #define _GNU_SOURCE #endif @@ -79,7 +79,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #endif #define sleep_ms(x) usleep(x*1000) - + #define THREAD_PRIORITY_LOWEST 0 #define THREAD_PRIORITY_BELOW_NORMAL 1 #define THREAD_PRIORITY_NORMAL 2 @@ -197,17 +197,17 @@ void initIrrlicht(irr::IrrlichtDevice * ); #define _WIN32_WINNT 0x0501 #endif #include <windows.h> - + inline u32 getTimeS() { return GetTickCount() / 1000; } - + inline u32 getTimeMs() { return GetTickCount(); } - + inline u32 getTimeUs() { LARGE_INTEGER freq, t; @@ -215,7 +215,7 @@ void initIrrlicht(irr::IrrlichtDevice * ); QueryPerformanceCounter(&t); return (double)(t.QuadPart) / ((double)(freq.QuadPart) / 1000000.0); } - + inline u32 getTimeNs() { LARGE_INTEGER freq, t; @@ -223,7 +223,7 @@ void initIrrlicht(irr::IrrlichtDevice * ); QueryPerformanceCounter(&t); return (double)(t.QuadPart) / ((double)(freq.QuadPart) / 1000000000.0); } - + #else // Posix #include <sys/time.h> #include <time.h> @@ -238,21 +238,21 @@ void initIrrlicht(irr::IrrlichtDevice * ); gettimeofday(&tv, NULL); return tv.tv_sec; } - + inline u32 getTimeMs() { struct timeval tv; gettimeofday(&tv, NULL); return tv.tv_sec * 1000 + tv.tv_usec / 1000; } - + inline u32 getTimeUs() { struct timeval tv; gettimeofday(&tv, NULL); return tv.tv_sec * 1000000 + tv.tv_usec; } - + inline u32 getTimeNs() { struct timespec ts; @@ -270,7 +270,7 @@ void initIrrlicht(irr::IrrlichtDevice * ); #endif return ts.tv_sec * 1000000000 + ts.tv_nsec; } - + /*#include <sys/timeb.h> inline u32 getTimeMs() { @@ -373,5 +373,9 @@ v2u32 getWindowSize(); } // namespace porting +#ifdef __ANDROID__ +#include "porting_android.h" +#endif + #endif // PORTING_HEADER |