Example usage for com.badlogic.gdx.graphics Color BLACK

List of usage examples for com.badlogic.gdx.graphics Color BLACK

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics Color BLACK.

Prototype

Color BLACK

To view the source code for com.badlogic.gdx.graphics Color BLACK.

Click Source Link

Usage

From source file:de.bitbrain.craft.graphics.ScreenFader.java

License:Open Source License

private void init() {
    if (sprite == null) {
        sprite = new Sprite(GraphicsFactory.createTexture(16, 16, Color.BLACK));
    }
}

From source file:de.bitbrain.craft.graphics.UIRenderer.java

License:Open Source License

public UIRenderer(int width, int height, Viewport viewport, Batch batch) {
    SharedInjector.get().injectMembers(this);
    this.batch = batch;
    blurHandler = new GaussianBlur(this);
    buffer = new FrameBuffer(Format.RGBA8888, width, height, false);
    baseStage = new InputEventProcessor(viewport, batch);
    overlayStage = new InputEventProcessor(viewport, batch);
    cliStage = new InputEventProcessor(viewport, batch);
    baseStage.getViewport().setCamera(camera);
    overlayStage.getViewport().setCamera(camera);
    cliStage.getViewport().setCamera(camera);
    cliStage.addActor(cli);//ww  w.j a  v  a 2s  .  c o  m
    eventBus.subscribe(baseStage);
    eventBus.subscribe(overlayStage);
    eventBus.subscribe(this);
    overlay = new Sprite(GraphicsFactory.createTexture(16, 16, Color.BLACK));
    overlay.setAlpha(0f);
}

From source file:de.fgerbig.spacepeng.screens.SplashScreen.java

License:Open Source License

@Override
public void render(float delta) {
    SpacePeng.glClear();/* w w w  .j a va2s  .com*/

    // we tell the batch to draw the region starting at (0, 0) of the
    // lower-left corner with the size of the screen
    SpriteBatch batch = game.getSpriteBatch();
    batch.begin();
    batch.draw(splashTexture, 0, 0, Const.WIDTH, Const.HEIGHT);
    batch.end();

    // draw progress bar
    shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
    shapeRenderer.setColor(Color.BLACK);
    shapeRenderer.rect(0, 0, Const.WIDTH, PROGRESSBAR_HEIGHT);
    shapeRenderer.setColor(PROGRESSBAR_COLOR);
    shapeRenderer.rect(0, 0, (int) (Const.WIDTH * SpacePeng.assetManager.getProgress()), PROGRESSBAR_HEIGHT);
    shapeRenderer.end();

    if (finished) {
        return;
    }

    finished = SpacePeng.assetManager.update();

    if (finished) {
        Gdx.app.log(Const.NAME, "Finished loading with asset manager.");
        game.initAssets();
        SpacePeng.soundManager.play(SoundKey.BOING);
        game.setScreenWithTransition(new MenuScreen(game));
    }
}

From source file:de.gebatzens.meteva.MarketLevel.java

License:Open Source License

public void render() {
    Color nc = new Color(1, 1, 1, 1).sub(color);
    nc.a = 0.6f;//ww w  .j av a 2 s. c o m
    GScout.drawBoxBorder(x, y, GScout.width * 0.25f, GScout.height * 0.08f, GScout.width * 0.005f, color,
            color.cpy().mul(new Color(0.5f, 0.5f, 0.5f, 1f)));
    GScout.batch.setColor(nc);
    GScout.drawBoxBorder(x, y, GScout.width * 0.25f * ((float) GScout.mprof.get(id) / (float) mlevel),
            GScout.height * 0.08f, GScout.width * 0.005f, nc, nc.cpy().mul(new Color(0.5f, 0.5f, 0.5f, 1f)));

    GScout.survivant.setColor(Color.BLACK);
    GScout.setFontSize(GScout.width * 0.04f);
    GScout.drawText(GScout.mprof.get(id) + "", x, y + GScout.height * 0.1f, true);

}

From source file:de.hasait.tanks.util.common.Abstract2DScreen.java

License:Apache License

protected Abstract2DScreen(final C pContext, final int pViewportW, final int pViewportH) {
    super();//from w ww .java 2 s .  c  o m

    _context = pContext;

    _viewportW = pViewportW;
    _viewportH = pViewportH;
    _viewportR = new Rectangle(0, 0, _viewportW, _viewportH);

    _camera = new OrthographicCamera();
    _backgroundColor = Color.BLACK;
    _stage = new Stage(new ScalingViewport(Scaling.fit, _viewportW, _viewportH, _camera), _context.getBatch());
    _inputMultiplexer.addProcessor(_stage);
}

From source file:de.longri.cachebox3.develop.tools.skin_editor.actors.OptionsPane.java

License:Apache License

/**
 *
 *///ww w  . j  a va2s  .co  m
private void updateTableFields(final String style) {

    ImageButton button = (ImageButton) game.screenMain.barWidgets.group.getChecked();
    String widget = button.getUserObject().toString();

    Gdx.app.log("OptionsPane", "Update fields table for widget: " + widget + ", style: " + style);
    tableFields.clear();
    tableFields.add(new Label("Name", game.skin, "title")).left().width(170);
    tableFields.add(new Label("Value", game.skin, "title")).left().width(60).padRight(50);
    tableFields.row();

    Field[] fields = ClassReflection.getFields(currentStyle.getClass());
    for (final Field field : fields) {
        try {

            Actor actor = null;

            // field type
            String name = field.getType().getSimpleName();
            Object obj = field.get(currentStyle);

            if (name.equals("Drawable")) {

                /**
                 * Handle Drawable object
                 */

                Drawable drawable = (Drawable) field.get(currentStyle);
                String resourceName = "";
                ImageTextButton.ImageTextButtonStyle buttonStyle = new ImageTextButton.ImageTextButtonStyle(
                        game.skin.getDrawable("default-round"), game.skin.getDrawable("default-round-down"),
                        game.skin.getDrawable("default-round"), game.skin.getFont("default-font"));

                if (drawable != null) {
                    resourceName = game.skinProject.resolveObjectName(Drawable.class, drawable);
                    if (resourceName == null) {
                        resourceName = game.skinProject.resolveObjectName(TextureRegion.class, drawable);
                    }
                    buttonStyle.imageUp = drawable;
                } else {
                    buttonStyle.up = game.skin.getDrawable("default-rect");
                    buttonStyle.checked = game.skin.getDrawable("default-rect");
                }

                actor = new ImageTextButton(resourceName, buttonStyle);
                ((ImageTextButton) actor).setClip(true);
                actor.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeEvent event, Actor actor) {
                        showDrawableDialog(field, false);

                    }

                });

            } else if (name.equals("Bitmap")) {

                /**
                 * Handle Bitmap object
                 */

                Bitmap bitmap = (Bitmap) field.get(currentStyle);
                byte[] bytes = null;
                if (bitmap != null)
                    bytes = bitmap.getPngEncodedData();
                Drawable drawable = bitmap != null
                        ? new TextureRegionDrawable(
                                new TextureRegion(new Texture(new Pixmap(bytes, 0, bytes.length))))
                        : null;

                String resourceName = "";
                ImageTextButton.ImageTextButtonStyle buttonStyle = new ImageTextButton.ImageTextButtonStyle(
                        game.skin.getDrawable("default-round"), game.skin.getDrawable("default-round-down"),
                        game.skin.getDrawable("default-round"), game.skin.getFont("default-font"));

                if (drawable != null) {
                    resourceName = ((GetName) bitmap).getName();
                    buttonStyle.imageUp = drawable;
                } else {
                    buttonStyle.up = game.skin.getDrawable("default-rect");
                    buttonStyle.checked = game.skin.getDrawable("default-rect");
                }

                actor = new ImageTextButton(resourceName, buttonStyle);
                ((ImageTextButton) actor).setClip(true);
                actor.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeEvent event, Actor actor) {
                        showDrawableDialog(field, true);

                    }

                });

            } else if (name.equals("Color")) {

                /**
                 * Handle Color object
                 */
                Color color = (Color) field.get(currentStyle);
                ImageTextButton.ImageTextButtonStyle buttonStyle = new ImageTextButton.ImageTextButtonStyle(
                        game.skin.getDrawable("default-round"), game.skin.getDrawable("default-round-down"),
                        game.skin.getDrawable("default-round"), game.skin.getFont("default-font"));

                String resourceName = "";
                if (color != null) {

                    if (color instanceof SkinColor) {
                        resourceName = ((SkinColor) color).skinName;
                    } else {
                        resourceName = game.skinProject.resolveObjectName(SkinColor.class, color);
                    }

                    resourceName += " (" + color.toString() + ")";

                    // Create drawable on the fly
                    Pixmap pixmap = new Pixmap(18, 18, Pixmap.Format.RGBA8888);
                    pixmap.setColor(color);
                    pixmap.fill();
                    pixmap.setColor(Color.BLACK);
                    pixmap.drawRectangle(0, 0, 18, 18);
                    Texture texture = new Texture(pixmap);
                    buttonStyle.imageUp = new SpriteDrawable(new Sprite(texture));
                    pixmap.dispose();
                } else {
                    buttonStyle.up = game.skinProject.getDrawable("default-rect");
                    buttonStyle.checked = game.skinProject.getDrawable("default-rect");
                }

                actor = new ImageTextButton(resourceName, buttonStyle);
                ((ImageTextButton) actor).setClip(true);
                actor.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeEvent event, Actor actor) {
                        showColorPickerDialog(field);

                    }

                });

            } else if (name.equals("BitmapFont")) {

                /**
                 * Handle BitmapFont object
                 */

                BitmapFont font = (BitmapFont) field.get(currentStyle);
                String resourceName = "";
                ImageTextButton.ImageTextButtonStyle buttonStyle = new ImageTextButton.ImageTextButtonStyle(
                        game.skin.getDrawable("default-round"), game.skin.getDrawable("default-round-down"),
                        game.skin.getDrawable("default-round"), game.skin.getFont("default-font"));

                if (font != null) {
                    resourceName = game.skinProject.resolveObjectName(BitmapFont.class, font);
                    buttonStyle.font = font;
                } else {
                    buttonStyle.up = game.skinProject.getDrawable("default-rect");
                    buttonStyle.checked = game.skinProject.getDrawable("default-rect");
                }

                actor = new ImageTextButton(resourceName, buttonStyle);
                ((ImageTextButton) actor).setClip(true);

                actor.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeEvent event, Actor actor) {
                        showFontPickerDialog(field);

                    }

                });

            } else if (name.equals("float")) {

                /**
                 * Handle Float object
                 */

                Float value = (Float) field.get(currentStyle);
                String resourceName = "";

                ImageTextButton.ImageTextButtonStyle buttonStyle = new ImageTextButton.ImageTextButtonStyle(
                        game.skin.getDrawable("default-round"), game.skin.getDrawable("default-round-down"),
                        game.skin.getDrawable("default-round"), game.skin.getFont("default-font"));

                if ((value != null) && (value != 0)) {
                    resourceName = String.valueOf(value);
                } else {
                    buttonStyle.up = game.skinProject.getDrawable("default-rect");
                    buttonStyle.checked = game.skinProject.getDrawable("default-rect");
                }

                actor = new ImageTextButton(resourceName, buttonStyle);
                ((ImageTextButton) actor).setClip(true);
                actor.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeEvent event, Actor actor) {
                        showFloatInputDialog(field);

                    }

                });

            } else if (name.equals("ListStyle")) {

                /**
                 * Handle ListStyle object
                 */
                ListStyle listStyle = (ListStyle) field.get(currentStyle);

                actor = new SelectBox<String>(game.skin, "default");
                Array<String> items = new Array<String>();

                final ObjectMap<String, ListStyle> values = game.skinProject.getAll(ListStyle.class);
                Iterator<String> it = values.keys().iterator();
                String selection = null;

                while (it.hasNext()) {
                    String key = it.next();
                    items.add(key);

                    if (listStyle == values.get(key)) {
                        selection = key;
                    }
                }

                ((SelectBox) actor).setItems(items);

                if (selection != null) {
                    ((SelectBox) actor).setSelected(selection);
                }

                actor.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeEvent event, Actor actor) {

                        String selection = (String) ((SelectBox) actor).getSelected();
                        try {
                            field.set(currentStyle, values.get(selection));
                        } catch (Exception e) {
                            e.printStackTrace();
                        }

                        game.screenMain.saveToSkin();
                        refresh(true);
                        game.screenMain.paneOptions.updateSelectedTableFields();
                        game.screenMain.panePreview.refresh();
                    }

                });

            } else if (name.equals("ScrollPaneStyle")) {

                /**
                 * Handle ListStyle object
                 */
                ScrollPaneStyle scrollStyle = (ScrollPaneStyle) field.get(currentStyle);

                actor = new SelectBox<String>(game.skin, "default");
                Array<String> items = new Array<String>();

                final ObjectMap<String, ScrollPaneStyle> values = game.skinProject
                        .getAll(ScrollPaneStyle.class);
                Iterator<String> it = values.keys().iterator();
                String selection = null;

                while (it.hasNext()) {
                    String key = it.next();
                    items.add(key);

                    if (scrollStyle == values.get(key)) {
                        selection = key;
                    }
                }

                ((SelectBox) actor).setItems(items);

                if (selection != null) {
                    ((SelectBox) actor).setSelected(selection);
                }

                actor.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeEvent event, Actor actor) {

                        String selection = (String) ((SelectBox) actor).getSelected();
                        try {
                            field.set(currentStyle, values.get(selection));
                        } catch (Exception e) {
                            e.printStackTrace();
                        }

                        game.screenMain.saveToSkin();
                        refresh(true);
                        game.screenMain.paneOptions.updateSelectedTableFields();
                        game.screenMain.panePreview.refresh();
                    }

                });

            } else {

                Gdx.app.log("OptionsPane", "Unknown type: " + name);
                if (!(currentStyle instanceof AbstractIconStyle)) {
                    actor = new Label("Unknown Type", game.skin);
                }
            }

            if (actor != null) {

                // field name

                // White required
                // Grey optional
                if (game.opt.isFieldOptional(currentStyle.getClass(), field.getName())) {

                    tableFields.add(new Label(field.getName(), game.skin, "optional")).left();

                } else {
                    tableFields.add(new Label(field.getName(), game.skin, "default")).left();

                }

                tableFields.add(actor).left().height(64).padRight(24).expandX().fillX();
                tableFields.row();
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

        //send changes to PreviewPane
        previewPane.selectedStyleChanged();
    }

}

From source file:de.longri.cachebox3.develop.tools.skin_editor.ColorPickerDialog.java

License:Apache License

/**
 * Refresh table content with colors from the skin
 *//*from  w  w w .  java  2  s. c  o  m*/
public void updateTable() {

    tableColors.clear();
    tableColors.add(new Label("Color Name", game.skin, "title")).left().width(170);
    tableColors.add(new Label("Value", game.skin, "title")).colspan(2).left().width(60).padRight(50);

    tableColors.row();

    Iterator<String> it = colors.keys().iterator();
    while (it.hasNext()) {
        final String key = it.next();
        final Color color = colors.get(key);

        tableColors.add(key).left();

        // Create drawable on the fly
        Pixmap pixmap = new Pixmap(18, 18, Pixmap.Format.RGBA8888);
        pixmap.setColor(color);
        pixmap.fill();
        pixmap.setColor(Color.BLACK);
        pixmap.drawRectangle(0, 0, 18, 18);
        Texture texture = new Texture(pixmap);
        pixmap.dispose();
        tableColors.add(new Image(texture));
        tableColors.add(color.toString()).left();

        TextButton buttonSelect = new TextButton("Select", game.skin);
        buttonSelect.addListener(new ChangeListener() {

            @Override
            public void changed(ChangeEvent event, Actor actor) {
                try {
                    field.set(game.screenMain.paneOptions.currentStyle, color);
                } catch (Exception e) {
                    e.printStackTrace();
                }

                hide();
                game.screenMain.panePreview.refresh();
                game.screenMain.paneOptions.updateSelectedTableFields();
                game.screenMain.saveToSkin();

            }

        });

        TextButton buttonRemove = new TextButton("Remove", game.skin);
        buttonRemove.addListener(new ChangeListener() {

            @Override
            public void changed(ChangeEvent event, Actor actor) {

                Dialog dlg = new Dialog("Delete Style", game.skin) {

                    @Override
                    protected void result(Object object) {
                        if ((Boolean) object == false) {
                            return;
                        }

                        colors.remove(key);
                        // update table
                        updateTable();
                        game.screenMain.saveToSkin();

                    }

                };

                dlg.pad(20);
                dlg.getContentTable().add("You are sure you want to delete this color?");
                dlg.button("OK", true);
                dlg.button("Cancel", false);
                dlg.key(com.badlogic.gdx.Input.Keys.ENTER, true);
                dlg.key(com.badlogic.gdx.Input.Keys.ESCAPE, false);
                dlg.show(game.screenMain.stage);

            }

        });

        if (field != null) {
            tableColors.add(buttonSelect).padRight(5);
        }
        tableColors.add(buttonRemove);
        tableColors.row();
    }

}

From source file:de.r2soft.empires.client.core.MainClientLauncher.java

License:Open Source License

public static void main(String[] args) {
    LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
    cfg.title = Values.SUPERTITLE + " - " + Values.VERSION_NUMBER;

    // TODO: This throws an NPE if no argument is passed
    /**/*w  w  w.  ja v a  2  s.c om*/
     * checks if game should be launched in full screen (EXPERIMENTAL AS OF ALPHA 1.3)
     */
    if (args[0] == "--fullscreen") {
        cfg.fullscreen = true;
        GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
        int width = gd.getDisplayMode().getWidth();
        int height = gd.getDisplayMode().getHeight();

        cfg.width = width;
        cfg.height = height;

        Values.NEW_WIDTH = width;
        Values.NEW_HEIGHT = height;

    } else {
        cfg.fullscreen = false;
        cfg.width = Values.OLD_WIDTH;
        cfg.height = Values.OLD_HEIGHT;
    }

    cfg.useGL30 = true;
    cfg.resizable = false;
    cfg.initialBackgroundColor = Color.BLACK;

    /** Sets the Application Icon for different operating systems */
    // TODO: FIX THIS
    // if (System.getProperty("os.name").equals("Mac OS X")) {
    // Application app = Application.getApplication();
    // Image image =
    // Toolkit.getDefaultToolkit().getImage("assets/icons/launcher.png");
    // app.setDockIconImage(image);
    // }

    new LwjglApplication(GameCore.getInstance(), cfg);
}

From source file:de.r2soft.empires.client.graphics.R2Overlay.java

License:Open Source License

public void addAdditionalAlpha(Vector2 start, Vector2 size, float alpha) {
    overlay = true;/*from ww  w  .ja v a 2 s  . c o m*/
    this.start = start;
    this.size = size;
    this.alpha = alpha;
    this.color = Color.BLACK;
}

From source file:dk.sidereal.lumm.components.pathfinding.PathfindingHandler.java

License:Apache License

@Override
protected void initialiseClass() {

    if (maps == null) {
        maps = new HashMap<String, PathfindingMap>();
    }/*from  w  w w .  ja  va 2  s.  c  o  m*/

    if (!Lumm.debug.isEnabled())
        return;
    if (font == null) {
        font = Lumm.assets.get(Lumm.assets.frameworkAssetsFolder + "Blocks.fnt", BitmapFont.class);
        font.setColor(Color.BLACK);
        font.getData().setScale(2);
        // font.setScale(2);
    }
    if (glyphLayout == null) {
        glyphLayout = new GlyphLayout();
    }
    Lumm.assets.load(Lumm.assets.frameworkAssetsFolder + "White.png", Texture.class);

    if (debugOpen == null) {
        debugOpen = new Sprite(Lumm.assets.get(Lumm.assets.frameworkAssetsFolder + "White.png", Texture.class));
        debugOpen.setColor(new Color(0, 1, 0, 0.5f));
    }

    if (debugClosed == null) {
        debugClosed = new Sprite(
                Lumm.assets.get(Lumm.assets.frameworkAssetsFolder + "White.png", Texture.class));
        debugClosed.setColor(new Color(1, 0, 0, 0.5f));
    }
}