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

The following examples show how to use com.badlogic.gdx.graphics.Color#WHITE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShopCard.java    From Klooni1010 with GNU General Public License v3.0 6 votes vote down vote up
ShopCard(final Klooni game, final GameLayout layout,
         final String itemName, final Color backgroundColor) {
    this.game = game;
    Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.font = game.skin.getFont("font_small");

    priceLabel = new Label("", labelStyle);
    nameLabel = new Label(itemName, labelStyle);

    Color labelColor = Theme.shouldUseWhite(backgroundColor) ? Color.WHITE : Color.BLACK;
    priceLabel.setColor(labelColor);
    nameLabel.setColor(labelColor);

    priceBounds = new Rectangle();
    nameBounds = new Rectangle();

    layout.update(this);
}
 
Example 2
Source File: GdxCanvas.java    From seventh with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void drawImage(TextureRegion image, int x, int y, Integer color) {
    
    Color c= Color.WHITE;
    if (color != null) c = setTempColor(color);
    
    if(!isBegun) batch.begin(); 
    batch.setColor(c);        
    batch.draw(image, x, y);                
    if(!isBegun) batch.end();
}
 
Example 3
Source File: SuperSnake.java    From super-snake with MIT License 5 votes vote down vote up
@Override
public void create () {
	batch = new SpriteBatch();

       WIDTH = Gdx.graphics.getBackBufferWidth();
       HEIGHT = Gdx.graphics.getBackBufferHeight();

       PADDED_WIDTH = WIDTH - PADDING;
       PADDED_HEIGHT = HEIGHT - PADDING;

       Gdx.app.log("Snake", "VIEWPORT " + WIDTH + ", " + HEIGHT);

       shapeRenderer = new ShapeRenderer();

       snake = new Snake(WIDTH / 2, HEIGHT / 2, INITIAL_SNAKE_LENGTH);
       pause_snake = new Snake(WIDTH / 2, 200, 100);

       FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/PatrickHand.ttf"));
       FreeTypeFontParameter parameter = new FreeTypeFontParameter();
       parameter.size = 32;
       font = generator.generateFont(parameter);

       parameter.size = 52;
       parameter.borderColor = Colors.spray;
       parameter.borderWidth = 2;
       fontBtn = generator.generateFont(parameter);

       parameter.size = 80;
       parameter.color = Color.WHITE;
       parameter.borderWidth = 2;
       parameter.borderColor = Colors.red;
       fontBig = generator.generateFont(parameter);

       generator.dispose();
}
 
Example 4
Source File: InfoMenu.java    From Cubes with MIT License 5 votes vote down vote up
public InfoMenu(String labelText, boolean back) {
  super();
  text = new Label(labelText, new LabelStyle(Fonts.hud, Color.WHITE));
  text.setAlignment(Align.center, Align.center);
  stage.addActor(text);

  if (back) {
    button = MenuTools.getBackButton(this);
    stage.addActor(button);
  }
}
 
Example 5
Source File: SplashMenu.java    From Cubes with MIT License 5 votes vote down vote up
public SplashMenu() {
  logo = new Image(new TextureRegionDrawable(Assets.getTextureRegion("core:logo.png")), Scaling.fillY, Align.center);
  text = new Label("Loading " + Branding.DEBUG, new Label.LabelStyle(Fonts.smallHUD, Color.WHITE));

  stage.addActor(logo);
  stage.addActor(text);
}
 
Example 6
Source File: NoPageHint.java    From gdx-texture-packer-gui with Apache License 2.0 5 votes vote down vote up
public NoPageHint(Skin skin) {
    String text = App.inst().getI18n().get("atlasPreviewNoPageMsg");

    Label lblMessage = new Label(text, new Label.LabelStyle(skin.getFont("default-font"), Color.WHITE));
    lblMessage.setAlignment(Align.center);
    lblMessage.getColor().a = 0.25f;
    setActor(lblMessage);

    setFillParent(true);
    align(Align.center);
    setTouchable(Touchable.disabled);
    setBackground(skin.getDrawable("noPreviewFill"));
}
 
Example 7
Source File: GradientEffect.java    From typing-label with MIT License 5 votes vote down vote up
@Override
protected void onApply(TypingGlyph glyph, int localIndex, float delta) {
    // Calculate progress
    float distanceMod = (1f / distance) * (1f - DEFAULT_DISTANCE);
    float frequencyMod = (1f / frequency) * DEFAULT_FREQUENCY;
    float progress = calculateProgress(frequencyMod, distanceMod * localIndex, true);

    // Calculate color
    if(glyph.color == null) glyph.color = new Color(Color.WHITE);
    glyph.color.set(color1).lerp(color2, progress);
}
 
Example 8
Source File: BlinkEffect.java    From typing-label with MIT License 5 votes vote down vote up
public BlinkEffect(TypingLabel label, String[] params) {
    super(label);

    // Color 1
    if(params.length > 0) {
        this.color1 = paramAsColor(params[0]);
    }

    // Color 2
    if(params.length > 1) {
        this.color2 = paramAsColor(params[1]);
    }

    // Frequency
    if(params.length > 2) {
        this.frequency = paramAsFloat(params[2], 1);
    }

    // Threshold
    if(params.length > 3) {
        this.threshold = paramAsFloat(params[3], 0.5f);
    }

    // Validate parameters
    if(this.color1 == null) this.color1 = new Color(Color.WHITE);
    if(this.color2 == null) this.color2 = new Color(Color.WHITE);
    this.threshold = MathUtils.clamp(this.threshold, 0, 1);
}
 
Example 9
Source File: BlinkEffect.java    From typing-label with MIT License 5 votes vote down vote up
@Override
protected void onApply(TypingGlyph glyph, int localIndex, float delta) {
    // Calculate progress
    float frequencyMod = (1f / frequency) * DEFAULT_FREQUENCY;
    float progress = calculateProgress(frequencyMod);

    // Calculate color
    if(glyph.color == null) glyph.color = new Color(Color.WHITE);
    glyph.color.set(progress <= threshold ? color1 : color2);
}
 
Example 10
Source File: ColorFadeTransition.java    From libgdx-transitions with Apache License 2.0 5 votes vote down vote up
/** @param color the {@link Color} to fade to
 * @param interpolation the {@link Interpolation} method */
public ColorFadeTransition (Color color, Interpolation interpolation) {
	this.color = new Color(Color.WHITE);
	this.interpolation = interpolation;

	texture = new Texture(1, 1, Format.RGBA8888);
	Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888);
	pixmap.setColor(color);
	pixmap.fillRectangle(0, 0, 1, 1);
	texture.draw(pixmap, 0, 0);
}
 
Example 11
Source File: Map.java    From riiablo with Apache License 2.0 4 votes vote down vote up
public static Color getColor(DS1.Cell cell) {
  if (cell == null) return Color.WHITE;
  return getColor(cell.mainIndex);
}
 
Example 12
Source File: ShopScreen.java    From Unlucky with MIT License 4 votes vote down vote up
/**
 * Creates the shop UI with a tabbed interface and scroll panes
 */
private void createShopUI() {
    shop = new Shop(rm);

    shopTable = new Table();
    shopTable.setSize(93, 80);
    shopTable.setPosition(14, 26);

    // create tabs
    HorizontalGroup tabGroup = new HorizontalGroup();
    tabGroup.setTransform(false);
    TextButton.TextButtonStyle tabStyle = new TextButton.TextButtonStyle();
    tabStyle.font = rm.pixel10;
    tabStyle.fontColor = Color.WHITE;
    tabStyle.up = new TextureRegionDrawable(rm.shoptab[1][0]);
    tabStyle.checked = new TextureRegionDrawable(rm.shoptab[0][0]);

    final TextButton[] tabButtons = new TextButton[3];
    String[] tabStrs = new String[] { "MISC", "EQUIPS", "ACCS" };
    ButtonGroup tabs = new ButtonGroup();
    tabs.setMinCheckCount(1);
    tabs.setMaxCheckCount(1);
    for (int i = 0; i < 3; i++) {
        tabButtons[i] = new TextButton(tabStrs[i], tabStyle);
        tabButtons[i].getLabel().setFontScale(0.5f);
        tabs.add(tabButtons[i]);
        tabGroup.addActor(tabButtons[i]);
    }
    shopTable.add(tabGroup);
    shopTable.row();

    // tab contents
    Stack content = new Stack();
    createTabContents();
    for (int i = 0; i < 3; i++) {
        content.addActor(tabContents[i]);
    }
    shopTable.add(content).expand().fill();
    tabContents[0].setVisible(true);
    tabContents[1].setVisible(false);
    tabContents[2].setVisible(false);

    // show the correct content for each tab
    for (int i = 0; i < 3; i++) {
        final int index = i;
        tabButtons[i].addListener(new ChangeListener() {
            @Override
            public void changed(ChangeEvent event, Actor actor) {
                if (!game.player.settings.muteSfx) rm.buttonclick1.play(game.player.settings.sfxVolume);
                tabContents[index].setVisible(tabButtons[index].isChecked());
            }
        });
    }

    stage.addActor(shopTable);
}
 
Example 13
Source File: MainMenuScreen.java    From Bomberman_libGdx with MIT License 4 votes vote down vote up
@Override
public void show() {
    viewport = new FitViewport(640, 480);
    stage = new Stage(viewport, batch);

    font = new BitmapFont(Gdx.files.internal("fonts/foo.fnt"));

    Label.LabelStyle labelStyle = new Label.LabelStyle(font, Color.WHITE);

    Label titleLabel = new Label("Bomberman", labelStyle);
    titleLabel.setFontScale(1.6f);
    titleLabel.setPosition(140, 360);

    Label easyLabel = new Label("Easy", labelStyle);
    easyLabel.setPosition((640 - easyLabel.getWidth()) / 2, 240);

    Label normalLabel = new Label("Normal", labelStyle);
    normalLabel.setPosition((640 - normalLabel.getWidth()) / 2, 180);

    Label hardLabel = new Label("Hard", labelStyle);
    hardLabel.setPosition((640 - hardLabel.getWidth()) / 2, 120);

    Pixmap pixmap = new Pixmap(640, 480, Pixmap.Format.RGB888);
    pixmap.setColor(240.0f / 255.0f, 128 / 255.0f, 0, 1.0f);
    pixmap.fill();
    backgroundTexture = new Texture(pixmap);
    pixmap.dispose();
    Image background = new Image(backgroundTexture);

    indicatorX = 160f;
    indicatorY = 240f;

    TextureAtlas textureAtlas = GameManager.getInstance().getAssetManager().get("img/actors.pack", TextureAtlas.class);
    indicator0 = new Image(new TextureRegion(textureAtlas.findRegion("MainMenuLogo"), 0, 0, 40, 26));
    indicator0.setSize(80f, 52f);
    indicator0.setPosition(indicatorX, indicatorY);

    indicator1 = new Image(new TextureRegion(textureAtlas.findRegion("MainMenuLogo"), 40, 0, 40, 26));
    indicator1.setSize(80f, 52f);
    indicator1.setPosition(indicatorX, indicatorY);
    indicator1.setVisible(false);
    
    indicationsTexture = new Texture("img/indications.png");
    indications = new Image(indicationsTexture);
    indications.setPosition(640f - indications.getWidth() - 12f, 12f);

    stage.addActor(background);
    stage.addActor(indications);
    stage.addActor(titleLabel);
    stage.addActor(easyLabel);
    stage.addActor(normalLabel);
    stage.addActor(hardLabel);
    stage.addActor(indicator0);
    stage.addActor(indicator1);

    currentSelection = 0;
    selected = false;
    
    GameManager.getInstance().playMusic("SuperBomberman-Title.ogg", true);
}
 
Example 14
Source File: InputPanel.java    From bladecoder-adventure-engine with Apache License 2.0 4 votes vote down vote up
public void setError(boolean value) {
	if (value)
		title.getStyle().fontColor = Color.RED;
	else
		title.getStyle().fontColor = Color.WHITE;
}
 
Example 15
Source File: PlayScreen.java    From Pacman_libGdx with MIT License 4 votes vote down vote up
@Override
public void show() {
    camera = new OrthographicCamera();
    viewport = new FitViewport(WIDTH, HEIGHT, camera);
    camera.translate(WIDTH / 2, HEIGHT / 2);
    camera.update();

    batch = new SpriteBatch();

    playerSystem = new PlayerSystem();
    ghostSystem = new GhostSystem();
    movementSystem = new MovementSystem();
    pillSystem = new PillSystem();
    animationSystem = new AnimationSystem();
    renderSystem = new RenderSystem(batch);
    stateSystem = new StateSystem();

    engine = new Engine();
    engine.addSystem(playerSystem);
    engine.addSystem(ghostSystem);
    engine.addSystem(pillSystem);
    engine.addSystem(movementSystem);
    engine.addSystem(stateSystem);
    engine.addSystem(animationSystem);
    engine.addSystem(renderSystem);

    // box2d
    world = new World(Vector2.Zero, true);
    world.setContactListener(new WorldContactListener());
    box2DDebugRenderer = new Box2DDebugRenderer();
    showBox2DDebuggerRenderer = false;

    // box2d light
    rayHandler = new RayHandler(world);
    rayHandler.setAmbientLight(ambientLight);

    // load map
    tiledMap = new TmxMapLoader().load("map/map.tmx");
    tiledMapRenderer = new OrthogonalTiledMapRenderer(tiledMap, 1 / 16f, batch);

    new WorldBuilder(tiledMap, engine, world, rayHandler).buildAll();

    stageViewport = new FitViewport(WIDTH * 20, HEIGHT * 20);
    stage = new Stage(stageViewport, batch);

    font = new BitmapFont(Gdx.files.internal("fonts/army_stencil.fnt"));
    Label.LabelStyle labelStyle = new Label.LabelStyle(font, Color.WHITE);

    Label scoreTextLabel = new Label("SCORE", labelStyle);
    scoreTextLabel.setPosition(WIDTH * 1, HEIGHT * 19);
    stage.addActor(scoreTextLabel);

    Label hightScoreTextLabel = new Label("High Score", labelStyle);
    hightScoreTextLabel.setPosition(WIDTH * 14, HEIGHT * 19);
    stage.addActor(hightScoreTextLabel);

    scoreLabel = new Label("0", labelStyle);
    scoreLabel.setPosition(WIDTH * 1.5f, HEIGHT * 18.2f);
    stage.addActor(scoreLabel);

    highScoreLabel = new Label("0", labelStyle);
    highScoreLabel.setPosition(WIDTH * 16.5f, HEIGHT * 18.2f);
    stage.addActor(highScoreLabel);

    gameOverLabel = new Label("              - Game Over -\n Press Enter to continue", labelStyle);
    gameOverLabel.setPosition(WIDTH * 4.3f, HEIGHT * 9f);
    gameOverLabel.setVisible(false);
    stage.addActor(gameOverLabel);

    TextureAtlas textureAtlas = GameManager.instance.assetManager.get("images/actors.pack", TextureAtlas.class);
    pacmanSprite = new Sprite(new TextureRegion(textureAtlas.findRegion("Pacman"), 16, 0, 16, 16));
    pacmanSprite.setBounds(8f, 21.5f, 16 / GameManager.PPM, 16 / GameManager.PPM);

    stringBuilder = new StringBuilder();

    changeScreen = false;
}
 
Example 16
Source File: SMGUIManager.java    From Entitas-Java with MIT License 4 votes vote down vote up
public Skin createSkin(BaseAssetsManager assetsManager) {
    defaultFont = assetsManager.getFont(DEFAULT_FONT);
    defaultFont.getData().setScale(ScaleUtil.getSizeRatio());
    defaultFont.setUseIntegerPositions(false);
    font2 = assetsManager.getFont(HEADER_FONT);
    font2.getData().setScale(ScaleUtil.getSizeRatio());
    font2.setUseIntegerPositions(false);

    skin.add("default", defaultFont);
    skin.add("header", font2);

    skin.add("lt-blue", new Color(.62f, .76f, .99f, 1f));
    skin.add("lt-green", new Color(.39f, .9f, .6f, 1f));
    skin.add("dark-blue", new Color(.79f, .95f, 91f, 1f));

    skin.addRegions(assetsManager.getTextureAtlas(GUI_ATLAS));
    skin.addRegions(assetsManager.getTextureAtlas(GUI_PACK_ATLAS));


    TextureRegionDrawable touchpad_background = new TextureRegionDrawable(((TextureAtlas) assetsManager.getTextureAtlas(GUI_ATLAS)).findRegion("touchpad_background"));
    TextureRegionDrawable touchpad_thumb = new TextureRegionDrawable(((TextureAtlas) assetsManager.getTextureAtlas(GUI_ATLAS)).findRegion("touchpad_thumb"));


    TextureRegionDrawable checkox_true = new TextureRegionDrawable(((TextureAtlas) assetsManager.getTextureAtlas(UISKIN_ATLAS)).findRegion("check-on"));

    TextureRegionDrawable checkox_false = new TextureRegionDrawable(((TextureAtlas) assetsManager.getTextureAtlas(UISKIN_ATLAS)).findRegion("check-off"));

    TextureRegionDrawable slider_knob = new TextureRegionDrawable(((TextureAtlas) assetsManager.getTextureAtlas(UISKIN_ATLAS)).findRegion("default-slider-knob"));
    TextureRegionDrawable slider = new TextureRegionDrawable(((TextureAtlas) assetsManager.getTextureAtlas(UISKIN_ATLAS)).findRegion("default-slider"));

    CheckBox.CheckBoxStyle checkBoxStyle = new CheckBox.CheckBoxStyle(checkox_false, checkox_true, defaultFont, Color.WHITE);


    SpriteDrawable stats = new SpriteDrawable(new Sprite((Texture) assetsManager.getTexture(STATS_BACKGROUND)));


    Slider.SliderStyle sliderStyle = new Slider.SliderStyle(slider, slider_knob);
    skin.add("default", new Window.WindowStyle(font2, Color.ORANGE, skin.getDrawable("debug")));
    skin.add("stats", stats);


    Label.LabelStyle lbs = new Label.LabelStyle();
    lbs.font = defaultFont;
    lbs.fontColor = Color.WHITE;
    skin.add("default", lbs);

    Label.LabelStyle lbsHeader = new Label.LabelStyle();
    lbsHeader.font = font2;
    lbsHeader.fontColor = Color.WHITE;
    skin.add("header", lbsHeader);

    TextButton.TextButtonStyle tbs = new TextButton.TextButtonStyle(skin.getDrawable("btnMenu"), skin.getDrawable("btnMenuPress"), skin.getDrawable("btnMenu"), defaultFont);
    tbs.fontColor = skin.getColor("dark-blue");
    tbs.pressedOffsetX = Math.round(1f * Gdx.graphics.getDensity());
    tbs.pressedOffsetY = tbs.pressedOffsetX * -1f;

    ImageButton.ImageButtonStyle ImageButtonLeft = new ImageButton.ImageButtonStyle(skin.getDrawable("buttonLeft"), skin.getDrawable("buttonLeftPress"),
            skin.getDrawable("buttonLeft"), null, null, null);
    ImageButton.ImageButtonStyle ImageButtonRight = new ImageButton.ImageButtonStyle(skin.getDrawable("buttonRight"), skin.getDrawable("buttonRightPress"),
            skin.getDrawable("buttonRight"), null, null, null);
    ImageButton.ImageButtonStyle ImageButtonUp = new ImageButton.ImageButtonStyle(skin.getDrawable("buttonUp"), skin.getDrawable("buttonUpPress"),
            skin.getDrawable("buttonUp"), null, null, null);


    Touchpad.TouchpadStyle touchpadStyle = new Touchpad.TouchpadStyle();
    touchpadStyle.background = touchpad_background;
    touchpadStyle.knob = touchpad_thumb;


    skin.add("default", tbs);
    skin.add("buttonLeft", ImageButtonLeft);
    skin.add("buttonRight", ImageButtonRight);
    skin.add("buttonUp", ImageButtonUp);
    skin.add("default", touchpadStyle);
    skin.add("default", checkBoxStyle);
    skin.add("default-horizontal", sliderStyle);

    return skin;
}
 
Example 17
Source File: ServerConnectGUI.java    From Radix with MIT License 4 votes vote down vote up
@Override
public void init() {
    stage = new Stage();

    // TODO memory manage

    background = new Texture(Gdx.files.internal("textures/block/obsidian.png"));
    background.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);

    errorLabel = new Label(null, new LabelStyle(new BitmapFont(), Color.RED));

    TextFieldStyle fieldStyle = new TextFieldStyle();
    fieldStyle.font = new BitmapFont();
    fieldStyle.fontColor = Color.WHITE;
    TextField ipField = new TextField("IP:Port", fieldStyle);

    ImageTextButtonStyle btnStyle = RadixClient.getInstance().getSceneTheme().getButtonStyle();

    TextButton connectButton = new TextButton("Connect", btnStyle);
    connectButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            String[] ipPort = ipField.getText().split(":");

            if(ipPort.length != 2) {
                invalidIpSyntax();
                return;
            }

            try {
                RadixClient.getInstance().enterRemoteWorld(ipPort[0], Short.parseShort(ipPort[1]));
            } catch (NumberFormatException ex) {
                invalidPort();
            }
        }
    });

    Table table = new Table();
    table.setFillParent(true);
    table.add(ipField);
    table.row();
    table.add(errorLabel);
    table.row();
    table.add(connectButton);
    stage.addActor(table);
}
 
Example 18
Source File: Main.java    From graphicsfuzz with Apache License 2.0 4 votes vote down vote up
@Override
public void create() {

  if(this.overrideLogger != null){
    Gdx.app.setApplicationLogger(overrideLogger);
  }

  // Only DesktopLauncher sets this.
  if(gl30 == null) {
    // Gdx.gl30 could also be null though.
    gl30 = Gdx.gl30;
  }

  Gdx.graphics.getGL20().glEnable(GL20.GL_TEXTURE_2D);
  Gdx.graphics.getGL20().glEnable(GL20.GL_DEPTH_TEST);
  Gdx.graphics.getGL20().glDepthFunc(GL20.GL_LESS);

  standardMesh = buildFullScreenQuadMesh();

  if(standaloneRenderJob != null) {
    if (standaloneRenderJob.isSetComputeSource()) {
      updateState(WorkerState.COMPUTE_STANDALONE_PREPARE);
    } else {
      updateState(WorkerState.IMAGE_STANDALONE_PREPARE);
    }
    return;
  }

  PlatformInfoUtil.getPlatformDetails(platformInfoJson);
  PlatformInfoUtil.getGlVersionInfo(platformInfoJson, gl30);

  sanityReferenceImage = createPixelBuffer();
  sanityCheckImage = createPixelBuffer();
  sanityCheckImageTmp = createPixelBuffer();

  GdxStage = new Stage(new ScreenViewport());
  Label.LabelStyle label1Style = new Label.LabelStyle();
  label1Style.font = new BitmapFont();
  label1Style.fontColor = Color.WHITE;

  DisplayContent = new StringBuilder();
  DisplayLabel = new Label(DisplayContent.toString(), label1Style);
  DisplayLabel.setPosition(WIDTH + DISPLAY_TXT_MARGIN, 0);
  DisplayLabel
      .setSize(Gdx.graphics.getWidth() - WIDTH - DISPLAY_TXT_MARGIN - 10, Gdx.graphics.getHeight() - 10);
  DisplayLabel.setAlignment(Align.topLeft);
  DisplayContent = new StringBuilder();
  GdxStage.addActor(DisplayLabel);
}
 
Example 19
Source File: LoadGameResourcesState.java    From dice-heroes with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Color getBackgroundColor() {
    return Color.WHITE;
}
 
Example 20
Source File: VisualComponent.java    From xibalba with MIT License 2 votes vote down vote up
/**
 * Visual component, what's rendered.
 *
 * @param sprite   Sprite to render
 * @param position Where to render it
 */
public VisualComponent(Sprite sprite, Vector2 position) {
  this(sprite, position, Color.WHITE, 1f);
}