Java Code Examples for org.andengine.entity.text.Text#setColor()

The following examples show how to use org.andengine.entity.text.Text#setColor() . 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: JustPlayScoreScene.java    From sopa with Apache License 2.0 6 votes vote down vote up
private void addTexts(int[] currentScore) {

        Text levelCompleteTextShape = new Text((float) (camera.getWidth() * 0.12), (float) (camera.getHeight() * 0.1),
                resourcesManager.levelCompleteFont, getHeadText(), 20, vbom);
        attachChild(levelCompleteTextShape);

        Text scoreText = new Text((float) (camera.getWidth() * 0.05), (float) (camera.getHeight() * 0.45),
                resourcesManager.justPlayScoreFont, "Score:      ", vbom);
        scoreText.setColor(BLACK);
        attachChild(scoreText);

        score = new Text((float) (camera.getWidth() * 0.65), (float) (camera.getHeight() * 0.45),
                resourcesManager.justPlayScoreFont, "" + currentScore[0], 8, vbom);
        score.setColor(BLACK);
        attachChild(score);

        Text timeText = new Text((float) (camera.getWidth() * 0.05), (float) (camera.getHeight() * 0.605),
                resourcesManager.justPlayScoreFont,
                "Left Time:      \t" + justPlayResult.getLeftTime() + "\n"
                + "Extra Time:\t+" + justPlayResult.getExtraTime(), vbom);
        timeText.setColor(WHITE);
        attachChild(timeText);
    }
 
Example 2
Source File: JustPlayLostScene.java    From sopa with Apache License 2.0 5 votes vote down vote up
private void addTexts(int[] currentScore) {

        if (isNewHighscore) {
            Text newHighscoreText = new Text((float) (camera.getWidth() * 0.12), (float) (camera.getHeight() * 0.1),
                    resourcesManager.levelCompleteFont, "       New\nHighscore", 20, vbom);
            attachChild(newHighscoreText);
        } else {
            Text levelCompleteTextShape = new Text((float) (camera.getWidth() * 0.12),
                    (float) (camera.getHeight() * 0.1), resourcesManager.levelCompleteFont, "     Game\n      Over", 20,
                    vbom);
            attachChild(levelCompleteTextShape);
            levelCompleteTextShape.setScaleCenter(levelCompleteTextShape.getWidth() / 2,
                levelCompleteTextShape.getHeight() / 2);
            levelCompleteTextShape.setScale(1.3f);
        }

        Text scoreText = new Text((float) (camera.getWidth() * 0.05), (float) (camera.getHeight() * 0.45),
                resourcesManager.justPlayScoreFont, "Score:      ", vbom);
        scoreText.setColor(BLACK);
        attachChild(scoreText);

        score = new Text((float) (camera.getWidth() * 0.6), (float) (camera.getHeight() * 0.45),
                resourcesManager.justPlayScoreFont, "" + currentScore[0], 8, vbom);
        score.setColor(BLACK);
        attachChild(score);

        Text level = new Text(scoreText.getX(), scoreText.getY() + textFieldHeight, resourcesManager.justPlayScoreFont,
                "Level:              " + justPlayResult.getLevelCount(), vbom);
        level.setColor(BLACK);
        attachChild(level);

        JustPlayScore justPlayHighscore = justPlayScoreService.getHighscore();

        if (justPlayHighscore != null) {
            Text highScore = new Text(scoreText.getX(), score.getY() + textFieldHeight * 2,
                    resourcesManager.justPlayScoreFont, "Highscore:\t" + justPlayHighscore.getPoints(), vbom);
            highScore.setColor(BLACK);
            attachChild(highScore);
        }
    }