本文整理匯總了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());
}