本文整理汇总了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();
}
}
示例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;
}
示例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();
}