当前位置: 首页>>代码示例>>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;未经允许,请勿转载。