當前位置: 首頁>>代碼示例>>Java>>正文


Java Color.YELLOW屬性代碼示例

本文整理匯總了Java中com.badlogic.gdx.graphics.Color.YELLOW屬性的典型用法代碼示例。如果您正苦於以下問題:Java Color.YELLOW屬性的具體用法?Java Color.YELLOW怎麽用?Java Color.YELLOW使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在com.badlogic.gdx.graphics.Color的用法示例。


在下文中一共展示了Color.YELLOW屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: draw

public void draw(SpriteBatch spriteBatch) {
	
	// Draw HUD Element if it needs to be drawn
	if (showHUDElement) {

		shapeRenderer.begin(ShapeType.Filled);
		// Change HP color to yellow between 20% and 10% and red at 10% and lower
		if (healthLeft >= (totalHealth * 0.4)) {
			healthBarColor = Color.GREEN;
		}
		else if (healthLeft < (totalHealth * 0.4) && healthLeft > (totalHealth * 0.2)) {
			healthBarColor = Color.YELLOW;
		} else if (healthLeft < (totalHealth * 0.2)) {
			healthBarColor = Color.RED;
		}
		shapeRenderer.setColor(healthBarColor);
		shapeRenderer.rect(x, y, healthLeft - 1, height);
		shapeRenderer.end();
		
		shapeRenderer.begin(ShapeType.Line);
		shapeRenderer.setColor(Color.WHITE);
		shapeRenderer.rect(x, y, width, height);
		shapeRenderer.end();
	}
	
}
 
開發者ID:ja-brouil,項目名稱:StarshipFighters,代碼行數:26,代碼來源:HealthBar.java

示例2: GameObject

public GameObject() {
	controllers = new Array<GameObjectController>();
	sprite = NO_SPRITE;
	velocity = new Vector2();
	setOrigin(Align.center);
	debug_bounds = Color.YELLOW;
	flip_x = false;
	flip_y = false;
	ignore_collision = false;
	group = 1;
	filter = -1;
}
 
開發者ID:kyperbelt,項目名稱:KyperBox,代碼行數:12,代碼來源:GameObject.java

示例3: renderPause

/**
 * Stellt das Ingame Menü dar.
 *
 * @param camera Zugriff auf die Kamera
 * @param x erspart eine Neuberechnung der X Position des Menüs
 */
private void renderPause(OrthographicCamera camera, float x)
{
    batch.setProjectionMatrix(projection);
    batch.begin();

    float y = camera.viewportHeight - (camera.viewportHeight - HEIGHT) / 2f;

    y -= 45;

    fontLayout.setText(titleFont, localeBundle.get(deathMode ? "gestorben" : "menu"), Color.CORAL, WIDTH, Align.center, false);
    titleFont.draw(batch, fontLayout, x, y);

    y -= 125f;

    for (int i = 0; i < ENTRIES.length; i++)
    {
        Color entryColor = Color.WHITE;
        if (i == activeEntry)
        {
            entryColor = Color.YELLOW;
        }

        fontLayout.setText(textFont, localeBundle.get((i == 0 && deathMode) ? "neustart" : ENTRIES[i]), entryColor, WIDTH, Align.center, false);
        textFont.draw(batch, fontLayout, x, y);

        y -= 75f;
    }

    batch.end();
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:36,代碼來源:IngameMenu.java


注:本文中的com.badlogic.gdx.graphics.Color.YELLOW屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。