本文整理汇总了Java中org.andengine.engine.options.WakeLockOptions类的典型用法代码示例。如果您正苦于以下问题:Java WakeLockOptions类的具体用法?Java WakeLockOptions怎么用?Java WakeLockOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WakeLockOptions类属于org.andengine.engine.options包,在下文中一共展示了WakeLockOptions类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: acquireWakeLock
import org.andengine.engine.options.WakeLockOptions; //导入依赖的package包/类
private void acquireWakeLock(final WakeLockOptions pWakeLockOptions) {
if (pWakeLockOptions == WakeLockOptions.SCREEN_ON) {
ActivityUtils.keepScreenOn(this);
} else {
final PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
this.mWakeLock = pm.newWakeLock(pWakeLockOptions.getFlag() | PowerManager.ON_AFTER_RELEASE, Constants.DEBUGTAG);
try {
this.mWakeLock.acquire();
} catch (final SecurityException pSecurityException) {
Debug.e("You have to add\n\t<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>\nto your AndroidManifest.xml !", pSecurityException);
}
}
}
示例2: acquireWakeLock
import org.andengine.engine.options.WakeLockOptions; //导入依赖的package包/类
private void acquireWakeLock(final WakeLockOptions pWakeLockOptions) {
if(pWakeLockOptions == WakeLockOptions.SCREEN_ON) {
ActivityUtils.keepScreenOn(this);
} else {
final PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
this.mWakeLock = pm.newWakeLock(pWakeLockOptions.getFlag() | PowerManager.ON_AFTER_RELEASE, Constants.DEBUGTAG);
try {
this.mWakeLock.acquire();
} catch (final SecurityException pSecurityException) {
Debug.e("You have to add\n\t<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>\nto your AndroidManifest.xml !", pSecurityException);
}
}
}
示例3: onCreateEngineOptions
import org.andengine.engine.options.WakeLockOptions; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions() {
camera = new Camera(0, 0, Consts.SCREEN_HEIGHT, Consts.SCREEN_WIDTH);
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED,
new RatioResolutionPolicy(Consts.SCREEN_HEIGHT, Consts.SCREEN_WIDTH), this.camera);
engineOptions.getAudioOptions().setNeedsMusic(true).setNeedsSound(true);
engineOptions.setWakeLockOptions(WakeLockOptions.SCREEN_ON);
return engineOptions;
}
示例4: onCreateEngineOptions
import org.andengine.engine.options.WakeLockOptions; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions() {
prefs = PreferenceManager.getDefaultSharedPreferences(this);
camera = new FollowCamera(0, 0, Constants.CW, Constants.CH);
IResolutionPolicy resolutionPolicy = new FillResolutionPolicy();
EngineOptions engineOptions = new EngineOptions(true,
ScreenOrientation.PORTRAIT_FIXED, resolutionPolicy, camera);
engineOptions.getAudioOptions().setNeedsMusic(true).setNeedsSound(true);
engineOptions.setWakeLockOptions(WakeLockOptions.SCREEN_ON);
return engineOptions;
}
示例5: onCreateEngineOptions
import org.andengine.engine.options.WakeLockOptions; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions() {
// Camera
mCamera = new Camera(0, 0, WIDTH, HEIGHT);
// Engine options
EngineOptions engineOptions = new EngineOptions(true,
ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(RATIO), mCamera);
// Screen always turned on
engineOptions.setWakeLockOptions(WakeLockOptions.SCREEN_ON);
// Music
engineOptions.getAudioOptions().setNeedsMusic(true);
// Sound
engineOptions.getAudioOptions().setNeedsSound(true);
// Controls
if (android.os.Build.MANUFACTURER.equals("OUYA")){ //... Device is an OUYA...
NinjaTrials.OUYA_CONTROL = true;
OuyaController.init(this); // Necessary to listen for Ouya Controller's analogic events
}
else{ //... Device is something else...
NinjaTrials.OUYA_CONTROL = false;
}
// Return the engineOptions object, passing it to the engine
return engineOptions;
}
示例6: onCreateEngineOptions
import org.andengine.engine.options.WakeLockOptions; //导入依赖的package包/类
public EngineOptions onCreateEngineOptions()
{
camara = new Camera(0, 0, 480,800);// Pantalla fullHD? Mala suerte...
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new RatioResolutionPolicy(480,800), this.camara);
// la RatioResolutionPolicy se encarga de añadir márgenes si fuese necesario para que la escena mantenga las proporciones.
//necesitamos sonido, internamente inicializa el player
engineOptions.getAudioOptions().setNeedsMusic(true).setNeedsSound(true);
engineOptions.setWakeLockOptions(WakeLockOptions.SCREEN_ON); // que no se apaque la pantalla cuando estamos jugando.
return engineOptions;
}
示例7: onCreateEngineOptions
import org.andengine.engine.options.WakeLockOptions; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions()
{
camera = new BoundCamera(0, 0, 800, 480);
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(), camera);
engineOptions.getAudioOptions().setNeedsMusic(true).setNeedsSound(true);
engineOptions.setWakeLockOptions(WakeLockOptions.SCREEN_ON);
return engineOptions;
}