Example usage for com.badlogic.gdx.graphics Pixmap setColor

List of usage examples for com.badlogic.gdx.graphics Pixmap setColor

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics Pixmap setColor.

Prototype

public void setColor(Color color) 

Source Link

Document

Sets the color for the following drawing operations.

Usage

From source file:at.tugraz.ist.catroid.plugin.Drone.other.DroneVideoCostume.java

License:Open Source License

public void initializeTexture() {
    Pixmap pixmap = new Pixmap(320, 240, Format.RGB888);
    pixmap.setColor(Color.BLUE);
    pixmap.fill();/*w w  w .j a v a2 s.c o m*/
    Texture texture = new Texture(pixmap, false);
    texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
    this.region = new TextureRegion(texture);
    this.width = this.region.getRegionWidth();
    this.height = this.region.getRegionHeight();
    this.x -= (this.width / 2f);
    this.y -= (this.height / 2f);
    this.originX = (this.width / 2f);
    this.originY = (this.height / 2f);
    pixmap.dispose();
    firstStart = false;
}

From source file:ateamproject.kezuino.com.github.render.screens.LobbyListScreen.java

private void createGui() {
    // Back to main menu.
    TextButton btnBack = new TextButton("Terug", skin);
    btnBack.addListener(new ClickListener() {
        @Override//www. ja v a2s.c om
        public void clicked(InputEvent event, float x, float y) {
            game.setScreen(new MainScreen(game));
        }
    });
    btnBack.setPosition(10, stage.getHeight() - btnBack.getHeight() - 10);
    this.stage.addActor(btnBack);

    // Create game button.
    TextButton btnCreateGame = new TextButton("Maak spel", skin);
    btnCreateGame.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {

            Dialog d = new Dialog("Lobby Name", skin);
            lobbyname = new TextField("", skin);

            SelectBox<Object> clanDropdown = null;
            String dropDownResult = "";
            if (clanGame) {
                Client client = Client.getInstance();
                PacketGetClans packet = new PacketGetClans();
                client.send(packet);
                ArrayList<String> listclans = packet.getResult();

                Object[] arrayClans = new Object[listclans.size()];
                for (int i = 0; i < listclans.size(); i++) {

                    arrayClans[i] = listclans.get(i);

                }
                clanDropdown = new SelectBox<>(skin);

                clanDropdown.setItems(arrayClans);

                clanDropdown.setSelectedIndex(0);
                d.add(clanDropdown);
            }

            TextButton btnsubmit = new TextButton("Maken", skin);
            lobbyname.setSize(150, 30);

            d.add(lobbyname);
            d.add(btnsubmit);

            final SelectBox dropDownResultFinal = clanDropdown;
            btnsubmit.addListener(new ClickListener() {
                @Override
                public void clicked(InputEvent event, float x, float y) {
                    d.hide();
                    if (!lobbyname.getText().equals("")) {
                        if (clanGame) {
                            game.setScreen(new LobbyScreen(game, lobbyname.getText(),
                                    dropDownResultFinal.getSelected().toString()));
                        } else {
                            game.setScreen(new LobbyScreen(game, lobbyname.getText(), null));
                        }
                    }
                }
            });
            d.show(stage);
        }
    });

    // Create game button
    btnCreateGame.setPosition(stage.getWidth() - btnCreateGame.getWidth() - 10,
            stage.getHeight() - btnCreateGame.getHeight() - 10);
    this.stage.addActor(btnCreateGame);

    Pixmap pm1 = new Pixmap(1, 1, Pixmap.Format.RGB565);
    pm1.setColor(Color.GREEN);
    pm1.fill();

    // set table position
    scrollTable = new Table(skin);
    scrollTable.setColor(com.badlogic.gdx.graphics.Color.BLUE);
    final ScrollPane scroller = new ScrollPane(scrollTable);
    scroller.sizeBy(200, 400);
    scroller.setColor(com.badlogic.gdx.graphics.Color.BLUE);
    final Table table = new Table();
    table.setFillParent(false);
    table.add(scroller).fill().expand();
    table.setSize(stage.getWidth(), stage.getHeight() - btnCreateGame.getHeight());
    table.setColor(com.badlogic.gdx.graphics.Color.BLUE);

    // get all host from the server and put in the table
    fillHostTable();

    float x = stage.getWidth() / 2 - table.getWidth() / 2;
    float y = stage.getHeight() - table.getHeight() - btnCreateGame.getHeight() - 20;

    table.setPosition(x, y);
    this.stage.addActor(table);

}

From source file:base.Engine.java

License:Open Source License

public static Pixmap generatePatternPixmap(PatternEntry basedOn, Color color) {
    Pixmap returnPixmap = new Pixmap(basedOn.getWrapper().getW(), basedOn.getWrapper().getH(),
            Pixmap.Format.RGBA8888);
    returnPixmap.setColor(Color.rgba8888(0, 0, 0, 0));
    returnPixmap.fill();/*from  w  w w.  j  a  v  a2s.co  m*/

    returnPixmap.setColor(Color.DARK_GRAY);
    returnPixmap.drawPixel(0, 0);

    returnPixmap.setColor(color);

    for (int x = 0; x < basedOn.getWrapper().getW(); x++)
        for (int y = 0; y < basedOn.getWrapper().getH(); y++)
            if (basedOn.getCells()[x][y] != 0)
                returnPixmap.drawPixel(x, y);

    return returnPixmap;
}

From source file:CB_UI_Base.GL_UI.Controls.Box.java

License:Open Source License

protected void drawBorder(Batch batch) {
    if (borderSprite == null) {
        try {/*from   w  ww  . ja v  a 2 s .  com*/
            GL.that.RunOnGLWithThreadCheck(new IRunOnGL() {

                @Override
                public void run() {

                    int w = (int) getWidth();
                    int h = (int) getHeight();

                    Pixmap borderRegPixmap = new Pixmap(w, h, Pixmap.Format.RGBA8888);
                    borderRegPixmap.setColor(borderColor);

                    int borderAsInt = Math.round(Box.this.borderSize);

                    for (int i = 0; i < borderAsInt + 1; i++) {
                        borderRegPixmap.drawRectangle(i, i, ((int) getWidth()) - (i),
                                ((int) getHeight()) - (i));
                    }

                    borderSprite = new Sprite(new Texture(borderRegPixmap, Pixmap.Format.RGBA8888, false),
                            (int) getWidth(), (int) getHeight());
                }
            });

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

    if (borderSprite != null)
        batch.draw(borderSprite, 0, 0);

}

From source file:CB_UI_Base.graphics.SolidTextureRegion.java

License:Open Source License

public SolidTextureRegion(Color color, float width, float height) {
    Pixmap pix = new Pixmap(2, 2, Format.RGB565);
    pix.setColor(color);
    pix.fill();/*from   www.ja  v  a  2s.  co  m*/

    Texture tex = new Texture(pix);
    pix.dispose();

    this.setRegion(tex);
    setRegion(0, 0, width, height);
}

From source file:com.alma42.mapgen.game.WorldController.java

License:Apache License

private Pixmap createProceduralPixmap(final AGridComponent component) {
    final int width = 32;
    final int height = 32;
    final Pixmap pixmap = new Pixmap(width, height, Format.RGBA8888);
    final Integer hex = ((Integer) ((Shape) component).getBiome().getValue());
    final int r = (hex >> 16) & 255;
    final int g = (hex >> 8) & 255;
    final int b = (hex & 255);
    pixmap.setColor(new Color(r, g, b, 1));
    pixmap.fill();//from   w ww  .jav a 2 s . co  m
    // pixmap.drawRectangle(0, 0, width, height);
    return pixmap;
}

From source file:com.andgate.pokeadot.PokeADot.java

License:Open Source License

private void createPauseBG() {
    Pixmap blackbox = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
    blackbox.setColor(Constants.DIM_SCREEN_COLOR);
    blackbox.fill();//from  w w w.j  a  va 2  s  .co m
    pauseBG = new Texture(blackbox);
}

From source file:com.bladecoder.engine.util.RectangleRenderer.java

License:Apache License

private static Texture makePixel() {
    Texture _temp;//  w  w w. j  a va2s .  c o  m
    Pixmap p = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
    p.setColor(Color.WHITE);
    p.fillRectangle(0, 0, 1, 1);
    _temp = new Texture(p, true);
    p.dispose();
    return _temp;
}

From source file:com.dongbat.game.screen.DbScreen.java

public DbScreen() {
    camera = CameraUtil.getCamera();/* w w w .j  a  v  a  2s .c o m*/
    batch = RenderUtil.getBatch();
    logo = new Sprite(AssetUtil.db);
    logo.setSize(CameraUtil.MIN_WIDTH * .75f, CameraUtil.MIN_WIDTH * .75f / backgroundRatio);
    logo.setPosition(-logo.getWidth() / 2, -logo.getHeight() / 2);

    Pixmap pm1 = new Pixmap(1, 1, Pixmap.Format.RGB565);
    pm1.setColor(Color.WHITE);
    pm1.fill();
    background = new Sprite(new Texture(pm1));
    background.setSize(CameraUtil.MIN_WIDTH, CameraUtil.MIN_HEIGHT);
    background.setPosition(-background.getWidth() / 2, -background.getHeight() / 2);

    startTime = TimeUtils.millis();
}

From source file:com.dongbat.game.screen.SplashScreen.java

public SplashScreen() {
    camera = CameraUtil.getCamera();//from w  w w  .j  a  v  a  2 s . c om
    batch = RenderUtil.getBatch();
    logo = new Sprite(AssetUtil.logo);
    logo.setSize(CameraUtil.MIN_WIDTH * .75f, CameraUtil.MIN_WIDTH * .75f / backgroundRatio);
    logo.setPosition(-logo.getWidth() / 2, -logo.getHeight() / 2);

    Pixmap pm1 = new Pixmap(1, 1, Format.RGB565);
    pm1.setColor(Color.WHITE);
    pm1.fill();
    background = new Sprite(new Texture(pm1));
    background.setSize(CameraUtil.MIN_WIDTH, CameraUtil.MIN_HEIGHT);
    background.setPosition(-background.getWidth() / 2, -background.getHeight() / 2);

    startTime = TimeUtils.millis();

    AssetUtil.loadAsset();
}