本文整理汇总了Java中org.andengine.engine.options.ScreenOrientation类的典型用法代码示例。如果您正苦于以下问题:Java ScreenOrientation类的具体用法?Java ScreenOrientation怎么用?Java ScreenOrientation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScreenOrientation类属于org.andengine.engine.options包,在下文中一共展示了ScreenOrientation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateEngineOptions
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
@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
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions() {
// サイズを指定し描画範囲をインスタンス化
final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
// ゲームのエンジンを初期化
EngineOptions eo = new EngineOptions(
// タイトルバー非表示モード
true,
// 画面横向き
ScreenOrientation.LANDSCAPE_FIXED,
// 画面解像度の縦横比を保ったまま最大まで拡大
new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT),
// 描画範囲
camera);
// 効果音とBGMの使用を許可する
eo.getAudioOptions().setNeedsSound(true);
eo.getAudioOptions().setNeedsMusic(true);
return eo;
}
示例3: onCreateEngineOptions
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions() {
Log.d("debug", "masuk activity PlayScene");
activity = MainGameActivity.getSharedInstance();
//get the sensor service
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
//get the accelerometer sensor
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
// mAcceleration = mSensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION);
EngineOptions engineOptions = new EngineOptions(true,
ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(), activity.mCamera);
final ConfigChooserOptions configChooserOptions = engineOptions.getRenderOptions().getConfigChooserOptions();
configChooserOptions.setRequestedRedSize(8);
configChooserOptions.setRequestedGreenSize(8);
configChooserOptions.setRequestedBlueSize(8);
configChooserOptions.setRequestedAlphaSize(8);
configChooserOptions.setRequestedDepthSize(16);
return engineOptions;
}
示例4: onCreateEngineOptions
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions() {
setVolumeControlStream(AudioManager.STREAM_MUSIC);
Intent intent = getIntent();
mPlayer1 = intent.getParcelableExtra(EXTRA_PLAYER_1);
mPlayer2 = intent.getParcelableExtra(EXTRA_PLAYER_2);
mMatch = new Match(mPlayer1, mPlayer2, 0, 0);
GameScene.setMatch(mMatch);
mIsTournamentMatch = intent.getBooleanExtra(EXTRA_IS_TOURNAMENT_MATCH, false);
mSelfIsHome = intent.getBooleanExtra(EXTRA_SELF_IS_HOME, true);
mApp = MyApp.getInstance();
mVolumeMode = mApp.getVolumeMode();
mCamera = new BoundCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera);
engineOptions.getRenderOptions().setDithering(true); // enable dithering for this engine
engineOptions.getAudioOptions().setNeedsMusic(true).setNeedsSound(true); // enable sound and music
engineOptions.getTouchOptions().setNeedsMultiTouch(true); // enable multi-touch for left/right and up button
return engineOptions;
}
示例5: onCreateEngineOptions
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions() {
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR,
new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), main_camera);
engineOptions.getAudioOptions().setNeedsSound(true);
engineOptions.getAudioOptions().setNeedsMusic(true);
return engineOptions;
}
示例6: onCreateEngineOptions
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions() {
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED,
new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), main_camera);
engineOptions.getAudioOptions().setNeedsSound(true);
return engineOptions;
}
示例7: onCreateEngineOptions
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
@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;
}
示例8: applyEngineOptions
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
private void applyEngineOptions() {
final EngineOptions engineOptions = this.mEngine.getEngineOptions();
if (engineOptions.isFullscreen()) {
ActivityUtils.requestFullscreen(this);
}
if (engineOptions.getAudioOptions().needsMusic() || engineOptions.getAudioOptions().needsSound()) {
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
switch (engineOptions.getScreenOrientation()) {
case LANDSCAPE_FIXED:
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
break;
case LANDSCAPE_SENSOR:
if (SystemUtils.SDK_VERSION_GINGERBREAD_OR_LATER) {
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
} else {
Debug.w(ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.LANDSCAPE_SENSOR + " is not supported on this device. Falling back to " + ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.LANDSCAPE_FIXED);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
break;
case PORTRAIT_FIXED:
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
break;
case PORTRAIT_SENSOR:
if (SystemUtils.SDK_VERSION_GINGERBREAD_OR_LATER) {
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
} else {
Debug.w(ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.PORTRAIT_SENSOR + " is not supported on this device. Falling back to " + ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.PORTRAIT_FIXED);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
break;
}
}
示例9: onCreateEngineOptions
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions() {
Logger.log(TAG, "onCreateEngineOptions");
Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR,
new FillResolutionPolicy(), camera);
engineOptions.getAudioOptions().setNeedsSound(true);
return engineOptions;
}
示例10: onCreateEngineOptions
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions() {
Logger.log(TAG, "onCreateEngineOptions");
Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR,
new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
engineOptions.getAudioOptions().setNeedsSound(true);
return engineOptions;
}
示例11: onCreateEngineOptions
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions() {
// initialize camera
final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
// create engine options
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
// enable sound and music
engineOptions.getAudioOptions().setNeedsSound(true).setNeedsMusic(true);
return engineOptions;
}
示例12: applyEngineOptions
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
private void applyEngineOptions() {
final EngineOptions engineOptions = this.mEngine.getEngineOptions();
if(engineOptions.isFullscreen()) {
ActivityUtils.requestFullscreen(this);
}
if(engineOptions.getAudioOptions().needsMusic() || engineOptions.getAudioOptions().needsSound()) {
this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
switch(engineOptions.getScreenOrientation()) {
case LANDSCAPE_FIXED:
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
break;
case LANDSCAPE_SENSOR:
if(SystemUtils.SDK_VERSION_GINGERBREAD_OR_LATER) {
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
} else {
Debug.w(ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.LANDSCAPE_SENSOR + " is not supported on this device. Falling back to " + ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.LANDSCAPE_FIXED);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
break;
case PORTRAIT_FIXED:
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
break;
case PORTRAIT_SENSOR:
if(SystemUtils.SDK_VERSION_GINGERBREAD_OR_LATER) {
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
} else {
Debug.w(ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.PORTRAIT_SENSOR + " is not supported on this device. Falling back to " + ScreenOrientation.class.getSimpleName() + "." + ScreenOrientation.PORTRAIT_FIXED);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
break;
}
}
示例13: onCreateEngineOptions
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
@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));
}
示例14: onCreateEngineOptions
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions() {
Log.d("RS", "onCreateEngineOptions");
this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera);
engineOptions.getTouchOptions().setNeedsMultiTouch(true);
return engineOptions;
}
示例15: onCreateEngineOptions
import org.andengine.engine.options.ScreenOrientation; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions() {
Log.d("RS", "[MENU] onCreateEngineOptions");
Camera mCamera = new Camera(0, 0, ParentGameActivity.CAMERA_WIDTH, ParentGameActivity.CAMERA_HEIGHT);
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED,
new RatioResolutionPolicy(ParentGameActivity.CAMERA_WIDTH, ParentGameActivity.CAMERA_HEIGHT), mCamera);
//engineOptions.getTouchOptions().setNeedsMultiTouch(true);
return engineOptions;
}