本文整理汇总了Java中com.badlogic.gdx.graphics.Color.rgba8888方法的典型用法代码示例。如果您正苦于以下问题:Java Color.rgba8888方法的具体用法?Java Color.rgba8888怎么用?Java Color.rgba8888使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.Color
的用法示例。
在下文中一共展示了Color.rgba8888方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import com.badlogic.gdx.graphics.Color; //导入方法依赖的package包/类
@Override
public void write(Json json) {
super.write(json);
StringBuilder sb = new StringBuilder();
for(int x = 0; x < pixmap.getWidth(); x++) {
for(int y = 0; y < pixmap.getHeight(); y++) {
int color = pixmap.getPixel(x, y);
if(color == Color.rgba8888(47f / 255f, 86f / 255f, 118f / 255f, 1f)) {
sb.append("d");
} else if(color == Color.rgba8888(62f / 255f, 120f / 255f, 160f / 255f, 1f)) {
sb.append("o");
} else if(color == Color.rgba8888(146f / 255f, 209f / 255f, 135f / 255f, 1f)) {
sb.append("l");
}
}
}
json.writeValue("texture", sb.toString());
}
示例2: testMoonJson
import com.badlogic.gdx.graphics.Color; //导入方法依赖的package包/类
@Test
public void testMoonJson() {
Orbiter.OrbiterBlueprint orbiterBlueprint = new Orbiter.OrbiterBlueprint();
orbiterBlueprint.angularVelocity = 50;
orbiterBlueprint.xTilt = -20;
orbiterBlueprint.zTilt = 35;
orbiterBlueprint.radius = 240;
orbiterBlueprint.angle = 120;
Sprite sprite = new Sprite();
sprite.setSize(20, 20);
Orbiter saveMoon = new Orbiter(sprite, orbiterBlueprint, Color.rgba8888(Color.RED));
String moonJson = json.toJson(saveMoon);
assertNotEquals("", moonJson);
Orbiter loadMoon = json.fromJson(Orbiter.class, moonJson);
assertNotEquals(null, loadMoon);
assertEquals(50, loadMoon.getAngularVelocity());
assertEquals(-20, loadMoon.getXTilt());
assertEquals(35, loadMoon.getZTilt());
assertEquals(240, loadMoon.getRadius());
assertEquals(120, loadMoon.getAngle());
assertEquals(20, loadMoon.getSize());
assertEquals(Color.rgba8888(Color.RED), loadMoon.getColor());
}
示例3: acceptNewPlayer
import com.badlogic.gdx.graphics.Color; //导入方法依赖的package包/类
private void acceptNewPlayer(PlayerJoined message, String senderId) {
Player newPlayer = new Player(message.getPlayerName(), senderId, Color.rgba8888(colorPool.getNextAvailableColor()));
data.getPlayers().addPlayer(newPlayer);
PlayerAccepted playerAccepted = new PlayerAccepted(newPlayer);
playerAccepted.setMapName(data.getMapFilename());
playerAccepted.setMaxNumPlayers(data.getMaxPlayer());
context.sendMessage(playerAccepted, senderId);
}
示例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: Orbiter
import com.badlogic.gdx.graphics.Color; //导入方法依赖的package包/类
public Orbiter(Sprite sprite, OrbiterBlueprint blueprint) {
this(sprite, blueprint, Color.rgba8888(Color.WHITE));
}
示例6: SpaceObject
import com.badlogic.gdx.graphics.Color; //导入方法依赖的package包/类
public SpaceObject(Sprite sprite) {
this(sprite, Color.rgba8888(Color.WHITE));
}
示例7: pixelToShaderPixel
import com.badlogic.gdx.graphics.Color; //导入方法依赖的package包/类
/**
* Converts a monochrome pixel value (expected to be 0 to 3), attribute value,
* (also expected to be 0 to 3) into a color to be consumed by the fragment shader.
* The r and g components are used to look up the actual color to replace the pixel
* with within a palette texture looked up by u/v coordinates in the fragment shader.
* The g component will be the attribute and will point to the base of one of 4,
* 4 color palettes with the values 0, .25, .5 and .75. The actual color will be pointed
* to by the r component as an offset from the g component, which is .25/8 + the
* attribute value.
*
* @param pixelValue
* @param transparentColor
* @return
*/
protected int pixelToShaderPixel(int pixelValue, boolean transparentColor) {
float r = (((float) pixelValue) * (.25f / 4f)) + (.25f / 8f);
return Color.rgba8888(r / 2, 0, 0, transparentColor ? 0f : 1f);
}