Java Code Examples for com.badlogic.gdx.graphics.Color

The following are top voted examples for showing how to use com.badlogic.gdx.graphics.Color. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Mindustry   File: Maps.java   Source Code and License 11 votes vote down vote up
public Maps() {
	json.setOutputType(OutputType.json);
	json.setElementType(ArrayContainer.class, "maps", Map.class);
	json.setSerializer(Color.class, new ColorSerializer());
}
 
Example 2
Project: EarthInvadersGDX   File: MenuScreen.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 3
Project: JGame   File: LoadingScreen.java   Source Code and License 6 votes vote down vote up
@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));
	}

}
 
Example 4
Project: odb-little-fortune-planet   File: OdbFeatureScreen.java   Source Code and License 6 votes vote down vote up
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());
	}
 
Example 5
Project: ExamensArbeteTD   File: UIStageController.java   Source Code and License 6 votes vote down vote up
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);
	}
}
 
Example 6
Project: alquran-alkarem   File: GameActor.java   Source Code and License 6 votes vote down vote up
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_);

}
 
Example 7
Project: cocos2d-java   File: DrawNode.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 8
Project: enklave   File: ProgressBarEnergy.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 9
Project: enklave   File: ScreenSetting.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 10
Project: LD38-Compo   File: LudumDare38.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 11
Project: Mindustry   File: NuclearReactor.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 12
Project: Mindustry   File: Turret.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 13
Project: gdx-cclibs   File: ColorSerializer.java   Source Code and License 6 votes vote down vote up
@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);
    }

}
 
Example 14
Project: NoRiskNoFun   File: GameScene.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
}
 
Example 15
Project: Planet-Generator   File: ObjectGenerator.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 16
Project: KyperBox   File: GameObject.java   Source Code and License 5 votes vote down vote up
public GameObject() {
	controllers = new Array<GameObjectController>();
	sprite = NO_SPRITE;
	velocity = new Vector2();
	setOrigin(Align.center);
	debug_bounds = Color.YELLOW;
	flip_x = false;
	flip_y = false;
	ignore_collision = false;
	group = 1;
	filter = -1;
}
 
Example 17
Project: INFSEN01-2   File: Button.java   Source Code and License 5 votes vote down vote up
public Button(String text, Point top_left, Integer size, Color color, Float width, Float height, Runnable action) {
this.width = width;
this.height = height;
this.color = color;
       this.top_left = top_left;
       this.label = new Label(text, top_left, size, color);
this.action = action;
   }
 
Example 18
Project: cocos2d-java   File: DrawNode.java   Source Code and License 5 votes vote down vote up
public void drawRect(float fromX, float fromY, float toX, float toY, Color color) {
	if(!batchCommand) {	
		clear();
	}
	pushShapeCommandCell(DrawType.Rect, color, ShapeType.Line, lineWidth, 
			fromX, fromY, toX, toY);
}
 
Example 19
Project: school-game   File: CreateGameSlot.java   Source Code and License 5 votes vote down vote up
/**
 * Zeigt den Spielstarten Bildschirm an
 *
 * @param camera die aktuelle Kamera
 */
public void renderStart(OrthographicCamera camera)
{
    fontLayout.setText(font, localeBundle.format("hallo", saveData.getPlayerName(), saveData.isMale() ? "M" : "W"), Color.WHITE, camera.viewportWidth, Align.center, false);
    font.draw(batch, fontLayout, -camera.viewportWidth / 2, 100);

    fontLayout.setText(font, localeBundle.get("fertig1"), Color.WHITE, camera.viewportWidth, Align.center, false);
    font.draw(batch, fontLayout, -camera.viewportWidth / 2, 50);

    fontLayout.setText(font, localeBundle.get("fertig2"), Color.WHITE, camera.viewportWidth, Align.center, false);
    font.draw(batch, fontLayout, -camera.viewportWidth / 2, -50);
}
 
Example 20
Project: GDX-Engine   File: Monster.java   Source Code and License 5 votes vote down vote up
public Monster(IGameService services, Texture texture, int index) {
super(services);

color = Color.WHITE;

hitPoint = MaxHitPoint = GameSpecs.hitPoint[index];
bonus = GameSpecs.bonus[index];
speed = GameSpecs.speed[index];

this.region = new TextureRegion(texture);
region.setRegion(0, 0, REGION_WIDTH, REGION_HEIGHT);
this.path = new ArrayDeque<Path>(TowerDefenseScene.path);
target = path.pop();
x = target.x;
y = target.y;
direction = target.getDirection();
move(direction);
player = new AnimationPlayer(TowerDefenseScene.monsterAnimation) {

    @Override
    public void onFrameChanged() {
	region.setRegion(frameIndex * REGION_WIDTH, REGION_HEIGHT * direction.getIndex(), REGION_WIDTH,
		REGION_HEIGHT);
    }

    @Override
    public void onAnimationChanged() {
    }

    @Override
    public void onFinishedLooping() {
	// TODO Auto-generated method stub
	
    }
};
   }
 
Example 21
Project: school-game   File: CreateGameSlot.java   Source Code and License 5 votes vote down vote up
/**
 * Zeigt den Geschlechtsauswahl Bildschirm an
 *
 * @param camera die aktuelle Kamera
 */
public void renderGender(OrthographicCamera camera)
{
    Color maleColor;
    Color femaleColor;

    if (stateSwitch)
    {
        maleColor = Color.GREEN;
        femaleColor = Color.DARK_GRAY;
    } else {
        maleColor = Color.DARK_GRAY;
        femaleColor = Color.GREEN;
    }

    fontLayout.setText(font, localeBundle.get("geschlecht"), Color.WHITE, camera.viewportWidth, Align.center, false);
    font.draw(batch, fontLayout, -camera.viewportWidth / 2, camera.viewportHeight / 2 - 120);

    fontLayout.setText(font, localeBundle.get("frau"), femaleColor, camera.viewportWidth, Align.center, false);
    font.draw(batch, fontLayout, -camera.viewportWidth / 2, 30);

    fontLayout.setText(font, localeBundle.get("mann"), maleColor, camera.viewportWidth, Align.center, false);
    font.draw(batch, fontLayout, -camera.viewportWidth / 2, -30);

    fontLayout.setText(smallFont, localeBundle.get("enter_bestaetigen"), Color.WHITE, camera.viewportWidth, Align.center, false);
    smallFont.draw(batch, fontLayout, -camera.viewportWidth / 2, -camera.viewportHeight / 2 + 70);
}
 
Example 22
Project: summer17-android   File: PlayScreen.java   Source Code and License 5 votes vote down vote up
public PlayScreen(NoObjectionGame game) {
    atlas = new TextureAtlas("dudestuff3.pack");

    this.game = game;
    bg = new Texture("main_background.png");
    gameCam = new OrthographicCamera();
    gamePort = new FitViewport(NoObjectionGame.V_WIDTH / NoObjectionGame.PPM, NoObjectionGame.V_HEIGHT / NoObjectionGame.PPM, gameCam);
    hud = new Hud(game.batch);

    maploader = new TmxMapLoader();
    map = maploader.load("map1.tmx");
    renderer = new OrthoCachedTiledMapRenderer(map, 1 / NoObjectionGame.PPM);
    gameCam.position.set(gamePort.getWorldWidth() / 2, gamePort.getWorldHeight() / 2, 0);

    world = new World(new Vector2(0, -10), true);
    b2dr = new Box2DDebugRenderer();

    new B2WorldCreator(world, map);
    hero = new Hero(world, this);
    controller = new Controller();
    worldContactListener = new WorldContactListener();
    world.setContactListener(worldContactListener);

    //timer
    sb = new SpriteBatch();
    viewport = new FitViewport(NoObjectionGame.V_WIDTH, NoObjectionGame.V_HEIGHT, new OrthographicCamera());
    stage = new Stage(viewport, sb);
    table = new Table();
    table.top();
    table.setFillParent(true);
    countDownLabel = new Label(Float.toString(playTime), new Label.LabelStyle(new BitmapFont(), Color.WHITE));
    table.add(countDownLabel).expandX();
    stage.addActor(table);


}
 
Example 23
Project: cocos2d-java   File: DrawNode.java   Source Code and License 5 votes vote down vote up
public void drawDot(float x, float y, float radius, Color color) {
	if(!batchCommand) {	
		clear();
	}
	pushShapeCommandCell(DrawType.Dot, color, ShapeType.Filled, radius, 
			x, y);
}
 
Example 24
Project: MMORPG_Prototype   File: Monster.java   Source Code and License 5 votes vote down vote up
public Monster(Texture lookout, long id, PlayState playState, MonsterProperties properties)
{
    super(lookout, id, playState);
    linkedState = playState;
    font.setColor(new Color(1, 0, 0, 1));
    this.properties = properties;
}
 
Example 25
Project: Cubes   File: LogMenu.java   Source Code and License 5 votes vote down vote up
public LogMenu() {
  label = new Label("", new LabelStyle(Fonts.smallHUD, Color.BLACK));
  label.setWrap(true);
  Drawable background = new TextureRegionDrawable(Assets.getTextureRegion("core:hud/LogBackground.png"));
  scrollPane = new ScrollPane(label, new ScrollPaneStyle(background, null, null, null, null));
  scrollPane.setScrollingDisabled(true, false);
  back = MenuTools.getBackButton(this);
  
  stage.addActor(scrollPane);
  stage.addActor(back);
  
  refresh();
}
 
Example 26
Project: NoRiskNoFun   File: GameScene.java   Source Code and License 5 votes vote down vote up
@Override
public void preload() {

    clickedRegionLabel = new LabelSceneObject(sceneData.createLabel("Region: ", Assets.FONT_36PX_WHITE_WITH_BORDER));
    clickedRegionLabel.setBounds(0, 0, 500, 100);
    addSceneObject(clickedRegionLabel);

    GameObjectMap  gameObjectMap = new GameObjectMap(data.getMapAsset());
    regionMap = gameObjectMap.getRegionMap();
    regionNameMap = gameObjectMap.getRegionNameMap();
    troopIndicators = new HashMap<>();
    ownColor = new Color(data.getMyself().getColor());

    addSceneObject(gameObjectMap);
    addFiguresToStage();
    addInputListener();

    initTurnIndicator();
    initStateIndicator();
    initTroopIndicators();
    initDoneButton();

    for (Player player:data.getPlayers()) {
        Gdx.app.log(getClass().getSimpleName(), "Player Available: " + player.getPlayerName() + " Color: " + player.getColor());
    }

    Gdx.app.log(getClass().getSimpleName(), "Myself: " + data.getMyself().getPlayerName() + " Color: " + data.getMyself().getColor());

}
 
Example 27
Project: Catan   File: FishTradeWindow.java   Source Code and License 5 votes vote down vote up
private void initButton(Button b, int choiceNumber) {
    b.setColor(Color.BLUE);
    b.pad(5);
    b.pack();
    b.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            choice = choiceNumber;
            ableall();
            b.setDisabled(true);
        }
    });
}
 
Example 28
Project: EarthInvadersGDX   File: Particle.java   Source Code and License 5 votes vote down vote up
public Particle(float x, float y, int dir, int speed, long timeInMilliseconds, Color color, int size) {
    super(x, y);
    expireTime = System.currentTimeMillis() + timeInMilliseconds;
    if (timeInMilliseconds < 0)
        expireTime = -1;

    this.color = color;
    this.size = size;
    this.dir = dir;
    this.speed = speed;
}
 
Example 29
Project: cocos2d-java   File: DrawNode.java   Source Code and License 5 votes vote down vote up
public void drawSolidTriangle(float x0, float y0, float x1, float y1, float x2, float y2, Color color) {
	if(!batchCommand) {	
		clear();
	}
	pushShapeCommandCell(DrawType.Triange, color, ShapeType.Filled,
			lineWidth, x0, y0, x1, y1, x2, y2);
}
 
Example 30
Project: FlappySpinner   File: AssetsManager.java   Source Code and License 5 votes vote down vote up
private static void generateMediumFont(FreeTypeFontGenerator generator) {
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = Constants.MEDIUM_FONT_SIZE;
    parameter.borderColor = Color.BLACK;
    parameter.color =  Color.GOLD;
    parameter.hinting = FreeTypeFontGenerator.Hinting.None;
    parameter.borderWidth = 1;
    mediumFont = generator.generateFont(parameter);
    mediumFont.setUseIntegerPositions(false);
}
 
Example 31
Project: jenjin   File: Slot.java   Source Code and License 5 votes vote down vote up
public Slot (SlotData data, Bone bone) {
	if (data == null) throw new IllegalArgumentException("data cannot be null.");
	if (bone == null) throw new IllegalArgumentException("bone cannot be null.");
	this.data = data;
	this.bone = bone;
	color = new Color();
	setToSetupPose();
}
 
Example 32
Project: cocos2d-java   File: Node.java   Source Code and License 5 votes vote down vote up
protected void updateCascadeColor() {
	float r = 1, g = 1, b = 1;
	if(_parent != null && _parent.isCascadeColorEnabled()) {
		Color c = _parent.getDisplayedColor();
		r = c.r; g = c.g; b = c.b;
	}
	updateDisplayedColor(r, g, b);
}
 
Example 33
Project: MMORPG_Prototype   File: UserInterface.java   Source Code and License 5 votes vote down vote up
public void showTimedErrorMessage(String errorMessage, float timeout)
{
	Label label = new TimedLabel(errorMessage, timeout);
	label.setColor(Color.RED);
	label.setX(960);
	label.setY(55);

	stage.addActor(label);
}
 
Example 34
Project: cocos2d-java   File: Node.java   Source Code and License 5 votes vote down vote up
/**
* Change the color of node.
* @param color A Color3B color value.
*/
public void setColor(Color color) {
 _displayColor.r = _r = color.r;
 _displayColor.g = _g = color.g;
 _displayColor.b = _b = color.b;
 
 updateCascadeColor();
}
 
Example 35
Project: FlappyChapa   File: PlayState.java   Source Code and License 5 votes vote down vote up
public PlayState(GameStateManager gsm) {
        super(gsm);
        score = 0;
        chapa = new Chapa(50, 300);
        camera.setToOrtho(false, FlappyChapa.WIDTH / 2, FlappyChapa.HEIGHT / 2);
        Texture texture = new Texture("bg.png");
        backGround = new org.academiadecodigo.bootcamp.sprites.Background(camera);
        backGround.start();
        ground = new Texture("ground.png");
        /*table = new Table();
        table.setPosition(camera.position.x,camera.position.y);
        //table.setBounds(camera.position.x,camera.position.y,camera.viewportWidth,camera.viewportHeight/10);
        table.setFillParent(true);*/
        scoreLabel = new Label(String.format("%06d", score), new Label.LabelStyle(new BitmapFont(), Color.WHITE));
        scoreLabel.setPosition(camera.position.x,0);
        startTime = TimeUtils.nanoTime();
        anto = new Anto(camera);
//        groundPos1 = new Vector2(camera.position.x - camera.viewportWidth / 2, GROUND_Y_OFFSET);
//        groundPos2 = new Vector2((camera.position.x - camera.viewportWidth / 2) + ground.getWidth(), GROUND_Y_OFFSET);
        tubes = new Array<Tube>();
        for (int i = 0; i < TUBE_COUNT; i++) {
            tubes.add(new Tube(i * (TUBE_SPACING + Tube.TUBE_WIDTH)));
        }

        music = Gdx.audio.newMusic(Gdx.files.internal("bigSmoke_justAudio.mp3"));
        music.setLooping(true);
        music.setVolume(0.5f);
        music.play();
    }
 
Example 36
Project: Onyx   File: CrossFadeColorEffect.java   Source Code and License 5 votes vote down vote up
/**
 * @param configuration the configuration which drives the effect
 * @param source        the color to be manipulated
 */
public CrossFadeColorEffect(CrossFadeColorEffectConfiguration configuration, Color source) {
    this.source = source;
    this.cycle = CycleList.of(configuration.cycleColors);
    this.crossFadeTime = configuration.crossFadeTime;
    this.crossFadeDeltaTimeStepRequirement = configuration.crossFadeDeltaTimeStepRequirement;
    this.fadeInDeltaMultiplier = configuration.fadeInDeltaMultiplier;
    this.fadeOutDeltaMultiplier = configuration.fadeOutDeltaMultiplier;
}
 
Example 37
Project: cocos2d-java   File: NodeTests.java   Source Code and License 5 votes vote down vote up
public void onEnter() {
			super.onEnter();
			
			Node node = Sprite.create("powered.png");
			addChild(node);
			
			node.setOnTransformCallback((n)->{
//				System.out.println("updateTransform = " + node.getPosition());
			});
			
			DrawNode dn = new DrawNode();
			addChild(dn);
			
			node.setContentSize(100, 100);
			
			DrawNode debugDraw = (DrawNode) DrawNode.create().addTo(this);
			
			node.setOnUpdateCallback((n, t)->{
				Rect r = node.getBoundingBox();
				debugDraw.drawRect(r.x, r.y, r.x + r.width, r.y + r.height, null);
			});
			node.scheduleUpdate();
			node.setAnchorPoint(0f, 0f);
			node.runAction(MoveTo.create(2, 1000, 500));
			node.runAction(RotateBy.create(2, 1000));
			
			
//			node.runAction(Move.create(2, 0, 100));
//			node.runAction(MoveBy.create(0.5f, 500, 100));
			
			node.setColor(Color.RED);
			node.setOpacity(0.5f);
		}
 
Example 38
Project: Catan   File: SessionScreen.java   Source Code and License 5 votes vote down vote up
void initFishTable(Table fishTable) {
    oneFishCount = new Table(CatanGame.skin);
    twoFishCount = new Table(CatanGame.skin);
    threeFishCount  = new Table(CatanGame.skin);
    oneFishCountLabel = new Label("0",CatanGame.skin);
    twoFishCountLabel = new Label("0",CatanGame.skin);
    threeFishCountLabel = new Label("0",CatanGame.skin);

    oneFishCount.add(new Label("1 fish", CatanGame.skin)).row();
    twoFishCount.add(new Label("2 fish", CatanGame.skin)).row();
    threeFishCount.add(new Label("3 fish", CatanGame.skin)).row();
    oneFishCount.add(oneFishCountLabel).row();
    twoFishCount.add(twoFishCountLabel).row();
    threeFishCount.add(threeFishCountLabel).row();

    oneFishCount.setBackground(CatanGame.skin.newDrawable("white", Color.BLUE));
    twoFishCount.setBackground(CatanGame.skin.newDrawable("white", Color.BLUE));
    threeFishCount.setBackground(CatanGame.skin.newDrawable("white", Color.BLUE));

    fishTable.add(oneFishCount).width(60).height(60).pad(5);
    fishTable.add(twoFishCount).width(60).height(60).pad(5);
    fishTable.add(threeFishCount).width(60).height(60).pad(5);

    fishTable.setBackground("resTableBackground");
    fishTable.pad(10);
    fishTable.pack();
}
 
Example 39
Project: NoRiskNoFun   File: ChooseTroopAmountScene.java   Source Code and License 5 votes vote down vote up
public ChooseTroopAmountScene(SceneData sceneData){
    super(SceneNames.TROOP_AMOUNT_SCENE, Color.WHITE);
    this.sceneData = sceneData;
    this.data = sceneData.getGameData();
    this.buttonPressedSound = sceneData.createSound(Assets.BUTTON_PRESSED_SOUND_FILENAME);


}
 
Example 40
Project: Mindustry   File: PowerBooster.java   Source Code and License 5 votes vote down vote up
@Override
public void drawSelect(Tile tile){
	super.drawSelect(tile);

	Draw.color(Color.YELLOW);
	Draw.dashCircle(tile.worldx(), tile.worldy(), powerRange * Vars.tilesize);
	Draw.reset();
}