2013-02-16 19:36:21 +08:00
|
|
|
#include "platform/CCDevice.h"
|
|
|
|
#include "jni/DPIJni.h"
|
2013-09-12 17:31:37 +08:00
|
|
|
#include "nativeactivity.h"
|
2013-02-16 19:36:21 +08:00
|
|
|
|
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2013-06-20 14:13:12 +08:00
|
|
|
int Device::getDPI()
|
2013-02-16 19:36:21 +08:00
|
|
|
{
|
2013-02-17 17:13:06 +08:00
|
|
|
static int dpi = -1;
|
|
|
|
if (dpi == -1)
|
|
|
|
{
|
|
|
|
dpi = (int)getDPIJNI();
|
|
|
|
}
|
|
|
|
return dpi;
|
2013-02-16 19:36:21 +08:00
|
|
|
}
|
|
|
|
|
2013-09-12 17:31:37 +08:00
|
|
|
void Device::setAccelerometerEnabled(bool isEnabled)
|
|
|
|
{
|
|
|
|
if (isEnabled)
|
|
|
|
{
|
2013-11-29 19:34:36 +08:00
|
|
|
enableAccelerometerJni();
|
2013-09-12 17:31:37 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-11-29 19:34:36 +08:00
|
|
|
disableAccelerometerJni();
|
2013-09-12 17:31:37 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Device::setAccelerometerInterval(float interval)
|
|
|
|
{
|
2013-11-29 19:34:36 +08:00
|
|
|
setAccelerometerIntervalJni(interval);
|
2013-09-12 17:31:37 +08:00
|
|
|
}
|
|
|
|
|
2013-02-16 19:36:21 +08:00
|
|
|
NS_CC_END
|