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