Add yield and sleep for the Android device.
git-svn-id: http://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4658 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
80724c4f80
commit
72e924bf0c
|
@ -138,6 +138,7 @@ int run ( IrrlichtDevice *device )
|
|||
stat->setText ( str.c_str() );
|
||||
}
|
||||
}
|
||||
device->yield(); // probably nicer to the battery
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -121,10 +121,25 @@ bool CIrrDeviceAndroid::run()
|
|||
|
||||
void CIrrDeviceAndroid::yield()
|
||||
{
|
||||
struct timespec ts = {0,1};
|
||||
nanosleep(&ts, NULL);
|
||||
}
|
||||
|
||||
void CIrrDeviceAndroid::sleep(u32 timeMs, bool pauseTimer)
|
||||
{
|
||||
const bool wasStopped = Timer ? Timer->isStopped() : true;
|
||||
|
||||
struct timespec ts;
|
||||
ts.tv_sec = (time_t) (timeMs / 1000);
|
||||
ts.tv_nsec = (long) (timeMs % 1000) * 1000000;
|
||||
|
||||
if (pauseTimer && !wasStopped)
|
||||
Timer->stop();
|
||||
|
||||
nanosleep(&ts, NULL);
|
||||
|
||||
if (pauseTimer && !wasStopped)
|
||||
Timer->start();
|
||||
}
|
||||
|
||||
void CIrrDeviceAndroid::setWindowCaption(const wchar_t* text)
|
||||
|
|
Loading…
Reference in New Issue