org.andengine.engine.Engine Java Examples

The following examples show how to use org.andengine.engine.Engine. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResourcesManager.java    From sopa with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #2
Source File: RenderSurfaceView.java    From tilt-game-android with MIT License 6 votes vote down vote up
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);
}
 
Example #3
Source File: BaseLevelController.java    From tilt-game-android with MIT License 5 votes vote down vote up
@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);
}
 
Example #4
Source File: StoryServiceImpl.java    From sopa with Apache License 2.0 5 votes vote down vote up
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);
    }
 
Example #5
Source File: TutorialLevelController.java    From tilt-game-android with MIT License 5 votes vote down vote up
@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);
}
 
Example #6
Source File: RenderSurfaceView.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #7
Source File: EngineRenderer.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example #8
Source File: WorldController.java    From tilt-game-android with MIT License 5 votes vote down vote up
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));
}
 
Example #9
Source File: EngineRenderer.java    From tilt-game-android with MIT License 5 votes vote down vote up
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();
}
 
Example #10
Source File: BaseGameActivity.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public Engine getEngine() {
	return this.mEngine;
}
 
Example #11
Source File: LegacyBaseGameActivity.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
@Override
public final Engine onCreateEngine(final EngineOptions pEngineOptions) {
	return this.onLoadEngine();
}
 
Example #12
Source File: BaseGameActivity.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
@Override
public Engine onCreateEngine(final EngineOptions pEngineOptions) {
	return new Engine(pEngineOptions);
}
 
Example #13
Source File: LegacyBaseGameActivity.java    From tilt-game-android with MIT License 4 votes vote down vote up
@Override
public final Engine onCreateEngine(final EngineOptions pEngineOptions) {
	return this.onLoadEngine();
}
 
Example #14
Source File: BaseGameActivity.java    From tilt-game-android with MIT License 4 votes vote down vote up
public Engine getEngine() {
	return this.mEngine;
}
 
Example #15
Source File: BaseGameActivity.java    From tilt-game-android with MIT License 4 votes vote down vote up
@Override
public Engine onCreateEngine(final EngineOptions pEngineOptions) {
	return new Engine(pEngineOptions);
}
 
Example #16
Source File: CreditsSceneServiceImpl.java    From sopa with Apache License 2.0 2 votes vote down vote up
public CreditsSceneServiceImpl(Engine engine) {

        this.engine = engine;
    }
 
Example #17
Source File: LoadingSceneServiceImpl.java    From sopa with Apache License 2.0 2 votes vote down vote up
public LoadingSceneServiceImpl(Engine engine) {

        this.engine = engine;
    }
 
Example #18
Source File: SettingSceneServiceImpl.java    From sopa with Apache License 2.0 2 votes vote down vote up
public SettingSceneServiceImpl(Engine engine) {

        this.engine = engine;
    }
 
Example #19
Source File: JustPlaySceneServiceImpl.java    From sopa with Apache License 2.0 2 votes vote down vote up
public JustPlaySceneServiceImpl(Engine engine) {

        this.engine = engine;
    }
 
Example #20
Source File: LevelModeSceneServiceImpl.java    From sopa with Apache License 2.0 2 votes vote down vote up
public LevelModeSceneServiceImpl(Engine engine) {

        this.engine = engine;
    }
 
Example #21
Source File: MenuSceneServiceImpl.java    From sopa with Apache License 2.0 2 votes vote down vote up
public MenuSceneServiceImpl(Engine engine) {

        this.engine = engine;
    }
 
Example #22
Source File: IGameInterface.java    From 30-android-libraries-in-30-days with Apache License 2.0 votes vote down vote up
public Engine onCreateEngine(final EngineOptions pEngineOptions); 
Example #23
Source File: LegacyBaseGameActivity.java    From 30-android-libraries-in-30-days with Apache License 2.0 votes vote down vote up
protected abstract Engine onLoadEngine(); 
Example #24
Source File: LegacyBaseGameActivity.java    From tilt-game-android with MIT License votes vote down vote up
protected abstract Engine onLoadEngine(); 
Example #25
Source File: IGameInterface.java    From tilt-game-android with MIT License votes vote down vote up
public Engine onCreateEngine(final EngineOptions pEngineOptions); 
Example #26
Source File: LevelController.java    From tilt-game-android with MIT License votes vote down vote up
void init(GameLevel gameLevel, PhysicsWorld physicsWorld, Engine engine);