本文整理汇总了Java中org.andengine.engine.Engine类的典型用法代码示例。如果您正苦于以下问题:Java Engine类的具体用法?Java Engine怎么用?Java Engine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Engine类属于org.andengine.engine包,在下文中一共展示了Engine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setRenderer
import org.andengine.engine.Engine; //导入依赖的package包/类
public void setRenderer(final Engine pEngine, final IRendererListener pRendererListener) {
if (this.mConfigChooser == null) {
final ConfigChooserOptions configChooserOptions = pEngine.getEngineOptions().getRenderOptions().getConfigChooserOptions();
this.mConfigChooser = new ConfigChooser(configChooserOptions);
// TODO We don't know yet if the requested color size will actually be accepted!
if (configChooserOptions.isRequestedRGBA8888()) {
this.getHolder().setFormat(android.graphics.PixelFormat.RGBA_8888);
} else if (configChooserOptions.isRequestedRGB565()) {
this.getHolder().setFormat(android.graphics.PixelFormat.RGB_565);
}
}
this.setEGLConfigChooser(this.mConfigChooser);
this.setOnTouchListener(pEngine);
this.mEngineRenderer = new EngineRenderer(pEngine, this.mConfigChooser, pRendererListener);
this.setRenderer(this.mEngineRenderer);
}
示例2: prepareManager
import org.andengine.engine.Engine; //导入依赖的package包/类
public static void prepareManager(Engine engine, GameActivity activity, Camera camera,
VertexBufferObjectManager vbom, ResourceLoader resourceLoader, StoryService storyService,
LevelService levelService, SettingsService settingsService, JustPlayScoreService justPlayScoreService) {
getInstance().engine = engine;
getInstance().activity = activity;
getInstance().camera = camera;
getInstance().vbom = vbom;
getInstance().resourceLoader = resourceLoader;
getInstance().storyService = storyService;
getInstance().levelService = levelService;
getInstance().musicService = new MusicService(MediaPlayer.create(activity.getApplicationContext(), R.raw.theme),
true);
getInstance().settingsService = settingsService;
getInstance().justPlayScoreService = justPlayScoreService;
}
示例3: loadGameScene
import org.andengine.engine.Engine; //导入依赖的package包/类
public void loadGameScene(final Engine mEngine)
{
setScene(loadingScene);
ResourcesManager.getInstance().unloadMenuTextures();
mEngine.registerUpdateHandler(new TimerHandler(0.1f, new ITimerCallback()
{
public void onTimePassed(final TimerHandler pTimerHandler)
{
mEngine.unregisterUpdateHandler(pTimerHandler);
//mEngine.getCamera().set(0, 0, 500, 300);
ResourcesManager.getInstance().loadGameResources();
gameScene = new GameScene();
setScene(gameScene);
}
}));
}
示例4: EngineRenderer
import org.andengine.engine.Engine; //导入依赖的package包/类
public EngineRenderer(final Engine pEngine, final ConfigChooser pConfigChooser, final IRendererListener pRendererListener) {
this.mEngine = pEngine;
this.mConfigChooser = pConfigChooser;
this.mRendererListener = pRendererListener;
this.mGLState = new GLState();
this.mMultiSampling = this.mEngine.getEngineOptions().getRenderOptions().getConfigChooserOptions().isRequestedMultiSampling();
}
示例5: onGameReset
import org.andengine.engine.Engine; //导入依赖的package包/类
public void onGameReset(final Engine pEngine) {
pEngine.getEngineLock().lock();
detachChild(mGameOverText);
detachChild(mGameOverScoreText);
showPlayText();
pEngine.getEngineLock().unlock();
}
示例6: EngineRenderer
import org.andengine.engine.Engine; //导入依赖的package包/类
public EngineRenderer(final Engine pEngine, final ConfigChooser pConfigChooser, final IRendererListener pRendererListener) {
this.mEngine = pEngine;
this.mConfigChooser = pConfigChooser;
this.mRendererListener = pRendererListener;
this.mGLState = new GLState();
this.mMultiSampling = this.mEngine.getEngineOptions().getRenderOptions().isMultiSampling();
}
示例7: setRenderer
import org.andengine.engine.Engine; //导入依赖的package包/类
public void setRenderer(final Engine pEngine, final IRendererListener pRendererListener) {
if(this.mConfigChooser == null) {
final boolean multiSampling = pEngine.getEngineOptions().getRenderOptions().isMultiSampling();
this.mConfigChooser = new ConfigChooser(multiSampling);
}
this.setEGLConfigChooser(this.mConfigChooser);
this.setOnTouchListener(pEngine);
this.mEngineRenderer = new EngineRenderer(pEngine, this.mConfigChooser, pRendererListener);
this.setRenderer(this.mEngineRenderer);
}
示例8: WorldController
import org.andengine.engine.Engine; //导入依赖的package包/类
public WorldController(int width, int height, float scale, float density, Engine engine) {
_width = width;
_height = height;
_scale = scale;
_density = density;
_engine = engine;
// set physics value from preferences if they have been changed
BALL_FIX_DEF.density = Prefs.getFloat(PrefKeys.BALL_DENSITY, Physics.BALL_DENSITY);
_radToGravity = _scale * (float) (Prefs.getFloat(PrefKeys.GRAVITY_FACTOR, Physics.GRAVITY_FACTOR) / Math.PI);
OBSTACLE_FIX_DEF.restitution = Prefs.getFloat(PrefKeys.WALL_ELASTICITY, Physics.WALL_ELASTICITY);
_gravityCorrection = Vector2Pool.obtain(Prefs.getFloat(PrefKeys.CALIBRATION_X, 0), Prefs.getFloat(PrefKeys.CALIBRATION_Y, 0));
}
示例9: init
import org.andengine.engine.Engine; //导入依赖的package包/类
@Override
public void init(GameLevel gameLevel, PhysicsWorld physicsWorld, Engine engine) {
_gameLevel = gameLevel;
_physicsWorld = physicsWorld;
_engine = engine;
_contactListener = new ContactListenerAdapter() {
@Override
public void beginContact(Contact contact) {
checkCollision(contact);
}
};
_physicsWorld.setContactListener(_contactListener);
}
示例10: init
import org.andengine.engine.Engine; //导入依赖的package包/类
@Override
public void init(GameLevel gameLevel, PhysicsWorld physicsWorld, Engine engine) {
super.init(gameLevel, physicsWorld, engine);
float camHeight = engine.getCamera().getHeight();
float originalHeight = 1920;
float heightScale = camHeight / originalHeight;
Typeface typeFace = Typeface.createFromAsset(GoogleFlipGameApplication.sContext.getAssets(), FontFaceType.FUTURA_BOOK.getAssetName());
Font explanationFont = FontFactory.create(_engine.getFontManager(), _engine.getTextureManager(), 512, 768, TextureOptions.BILINEAR, typeFace, (int) 20 * GoogleFlipGameApplication.sContext.getResources().getDisplayMetrics().density, Color.WHITE_ABGR_PACKED_INT);
explanationFont.load();
_engine.getFontManager().loadFont(explanationFont);
Vector2 textPoint = Vector2Pool.obtain(_engine.getCamera().getWidth() / 2, _engine.getCamera().getHeight() * .70f);
String explanation1, explanation2;
switch (GoogleFlipGameApplication.getUserModel().getTutorialLevel()) {
case 1:
explanation1 = GoogleFlipGameApplication.sContext.getResources().getString(R.string.tutorial_2a);
explanation2 = GoogleFlipGameApplication.sContext.getResources().getString(R.string.tutorial_2b);
break;
case 2:
explanation1 = GoogleFlipGameApplication.sContext.getResources().getString(R.string.tutorial_3);
explanation2 = "";
break;
default:
explanation1 = GoogleFlipGameApplication.sContext.getResources().getString(R.string.tutorial_1a);
explanation2 = GoogleFlipGameApplication.sContext.getResources().getString(R.string.tutorial_1b);
break;
}
_explanationText1 = new Text(textPoint.x, textPoint.y, explanationFont, explanation1, new TextOptions(HorizontalAlign.CENTER), _engine.getVertexBufferObjectManager());
_explanationText2 = new Text(textPoint.x, textPoint.y - (_explanationText1.getHeight()), explanationFont, explanation2, new TextOptions(HorizontalAlign.CENTER), _engine.getVertexBufferObjectManager());
_engine.getScene().attachChild(_explanationText1);
_engine.getScene().attachChild(_explanationText2);
}
示例11: onCreateEngine
import org.andengine.engine.Engine; //导入依赖的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;
}
示例12: AssetsManager
import org.andengine.engine.Engine; //导入依赖的package包/类
public AssetsManager(Context pContext, Engine pEngine) {
this.mVertexBufferObjectManager = pEngine.getVertexBufferObjectManager();
this.mGameAtlas = new BitmapTextureAtlas(pEngine.getTextureManager(), 2048, 2048, TextureOptions.NEAREST_PREMULTIPLYALPHA);
BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
this.mBackgroundTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(mGameAtlas, pContext, "background.png", 0, 0);
this.mGroundTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(mGameAtlas, pContext, "ground.png", 0, 513);
this.mPipesTiledTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(mGameAtlas, pContext, "pipes.png", 291, 0, 2, 1);
this.mFlappyTiledTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(mGameAtlas,pContext,"flappy.png",401,0, 1, 3);
}
示例13: StoryServiceImpl
import org.andengine.engine.Engine; //导入依赖的package包/类
public StoryServiceImpl(Engine engine) {
this.justPlaySceneService = new JustPlaySceneServiceImpl(engine);
this.levelModeSceneService = new LevelModeSceneServiceImpl(engine);
this.menuSceneService = new MenuSceneServiceImpl(engine);
this.creditsSceneService = new CreditsSceneServiceImpl(engine);
this.settingsSceneService = new SettingSceneServiceImpl(engine);
this.loadingSceneService = new LoadingSceneServiceImpl(engine);
}
示例14: setup
import org.andengine.engine.Engine; //导入依赖的package包/类
public static void setup(NinjaTrials pActivity, Engine pEngine, Context pContext,
float pCameraWidth, float pCameraHeight){
getInstance().activity = pActivity;
getInstance().engine = pEngine;
getInstance().context = pContext;
getInstance().cameraWidth = pCameraWidth;
getInstance().cameraHeight = pCameraHeight;
getInstance().textureManager = pActivity.getTextureManager();
}
示例15: onCreateEngine
import org.andengine.engine.Engine; //导入依赖的package包/类
@Override
public Engine onCreateEngine(EngineOptions pEngineOptions)
{
pEngineOptions.getRenderOptions().setDithering(true); //para el degradado del fondo
pEngineOptions.getAudioOptions().setNeedsMusic(true); //para la música
pEngineOptions.getAudioOptions().setNeedsSound(true);
return new Engine(pEngineOptions);
}