org.andengine.entity.text.TextOptions Java Examples

The following examples show how to use org.andengine.entity.text.TextOptions. 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: 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 #2
Source File: TextMenuItem.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager) {
	super(0, 0, pFont, pText, pTextOptions, pVertexBufferObjectManager);

	this.mID = pID;
}
 
Example #3
Source File: SceneManager.java    From OpenFlappyBird with Do What The F*ck You Want To Public License 4 votes vote down vote up
public Scene createScene(){

		Scene mScene = new Scene();
		VertexBufferObjectManager vbo = mContext.getVertexBufferObjectManager();

		Sprite backgroundSprite = new Sprite(0, 0 , mResourceManager.mBackgroundTextureRegion, vbo);	
		mParallaxBackground.attachParallaxEntity(new ParallaxEntity(1, backgroundSprite));

		mScene.setBackground(mParallaxBackground);
		mScene.setBackgroundEnabled(true);


		// bird		
		float birdStartXOffset = (MainActivity.CAMERA_WIDTH / 4) - (Bird.BIRD_WIDTH / 4);
		float birdYOffset = (MainActivity.CAMERA_HEIGHT / 2) - (Bird.BIRD_HEIGHT / 4);
		mBird = new Bird(birdStartXOffset, birdYOffset, mContext.getVertexBufferObjectManager(), mScene);

		//score
		mScoreText = new Text(0, 60, mResourceManager.mScoreFont, "        ", new TextOptions(HorizontalAlign.CENTER), mContext.getVertexBufferObjectManager());
		mScoreText.setZIndex(3);
		mScene.attachChild(mScoreText);		

		// get ready text
		mGetReadyText = new Text(0, 220, mResourceManager.mGetReadyFont, "Get Ready!", new TextOptions(HorizontalAlign.CENTER), mContext.getVertexBufferObjectManager());
		mGetReadyText.setZIndex(3);
		mScene.attachChild(mGetReadyText);
		centerText(mGetReadyText);

		// instructions image
		mInstructionsSprite = new Sprite(0, 0, 200, 172, mResourceManager.mInstructionsTexture, mContext.getVertexBufferObjectManager());
		mInstructionsSprite.setZIndex(3);
		mScene.attachChild(mInstructionsSprite);
		centerSprite(mInstructionsSprite);
		mInstructionsSprite.setY(mInstructionsSprite.getY() + 20);

		// copy text
		mCopyText = new Text(0, 750, mResourceManager.mCopyFont, "(c) Dean Wild 2014", new TextOptions(HorizontalAlign.CENTER), mContext.getVertexBufferObjectManager());
		mCopyText.setZIndex(3);
		mScene.attachChild(mCopyText);
		centerText(mCopyText);


		// you suck text		
		mYouSuckText = new Text(0, MainActivity.CAMERA_HEIGHT / 2 - 100, mResourceManager.mYouSuckFont, "You Suck!", new TextOptions(HorizontalAlign.CENTER), mContext.getVertexBufferObjectManager());
		mYouSuckText.setZIndex(3);		
		centerText(mYouSuckText);

		return mScene;
	}
 
Example #4
Source File: TextMenuItem.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final int pCharactersMaximum, final TextOptions pTextOptions, final ITextVertexBufferObject pTextVertexBufferObject, final ShaderProgram pShaderProgram) {
	super(0, 0, pFont, pText, pCharactersMaximum, pTextOptions, pTextVertexBufferObject, pShaderProgram);

	this.mID = pID;
}
 
Example #5
Source File: TextMenuItem.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final int pCharactersMaximum, final TextOptions pTextOptions, final ITextVertexBufferObject pTextVertexBufferObject) {
	super(0, 0, pFont, pText, pCharactersMaximum, pTextOptions, pTextVertexBufferObject);

	this.mID = pID;
}
 
Example #6
Source File: TextMenuItem.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final int pCharactersMaximum, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType, final ShaderProgram pShaderProgram) {
	super(0, 0, pFont, pText, pCharactersMaximum, pTextOptions, pVertexBufferObjectManager, pDrawType, pShaderProgram);

	this.mID = pID;
}
 
Example #7
Source File: TextMenuItem.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final int pCharactersMaximum, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType) {
	super(0, 0, pFont, pText, pCharactersMaximum, pTextOptions, pVertexBufferObjectManager, pDrawType);

	this.mID = pID;
}
 
Example #8
Source File: TextMenuItem.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final int pCharactersMaximum, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager) {
	super(0, 0, pFont, pText, pCharactersMaximum, pTextOptions, pVertexBufferObjectManager);

	this.mID = pID;
}
 
Example #9
Source File: TextMenuItem.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType, final ShaderProgram pShaderProgram) {
	super(0, 0, pFont, pText, pTextOptions, pVertexBufferObjectManager, pDrawType, pShaderProgram);

	this.mID = pID;
}
 
Example #10
Source File: TextMenuItem.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType) {
	super(0, 0, pFont, pText, pTextOptions, pVertexBufferObjectManager, pDrawType);

	this.mID = pID;
}
 
Example #11
Source File: TextMenuItem.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager, final ShaderProgram pShaderProgram) {
	super(0, 0, pFont, pText, pTextOptions, pVertexBufferObjectManager, pShaderProgram);

	this.mID = pID;
}
 
Example #12
Source File: TextMenuItem.java    From tilt-game-android with MIT License 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final int pCharactersMaximum, final TextOptions pTextOptions, final ITextVertexBufferObject pTextVertexBufferObject, final ShaderProgram pShaderProgram) {
	super(0, 0, pFont, pText, pCharactersMaximum, pTextOptions, pTextVertexBufferObject, pShaderProgram);

	this.mID = pID;
}
 
Example #13
Source File: TextMenuItem.java    From tilt-game-android with MIT License 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final int pCharactersMaximum, final TextOptions pTextOptions, final ITextVertexBufferObject pTextVertexBufferObject) {
	super(0, 0, pFont, pText, pCharactersMaximum, pTextOptions, pTextVertexBufferObject);

	this.mID = pID;
}
 
Example #14
Source File: TextMenuItem.java    From tilt-game-android with MIT License 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final int pCharactersMaximum, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType, final ShaderProgram pShaderProgram) {
	super(0, 0, pFont, pText, pCharactersMaximum, pTextOptions, pVertexBufferObjectManager, pDrawType, pShaderProgram);

	this.mID = pID;
}
 
Example #15
Source File: TextMenuItem.java    From tilt-game-android with MIT License 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final int pCharactersMaximum, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType) {
	super(0, 0, pFont, pText, pCharactersMaximum, pTextOptions, pVertexBufferObjectManager, pDrawType);

	this.mID = pID;
}
 
Example #16
Source File: TextMenuItem.java    From tilt-game-android with MIT License 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final int pCharactersMaximum, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager) {
	super(0, 0, pFont, pText, pCharactersMaximum, pTextOptions, pVertexBufferObjectManager);

	this.mID = pID;
}
 
Example #17
Source File: TextMenuItem.java    From tilt-game-android with MIT License 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType, final ShaderProgram pShaderProgram) {
	super(0, 0, pFont, pText, pTextOptions, pVertexBufferObjectManager, pDrawType, pShaderProgram);

	this.mID = pID;
}
 
Example #18
Source File: TextMenuItem.java    From tilt-game-android with MIT License 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType) {
	super(0, 0, pFont, pText, pTextOptions, pVertexBufferObjectManager, pDrawType);

	this.mID = pID;
}
 
Example #19
Source File: TextMenuItem.java    From tilt-game-android with MIT License 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager, final ShaderProgram pShaderProgram) {
	super(0, 0, pFont, pText, pTextOptions, pVertexBufferObjectManager, pShaderProgram);

	this.mID = pID;
}
 
Example #20
Source File: TextMenuItem.java    From tilt-game-android with MIT License 4 votes vote down vote up
public TextMenuItem(final int pID, final IFont pFont, final CharSequence pText, final TextOptions pTextOptions, final VertexBufferObjectManager pVertexBufferObjectManager) {
	super(0, 0, pFont, pText, pTextOptions, pVertexBufferObjectManager);

	this.mID = pID;
}