本文整理汇总了Java中com.badlogic.gdx.graphics.Color类的典型用法代码示例。如果您正苦于以下问题:Java Color类的具体用法?Java Color怎么用?Java Color使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Color类属于com.badlogic.gdx.graphics包,在下文中一共展示了Color类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Maps
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
public Maps() {
json.setOutputType(OutputType.json);
json.setElementType(ArrayContainer.class, "maps", Map.class);
json.setSerializer(Color.class, new ColorSerializer());
}
示例2: MenuScreen
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
public MenuScreen() {
camera = new OrthographicCamera();
viewport = new FitViewport(Game.WIDTH, Game.HEIGHT, camera);
viewport.apply();
camera.position.set(Game.WIDTH / 2, Game.HEIGHT / 2, 0);
camera.update();
betaText = new BitmapFont(Gdx.files.internal("score.fnt"), Gdx.files.internal("score.png"), false);
betaText.getData().setScale(0.35f);
logo = new Sprite(new Texture("logo.png"));
Random r = new Random();
background = new Particle[r.nextInt(55 - 45) + 45];
for (int i = 0; i < background.length; i++) {
int size = r.nextInt(4) + 1;
int x = r.nextInt(Game.WIDTH);
int y = r.nextInt(Game.HEIGHT);
background[i] = new Particle(x, y, 0, 0, -1, new Color(207 / 255f, 187 / 255f, 20 / 255f, 1f), size);
}
musicMuted = new Sprite(new Texture(Gdx.files.internal("buttons/music_muted.png")));
musicUnmuted = new Sprite(new Texture(Gdx.files.internal("buttons/music_unmuted.png")));
play = new CenteredButton(500, "buttons/play.png");
music = new Button(Game.WIDTH - 130, 15, Game.musicMuted() ? musicMuted : musicUnmuted);
music.setScale(4f);
}
示例3: render
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 1, 1, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
randomDelta += delta;
game.batch.begin();
fontHandler.font90.setColor(Color.BLACK);
fontHandler.font90.draw(game.batch, "Loading", (game.screenX / 2) - widthLoading / 2, (game.screenY / 2) + 100);
game.batch.end();
if (randomDelta >= .1 && settingMap == true) {
settingMap = false;
game.setScreen(new GameScreen(game));
}
}
示例4: createWorld
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
protected World createWorld() {
final RenderBatchingSystem renderBatchingSystem;
return new World(new WorldConfigurationBuilder()
.dependsOn(OperationsPlugin.class)
.with(WorldConfigurationBuilder.Priority.HIGH,
// supportive
new SuperMapper(),
new TagManager(),
new CameraSystem(1),
new FeatureScreenAssetSystem(),
new OdbFeatureDetectionSystem()
).with(WorldConfigurationBuilder.Priority.LOW,
// processing
new TransitionSystem(GdxArtemisGame.getInstance()),
// animation
new ClearScreenSystem(Color.valueOf("969291")),
renderBatchingSystem = new RenderBatchingSystem(),
new AnimRenderSystem(renderBatchingSystem),
new FeatureScreenSetupSystem()
).build());
}
示例5: updateUpgradeInfo
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
public void updateUpgradeInfo() {
if (isOverUpgradeBtn()) {
if (model.isDamageGreenText())
uistage.getUiPanel().getRightSection().getTowerSelectDamage().setColor(Assets.greenColor);
else
uistage.getUiPanel().getRightSection().getTowerSelectDamage().setColor(Color.WHITE);
if (model.isIsfireRateGreenText())
uistage.getUiPanel().getRightSection().getTowerSelectFireRate().setColor(Assets.greenColor);
else
uistage.getUiPanel().getRightSection().getTowerSelectFireRate().setColor(Color.WHITE);
if (model.isRangeGreenText())
uistage.getUiPanel().getRightSection().getTowerSelectRange().setColor(Assets.greenColor);
else
uistage.getUiPanel().getRightSection().getTowerSelectRange().setColor(Color.WHITE);
} else {
uistage.getUiPanel().getRightSection().getTowerSelectFireRate().setColor(Color.WHITE);
uistage.getUiPanel().getRightSection().getTowerSelectRange().setColor(Color.WHITE);
uistage.getUiPanel().getRightSection().getTowerSelectDamage().setColor(Color.WHITE);
}
}
示例6: GameActor
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
public GameActor(TextureRegion actor_region,float x_pos,float y_pos,Color color,float width,float height,boolean is_loading) {
actor_texture = actor_region;
xpos = x_pos ;
ypos = y_pos ;
width_ =width ;
height_ = height;
actor_Sprite = new Sprite(actor_texture);
actor_Sprite.setX(xpos);
actor_Sprite.setY(ypos);
if(color != null){
actor_color = color ;
actor_Sprite.setColor(actor_color);}
actor_Sprite.setSize(width_, height_);
}
示例7: popShapeCommandCell
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
final StructShapeCommand popShapeCommandCell() {
if(currShapePos >= shapeCommandQueues.size) {
return null;
}
stackCommand.clear();
stackCommand.drawType = (DrawType) shapeCommandQueues.get(currShapePos++);
stackCommand.color = (Color) shapeCommandQueues.get(currShapePos++);
// 如果color是null则使用默认颜色
if(stackCommand.color == null) {
stackCommand.color = getDisplayedColor();
}
stackCommand.shapeType = (ShapeType) shapeCommandQueues.get(currShapePos++);
stackCommand.borderWidth = (float) shapeCommandQueues.get(currShapePos++);
int dataLen = (int) shapeCommandQueues.get(currShapePos++);
for(int i = 0; i < dataLen; ++i) {
stackCommand.vertexArray.add((Float) shapeCommandQueues.get(currShapePos++));
}
return stackCommand;
}
示例8: updateVisual
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
public void updateVisual(){
Skin skin = new Skin();
Pixmap pixmap = new Pixmap(1,(int)(Gdx.graphics.getHeight()*0.0175), Pixmap.Format.RGBA8888);
switch (infoProfile.getDateUserGame().getFaction()){
case 1:{
pixmap.setColor(1, 0f, 0f, 1);
break;
}
case 2:{
pixmap.setColor(0f, 0.831f, 0.969f,1f);
break;
}
case 3:{
pixmap.setColor(0.129f, 0.996f, 0.29f,1);
break;
}
}
pixmap.fill();
skin.add("blue", new Texture(pixmap));
ProgressBar.ProgressBarStyle style = new ProgressBar.ProgressBarStyle(bar.getStyle().background,skin.newDrawable("blue",Color.WHITE));
style.knobBefore = style.knob;
bar.setStyle(style);
}
示例9: addChangeFaction
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
private void addChangeFaction(){
groupChangeFaction = new Group();
Image background = new Image(new TextureRegion(manager.getAssetsSettings().getTexture(NameFiles.extensionImgBackground)));
background.setSize(Width - Width * 0.03f, Height * 0.1f);
background.setPosition(Width / 2 - background.getWidth() / 2, Height * 0.3f);
groupChangeFaction.addActor(background);
Label labelFac = new Label("Change Faction",new Label.LabelStyle(Font.getFont((int)(Height*0.025f)),Color.WHITE));
labelFac.setPosition(background.getX()+background.getWidth()*0.05f,background.getY()+background.getHeight()/2-labelFac.getHeight()/2);
labelFac.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
manager.loadAssetsChoiceFaction();
gameManager.setScreen(new ScreenCircleLoading(gameManager,new ScreenChoiceFaction(gameManager),manager.getAssetsChoiceFaction()));
}
});
groupChangeFaction.addActor(labelFac);
}
示例10: createToolTip
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
private void createToolTip()
{
Skin skin = new Skin();
Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
pixmap.setColor(Color.WHITE);
pixmap.fill();
skin.add("white", new Texture(pixmap));
skin.add("default", new BitmapFont());
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
textButtonStyle.font = skin.getFont("default");
skin.add("default", textButtonStyle);
labelToolTip = new TextButton("TEST", skin);
labelToolTip.setX(5);
labelToolTip.setY(5);
labelToolTip.setWidth(125);
labelToolTip.setVisible(false);
labelToolTip.getLabel().setWrap(true);
labelToolTip.setHeight(labelToolTip.getLabel().getHeight());
group.addActor(labelToolTip);
}
示例11: drawSelect
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
@Override
public void drawSelect(Tile tile){
super.drawSelect(tile);
NuclearReactorEntity entity = tile.entity();
Vector2 offset = getPlaceOffset();
Vars.renderer.drawBar(Color.GREEN, tile.worldx() + offset.x, tile.worldy() + 6 +
offset.y + height*Vars.tilesize/2f, (float)entity.getItem(generateItem) / itemCapacity);
Draw.reset();
float fract = entity.heat;
if(fract > 0)
fract = Mathf.clamp(fract + 0.2f, 0.24f, 1f);
Vars.renderer.drawBar(Color.ORANGE, tile.worldx() + offset.x,
tile.worldy() + Vars.tilesize * height/2f + 10 + offset.y, fract);
}
示例12: drawSelect
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
@Override
public void drawSelect(Tile tile){
Vector2 offset = getPlaceOffset();
Draw.color(Color.GREEN);
Draw.dashCircle(tile.worldx() + offset.x, tile.worldy() + offset.y, range);
Draw.reset();
TurretEntity entity = tile.entity();
float fract = (float)entity.ammo/maxammo;
if(fract > 0)
fract = Mathf.clamp(fract, 0.24f, 1f);
Vars.renderer.drawBar(Color.GREEN, tile.worldx() + offset.x, 2 + tile.worldy() + height/2f*Vars.tilesize + offset.y, fract);
}
示例13: read
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
@Override
public Color read(Kryo kryo, Input input, Class<Color> type) {
Boolean compact = GraphHeader.isUseCompactColor(kryo);
if (compact == null) compact = isCompactDefault;
if (compact){
Color color = new Color();
Color.rgba8888ToColor(color, input.readInt());
return color;
} else {
float r = input.readFloat();
float g = input.readFloat();
float b = input.readFloat();
float a = input.readFloat();
return new Color(r, g, b, a);
}
}
示例14: spawnNewTroop
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
/**
* Creates a new Infantry on the Region specified within the message
* @param message GUI Message containing position information
*/
private void spawnNewTroop(SpawnTroopGui message) {
AssetMap.Region region = regionNameMap.get(message.getRegionName());
Vector2 troopCoordinates = calculatePolygonCentroid(region.getVertices());
Infantry infantry = new Infantry((troopCoordinates.x * Gdx.graphics.getWidth()) - 50, (troopCoordinates.y * Gdx.graphics.getHeight()) - 50, 100, 100, message.getId());
infantry.addTouchListener();
infantry.setFirstMove(false);
infantry.setCurrentRegion(regionNameMap.get(message.getRegionName()));
Gdx.app.log("Spawning", "Actor with ID: " + infantry.getId());
// set color and owner only when the first troop spawns on this region
if (region.getOwner().equals(Player.NULL_PLAYERNAME)) {
region.setOwner(data.getCurrentPlayer().getPlayerName());
setRegionColor(new Color(data.getCurrentPlayer().getColor()), infantry.getCurrentRegion());
}
region.updateTroops(1);
data.setChangedFlag(true);
figures.add(infantry);
addSceneObject(infantry);
}
示例15: createMoon
import com.badlogic.gdx.graphics.Color; //导入依赖的package包/类
public Orbiter createMoon() {
ColorGroup colors = new ColorGroup()
.add(Color.rgba8888(176f / 255f, 155f / 255f, 178f / 255f, 1f))
.add(Color.rgba8888(156f / 255f, 155f / 255f, 190f / 255f, 1f))
.add(Color.rgba8888(223f / 255f, 233f / 255f, 180f / 255f, 1f))
.add(Color.rgba8888(75f / 255f, 109f / 255f, 133f / 255f, 1f));
int moonCount = MathUtils.random(0, 8);
float zTilt = zDir * MathUtils.random(10, 50);
float xTilt = -MathUtils.random(15, 55);
Orbiter.OrbiterBlueprint moonBlueprint = new Orbiter.OrbiterBlueprint();
moonBlueprint.angularVelocity = velDir * MathUtils.random(15, 60);
moonBlueprint.zTilt = zTilt + MathUtils.random(-10, 10);
moonBlueprint.xTilt = xTilt + MathUtils.random(-10, 10);
moonBlueprint.angle = MathUtils.random(0, 360);
moonBlueprint.radius = MathUtils.random(100, 250);
int color = colors.random();
Orbiter moon = new Orbiter(createMoonSprite(MathUtils.random(16, 20) / (moonCount / 3 + 1)), moonBlueprint, color);
scene.addMoon(moon);
return moon;
}