本文整理汇总了Java中org.andengine.engine.options.ScreenOrientation.PORTRAIT_FIXED属性的典型用法代码示例。如果您正苦于以下问题:Java ScreenOrientation.PORTRAIT_FIXED属性的具体用法?Java ScreenOrientation.PORTRAIT_FIXED怎么用?Java ScreenOrientation.PORTRAIT_FIXED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.andengine.engine.options.ScreenOrientation
的用法示例。
在下文中一共展示了ScreenOrientation.PORTRAIT_FIXED属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateEngineOptions
@Override
public EngineOptions onCreateEngineOptions() {
final DisplayMetrics displayMetrics = new DisplayMetrics();
WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
wm.getDefaultDisplay().getMetrics(displayMetrics);
wm.getDefaultDisplay().getRotation();
//画面のサイズから縦横を取得する
CAMERA_WIDTH = displayMetrics.widthPixels;
CAMERA_HEIGHT = displayMetrics.heightPixels;
this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
return new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED,
new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT),
this.mCamera);
}
示例2: onCreateEngineOptions
@Override
public EngineOptions onCreateEngineOptions() {
Camera camera = new Camera(0,0,WORLD_WIDTH,WORLD_HEIGHT);
EngineOptions engineOptions = new EngineOptions(true,ScreenOrientation.PORTRAIT_FIXED,new RatioResolutionPolicy(WORLD_WIDTH, WORLD_HEIGHT),camera);
//engineOptions.getRenderOptions().setDithering(true);
engineOptions.getAudioOptions().setNeedsMusic(true);
engineOptions.getAudioOptions().setNeedsSound(true);
return engineOptions;
}
示例3: onCreateEngineOptions
@Override
public EngineOptions onCreateEngineOptions() {
Point size = new Point();
if (Build.VERSION.SDK_INT >= 17) {
getWindowManager().getDefaultDisplay().getRealSize(size);
} else {
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
size.x = displayMetrics.widthPixels;
size.y = displayMetrics.heightPixels;
}
float desiredRatio = (float) (1080.0 / 1920.0);
final float realRatio = size.x / size.y;
int measuredWidth;
int measuredHeight;
if (realRatio < desiredRatio) {
measuredWidth = size.x;
measuredHeight = Math.round(measuredWidth / desiredRatio);
} else {
measuredHeight = size.y;
measuredWidth = Math.round(measuredHeight * desiredRatio);
}
_scale = measuredWidth / 1080.0f;
_cameraWidth = measuredWidth;
_cameraHeight = measuredHeight;
return new EngineOptions(
true,
ScreenOrientation.PORTRAIT_FIXED,
new RatioResolutionPolicy(1080, 1920),
new Camera(0, 0, _cameraWidth, _cameraHeight));
}
示例4: onCreateEngineOptions
@Override
public EngineOptions onCreateEngineOptions() {
this.camera = new Camera(0, 0, Constants.width, Constants.height);
SQLiteDatabaseAdapter.setContext(this);
final EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new RatioResolutionPolicy(Constants.width, Constants.height), this.camera);
engineOptions.getAudioOptions().setNeedsMusic(true).setNeedsSound(true);
return engineOptions;
}
示例5: onCreateEngineOptions
@Override
public EngineOptions onCreateEngineOptions() {
camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED,
new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
engineOptions.getAudioOptions().setNeedsMusic(true);
return engineOptions;
}
示例6: onCreateEngineOptions
@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;
}
示例7: onCreateEngineOptions
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;
}
示例8: onCreateEngineOptions
@Override
public EngineOptions onCreateEngineOptions() {
CAMERA_WIDTH = getScreenWidth(this, CAMERA_HEIGHT);
mRightOffset = (CAMERA_WIDTH * GameScene.RACE_TRACK_WIDTH) / 2f + 20f;
mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT) {
float offsetY = 0;
float lastPositionY = 0;
@Override
public void onUpdate(float pSecondsElapsed) {
final float speed = getSpeed();
switch (mCurrentGameState) {
case GAME_STATE_DEFAULT:
mCameraYPosition -= speed;
scrollBackground(lastPositionY, offsetY);
autoPlay(speed);
break;
case GAME_STATE_RUNNING:
mCameraYPosition -= speed;
scrollBackground(lastPositionY, offsetY);
play(speed);
break;
case GAME_STATE_DYING:
break;
case GAME_STATE_PAUSED:
break;
case GAME_STATE_LOADING:
startGame(true);
break;
case GAME_STATE_WAITING:
break;
default:
break;
}
super.onUpdate(pSecondsElapsed);
}
};
EngineOptions mEngineOptions = new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera);
mEngineOptions.getAudioOptions().setNeedsMusic(true);
mEngineOptions.getAudioOptions().setNeedsSound(true);
return mEngineOptions;
}
示例9: onCreateEngineOptions
@Override
public EngineOptions onCreateEngineOptions() {
mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
return new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera);
}