当前位置: 首页>>代码示例>>Java>>正文


Java EngineOptions类代码示例

本文整理汇总了Java中org.andengine.engine.options.EngineOptions的典型用法代码示例。如果您正苦于以下问题:Java EngineOptions类的具体用法?Java EngineOptions怎么用?Java EngineOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EngineOptions类属于org.andengine.engine.options包,在下文中一共展示了EngineOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateEngineOptions

import org.andengine.engine.options.EngineOptions; //导入依赖的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);
}
 
开发者ID:yameguun,项目名称:livewallpaper_sample,代码行数:19,代码来源:LiveWallpaperService.java

示例2: onCreateEngineOptions

import org.andengine.engine.options.EngineOptions; //导入依赖的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;
}
 
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:22,代码来源:MainActivity.java

示例3: onCreateEngineOptions

import org.andengine.engine.options.EngineOptions; //导入依赖的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;
	}
 
开发者ID:erisazani,项目名称:MissionInsectible,代码行数:24,代码来源:PlayScene.java

示例4: onCreateEngineOptions

import org.andengine.engine.options.EngineOptions; //导入依赖的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;
}
 
开发者ID:delight-im,项目名称:NationSoccer,代码行数:22,代码来源:GameScreenSingle.java

示例5: onCreateEngineOptions

import org.andengine.engine.options.EngineOptions; //导入依赖的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;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:9,代码来源:GameActivity.java

示例6: onCreateEngineOptions

import org.andengine.engine.options.EngineOptions; //导入依赖的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;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:8,代码来源:TestActivity.java

示例7: onCreateEngineOptions

import org.andengine.engine.options.EngineOptions; //导入依赖的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;
}
 
开发者ID:viniciusDSL,项目名称:One-Cachito,代码行数:10,代码来源:GameActivity.java

示例8: applyEngineOptions

import org.andengine.engine.options.EngineOptions; //导入依赖的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;
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:37,代码来源:BaseGameActivity.java

示例9: onCreateEngineOptions

import org.andengine.engine.options.EngineOptions; //导入依赖的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;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:10,代码来源:AbstractGameActivity.java

示例10: onCreateEngineOptions

import org.andengine.engine.options.EngineOptions; //导入依赖的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;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:11,代码来源:GameActivity.java

示例11: onCreateEngineOptions

import org.andengine.engine.options.EngineOptions; //导入依赖的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;
}
 
开发者ID:tamzi,项目名称:sophia,代码行数:15,代码来源:TowerDefense.java

示例12: applyEngineOptions

import org.andengine.engine.options.EngineOptions; //导入依赖的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;
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:37,代码来源:BaseGameActivity.java

示例13: onCreateEngineOptions

import org.andengine.engine.options.EngineOptions; //导入依赖的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));
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:36,代码来源:FlipGameActivity.java

示例14: onCreateEngineOptions

import org.andengine.engine.options.EngineOptions; //导入依赖的package包/类
@Override
public EngineOptions onCreateEngineOptions() {
    gameCamera = new SmoothCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT, MAX_SPEED_X, MAX_SPEED_Y, MAX_ZOOM_CHANGE);
    final EngineOptions engineOptions = getEngineOptions();
    engineOptions.getTouchOptions().setNeedsMultiTouch(true);
    engineOptions.getAudioOptions().setNeedsMusic(true);
    engineOptions.getAudioOptions().setNeedsSound(true);
    return engineOptions;
}
 
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:10,代码来源:AbstractGameActivity.java

示例15: onCreateEngine

import org.andengine.engine.options.EngineOptions; //导入依赖的package包/类
@Override
public Engine onCreateEngine(EngineOptions pEngineOptions) {
    Engine engine = new Engine(pEngineOptions);
    if (shouldStartEngine) {
        Log.v(TAG, "onCreateEngine - Starting engine.");
        engine.start();
        shouldStartEngine = !shouldStartEngine;
    } else {
        Log.v(TAG, "onCreateEngine - Not starting engine.");
    }
    return engine;
}
 
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:13,代码来源:AbstractGameActivity.java


注:本文中的org.andengine.engine.options.EngineOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。