当前位置: 首页>>代码示例>>Java>>正文


Java Color.RED属性代码示例

本文整理汇总了Java中com.badlogic.gdx.graphics.Color.RED属性的典型用法代码示例。如果您正苦于以下问题:Java Color.RED属性的具体用法?Java Color.RED怎么用?Java Color.RED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.badlogic.gdx.graphics.Color的用法示例。


在下文中一共展示了Color.RED属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: draw

public static void draw(SpriteBatch batch, float x, float y) {
    component.setText("x " + GameScreenManager.getLocalPlayer().getLives());
    if (GameScreenManager.getLocalPlayer().getLives() == 0) {
        if (component.getParameter().color != Color.RED) {
            component.getParameter().color = Color.RED;
            component.update();
        }
    } else {
        if (component.getParameter().color != Color.WHITE) {
            component.getParameter().color = Color.WHITE;
            component.update();
        }
    }
    component.draw(batch, x + LIFE_ICON.getWidth(), y + component.getLayout().height * 3.5f);

    LIFE_ICON.setPosition(x, y);
    LIFE_ICON.draw(batch);
}
 
开发者ID:Benjozork,项目名称:Onyx,代码行数:18,代码来源:LifeIndicator.java

示例3: convertColor

private Color convertColor(CustomColor color) {
    switch(color) {
        case WHITE:
            return Color.WHITE;
            
        case BLACK:
            return Color.BLACK;
            
        case BLUE:
            return Color.BLUE;
            
        default:
            return Color.RED;
    }
}
 
开发者ID:hogeschool,项目名称:INFSEN01-2,代码行数:15,代码来源:GDXDrawingAdapter.java

示例4: convertColor

private Color convertColor(CustomColor color) {
    switch (color) {
        case WHITE:
            return Color.WHITE;

        case BLACK:
            return Color.BLACK;

        case BLUE:
            return Color.BLUE;

        default:
            return Color.RED;
    }
}
 
开发者ID:hogeschool,项目名称:INFSEN01-2,代码行数:15,代码来源:GDXDrawingAdapter.java

示例5: detcolor

public Color detcolor(int c){
    switch (c){
        case 1:{
            return Color.RED;
        }
        case 2:{
            return Color.BLUE;
        }
        case 3:{
            return Color.GREEN;
        }
    }
    return Color.BLACK;
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:14,代码来源:ScreenChat.java

示例6: NormalDamageLabel

public NormalDamageLabel(int damage, GameObject source)
{
    super(String.valueOf(damage), source, Color.RED);
    x = source.getX() + 12;
    y = source.getY() + 12;
}
 
开发者ID:MMORPG-Prototype,项目名称:MMORPG_Prototype,代码行数:6,代码来源:NormalDamageLabel.java

示例7: TextParticle

public TextParticle(@NotNull String text) { this(text, Color.RED); } 
开发者ID:chrisj42,项目名称:miniventure,代码行数:1,代码来源:TextParticle.java


注:本文中的com.badlogic.gdx.graphics.Color.RED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。