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


Java Color.valueOf方法代碼示例

本文整理匯總了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);
}
 
開發者ID:conquest,項目名稱:conquest,代碼行數:9,代碼來源:Hud.java

示例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;
}
 
開發者ID:conquest,項目名稱:conquest,代碼行數:41,代碼來源:Level.java

示例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);
}
 
開發者ID:DaanVanYperen,項目名稱:odb-little-fortune-planet,代碼行數:9,代碼來源:PlanetBackgroundRenderSystem.java

示例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);
    }
}
 
開發者ID:DaanVanYperen,項目名稱:odb-little-fortune-planet,代碼行數:30,代碼來源:PlanetCreationSystem.java

示例5: read

import com.badlogic.gdx.graphics.Color; //導入方法依賴的package包/類
@Override
public Color read(Json json, JsonValue jsonData, Class type){
	return Color.valueOf(jsonData.asString());
}
 
開發者ID:Anuken,項目名稱:Mindustry,代碼行數:5,代碼來源:Maps.java


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