本文整理汇总了Java中com.badlogic.gdx.graphics.Color.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java Color.valueOf方法的具体用法?Java Color.valueOf怎么用?Java Color.valueOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.Color
的用法示例。
在下文中一共展示了Color.valueOf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Hud
import com.badlogic.gdx.graphics.Color; //导入方法依赖的package包/类
public Hud() {
stage = new Stage();
background = Color.valueOf("#626262");
timer.setAlignment(Align.bottom, Align.center);
stage.addActor(timer);
}
示例2: load
import com.badlogic.gdx.graphics.Color; //导入方法依赖的package包/类
public static SerialArray<Tile> load(String map, HashMap<Integer, Player> players) {
JsonValue value = reader.parse(map);
float scale = value.getFloat("scale");
JsonValue regions = value.get("regions");
SerialArray<Tile> tiles = new SerialArray<>();
for (JsonValue region : regions) {
Color color = Color.valueOf(region.getString("color"));
for (JsonValue tile : region.get("tiles")) {
int x = tile.getInt("x"), y = tile.getInt("y");
int width = tile.getInt("w"), height = tile.getInt("h");
Tile t = new Tile(x * scale, y * scale, (int) (width * scale), (int) (height * scale), color);
t.setRegion(region.name);
t.setTroops(tile.getInt("troops"));
if (tile.get("city") != null) {
JsonValue city = tile.get("city");
float cx = city.getInt("x") * scale, cy = city.getInt("y") * scale;
City c = new City(cx + t.getX(), cy + t.getY(), city.getBoolean("major"));
t.setCity(c);
}
if (players.get(tile.getInt("owner")) != null) {
t.setOwner(players.get(tile.getInt("owner")));
}
t.setIndex(tile.getInt("index"));
tiles.add(t);
}
}
for (int i = 0; i < tiles.size; i++) {
tiles.get(i).setContacts(tiles);
}
return tiles;
}
示例3: process
import com.badlogic.gdx.graphics.Color; //导入方法依赖的package包/类
@Override
protected void process(E e) {
Planet planet = e.getPlanet();
Color color = Color.valueOf(planet.data.spaceBackgroundColor);
Gdx.gl.glClearColor(color.r, color.g, color.b, color.a);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
}
示例4: loadPlanets
import com.badlogic.gdx.graphics.Color; //导入方法依赖的package包/类
private void loadPlanets() {
final Json json = new Json();
planetLibrary = json.fromJson(PlanetLibrary.class, Gdx.files.internal("planets.json"));
net.mostlyoriginal.game.component.PlanetData planet = planetLibrary.planets[1];
{
planetEntity = E.E();
Planet planetE = planetEntity
.renderLayer(G.LAYER_PLANET)
.planet()
.tag("planet")
.pos(0, 0)
.getPlanet();
planetE.data = planet;
for (net.mostlyoriginal.game.component.PlanetData.CellType type : planet.types) {
Color color = Color.valueOf(type.color);
Color colorArid = type.colorSecondary != null ? Color.valueOf(type.colorSecondary) : color;
planetE.cellColor[type.type.ordinal()] = type.intColor = Color.rgba8888(color);
planetE.cellColorSecondary[type.type.ordinal()] = type.intColorSecondary = Color.rgba8888(colorArid);
}
populate(planet, planetE);
gravity(planetE);
height(planetE);
}
}
示例5: read
import com.badlogic.gdx.graphics.Color; //导入方法依赖的package包/类
@Override
public Color read(Json json, JsonValue jsonData, Class type){
return Color.valueOf(jsonData.asString());
}