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:mobi.shad.s3lib.gfx.node.pixmap.procedural.FxPerlinNoise.java

License:Apache License

/**
 *
 *//*from   w ww.ja  v a 2  s .  c o  m*/
@Override
protected void processLocal() {

    if (formGui != null) {
        perlinType = formGui.getInt("FxPerlinNoiseType");
        amplitude = formGui.getFloat("FxPerlinNoiseAmplitude");
        frequency = formGui.getFloat("FxPerlinNoiseFrequency");
        octaves = formGui.getInt("FxPerlinNoiseOctaves");
    }
    if (data.pixmap == null) {
        data.pixmap = new Pixmap(S3Constans.proceduralTextureSizeHight, S3Constans.proceduralTextureSizeHight,
                Pixmap.Format.RGBA8888);
        data.pixmap.setColor(Color.BLACK);
        data.pixmap.fill();
        data.texture = null;
    }
    data.type = Data.Type.EFFECT_2D;

    switch (perlinType) {
    default:
        PerlinNoise2D.generate(data.pixmap, amplitude, frequency, octaves);
        break;
    case 1:
        PerlinNoise2Dv2.generate(data.pixmap, amplitude, frequency, octaves);
        break;
    case 2:
        PerlinNoise1D.generate(data.pixmap, amplitude, frequency, octaves);
        break;
    }
    data.textureChange = true;
}

From source file:mobi.shad.s3lib.gfx.node.util.FxPixmapSize.java

License:Apache License

/**
 *
 *///from www . j a  va2  s  . com
@Override
protected void processLocal() {

    if (formGui != null) {
        pixmapSize = formGui.getInt("FxPixmapSize");
    }
    data.type = Data.Type.EFFECT_2D;

    switch (pixmapSize) {
    default:
        xSize = 16;
        ySize = 16;
        break;
    case 1:
        xSize = 32;
        ySize = 32;
        break;
    case 2:
        xSize = 64;
        ySize = 64;
        break;
    case 3:
        xSize = 128;
        ySize = 128;
        break;
    case 4:
        xSize = 256;
        ySize = 256;
        break;
    case 5:
        xSize = 512;
        ySize = 512;
        break;
    case 6:
        xSize = 1024;
        ySize = 1024;
        break;
    case 7:
        xSize = 64;
        ySize = 32;
        break;
    case 8:
        xSize = 128;
        ySize = 64;
        break;
    case 9:
        xSize = 256;
        ySize = 128;
        break;
    }
    data.pixmap = new Pixmap(xSize, ySize, Pixmap.Format.RGBA8888);
    data.pixmap.setColor(Color.BLACK);
    data.pixmap.fill();
    data.texture = null;
    data.textureChange = true;
}

From source file:mobi.shad.s3lib.gfx.pixmap.disort.Vortex.java

License:Apache License

/**
 *
 * @param pixmap//w w  w .  ja v a 2 s  .  c o  m
 * @param centerX
 * @param centerY
 * @param rayX
 * @param rayY
 * @param twist
 */
public static void generate(final Pixmap pixmap, float centerX, float centerY, float rayX, float rayY,
        float twist) {

    int width = pixmap.getWidth();
    int height = pixmap.getHeight();

    //
    // Process operator
    //
    int dwCenterX = (int) (centerX * width);
    int dwCenterY = (int) (centerY * height);
    int dwRadiusX = (int) (rayX * width);
    int dwRadiusY = (int) (rayY * height);

    float f1_RadiusX = 1.0f / (float) dwRadiusX;
    float f1_RadiusY = 1.0f / (float) dwRadiusY;
    float radians = twist * S3Math.PI2;

    Pixmap dstPixmap = new Pixmap(width, height, pixmap.getFormat());
    dstPixmap.setColor(Color.BLACK);
    dstPixmap.fill();

    for (int y = 0; y < height; y++) {

        for (int x = 0; x < width; x++) {

            //
            // Calculate distance
            //
            float dx = (float) (x - dwCenterX) * f1_RadiusX;
            float dy = (float) (y - dwCenterY) * f1_RadiusY;
            float d = (float) Math.sqrt(dx * dx + dy * dy);

            //
            // If distance more radius, olny copy pixels
            //
            if (d > 1.0) {
                int rgb = pixmap.getPixel(x, y);
                dstPixmap.drawPixel(x, y, rgb);
            } else {

                d = (float) S3Math.fastCos(d * S3Math.PI1_2 - S3Math.PI1_2);
                d = 1.0f - d;

                //
                // Rotate around middle
                //
                float nx = x - dwCenterX;
                float ny = y - dwCenterY;

                float rad = radians * d;
                float bx = nx;
                nx = bx * S3Math.fastCos(rad) - nx * S3Math.fastSin(rad) + dwCenterX;
                ny = bx * S3Math.fastSin(rad) + ny * S3Math.fastCos(rad) + dwCenterY;

                if (nx >= width) {
                    nx = nx - width;
                }
                if (ny >= height) {
                    ny = ny - height;
                }
                if (nx < 0) {
                    nx = width + nx;
                }
                if (ny < 0) {
                    ny = height + ny;
                }

                //
                // Bilinear sample nearest 4 pixels at rotated pos
                //
                int ix, iy;
                ix = (int) nx;
                iy = (int) ny;

                float fracX = nx - ix;
                float fracY = ny - iy;

                float ul = (1.0f - fracX) * (1.0f - fracY);
                float ll = (1.0f - fracX) * fracY;
                float ur = fracX * (1.0f - fracY);
                float lr = fracX * fracY;

                int wrapx = (ix + 1);
                int wrapy = (iy + 1);

                int rgb = pixmap.getPixel(ix, iy);
                int r = (rgb & 0xff000000) >>> 24;
                int g = (rgb & 0x00ff0000) >>> 16;
                int b = (rgb & 0x0000ff00) >>> 8;

                rgb = pixmap.getPixel(wrapx, iy);
                int r2 = (rgb & 0xff000000) >>> 24;
                int g2 = (rgb & 0x00ff0000) >>> 16;
                int b2 = (rgb & 0x0000ff00) >>> 8;

                rgb = pixmap.getPixel(ix, wrapy);
                int r3 = (rgb & 0xff000000) >>> 24;
                int g3 = (rgb & 0x00ff0000) >>> 16;
                int b3 = (rgb & 0x0000ff00) >>> 8;

                rgb = pixmap.getPixel(wrapx, wrapy);
                int r4 = (rgb & 0xff000000) >>> 24;
                int g4 = (rgb & 0x00ff0000) >>> 16;
                int b4 = (rgb & 0x0000ff00) >>> 8;

                r = (int) (r * ul + r2 * ur + r3 * ll + r4 * lr);
                g = (int) (g * ul + g2 * ur + g3 * ll + g4 * lr);
                b = (int) (b * ul + b2 * ur + b3 * ll + b4 * lr);

                //
                // Clamp
                //
                r = (r < 255) ? r : 255;
                r = (r > 0) ? r : 0;
                g = (g < 255) ? g : 255;
                g = (g > 0) ? g : 0;
                b = (b < 255) ? b : 255;
                b = (b > 0) ? b : 0;

                dstPixmap.drawPixel(x, y, ((int) r << 24) | ((int) g << 16) | ((int) b << 8) | 255);
            }
        }
    }
    pixmap.drawPixmap(dstPixmap, 0, 0);
}

From source file:mobi.shad.s3lib.gfx.pixmap.procedural.Flat.java

License:Apache License

/**
 * @param pixmap
 */
@Override
public void generate(Pixmap pixmap) {
    generate(pixmap, Color.BLACK);
}

From source file:mobi.shad.s3lib.gfx.pixmap.procedural.Flat.java

License:Apache License

/**
 * @param pixmap
 */
@Override
public void random(Pixmap pixmap) {
    generate(pixmap, Color.BLACK);
}

From source file:name.herve.bastod.gui.components.UnitInfoBox.java

License:Open Source License

public UnitInfoBox(Unit u) {
    super(u.getName() + "-InfoBox", -1, -1, 200, 100);
    this.unit = u;

    setNeedUpdate(false);/*from  ww w .  j  a  va 2  s. c  o m*/
    font = GUIResources.getInstance().getFont(INFOBOX_FONT);

    moveTo(u.getPositionOnBoard().getXInt(), u.getPositionOnBoard().getYInt());

    Blending bck = Pixmap.getBlending();
    Pixmap.setBlending(Blending.None);

    Pixmap p = new Pixmap(getWidth(), getHeight(), Pixmap.Format.RGBA8888);
    Color c1 = Color.YELLOW;
    c1.a = 1f;
    p.setColor(c1);

    p.drawRectangle(0, 0, getWidth(), getHeight());

    c1 = Color.BLACK;
    c1.a = 0.5f;
    p.setColor(c1);

    p.fillRectangle(1, 1, getWidth() - 2, getHeight() - 2);

    setBackground(new Texture(p));
    p.dispose();
    Pixmap.setBlending(bck);
}

From source file:name.herve.bastod.guifwk.AbstractComponent.java

License:Open Source License

@Override
public void start() {
    super.start();
    lastUpdateTime = 0;/*from   ww  w. ja v a2s. c o m*/

    Blending bck = Pixmap.getBlending();
    Pixmap.setBlending(Blending.None);

    Pixmap p = new Pixmap(getWidth(), getHeight(), Pixmap.Format.RGBA8888);
    Color c1 = Color.BLACK.cpy();
    c1.a = 0.8f;
    p.setColor(c1);
    p.fillRectangle(0, 0, getWidth(), getHeight());

    //      p.setColor(Color.WHITE);
    //      int step = 8;
    //      for (int d = 0; d < w; d += step) {
    //         p.drawLine(x + d, h, 0, h - d);
    //         p.drawLine(x + d, h - w, w, h - d);
    //         p.drawLine(x + d, h, w, h - w + d);
    //         p.drawLine(x + d, h - w, 0, h - w + d);
    //      }

    disabled = new Texture(p);
    p.dispose();
    Pixmap.setBlending(bck);

}

From source file:name.herve.bastod.guifwk.GUIResources.java

License:Open Source License

public static GUIResources getInstance() {
    if (instance == null) {
        instance = new GUIResources();

        instance.addColor(WHITE, Color.WHITE);

        instance.addFont(FONT_STANDARD_WHITE, createFont(DEFAULT_FONT, DEFAULT_FONT_SIZE, Color.WHITE));
        instance.addFont(FONT_SMALL_WHITE, createFont(DEFAULT_FONT, SMALL_FONT_SIZE, Color.WHITE));

        instance.addColor(BLACK, Color.BLACK);

        instance.addTexture(CheckBox.TEXTURE_CHECKED, new Texture(Gdx.files.internal("checked.png")));
        instance.addTexture(CheckBox.TEXTURE_UNCHECKED, new Texture(Gdx.files.internal("unchecked.png")));
        instance.addTexture(ImageButton.TEXTURE_BORDER, new Texture(Gdx.files.internal("button.png")));
        instance.addTexture(ImageButton.TEXTURE_LONG_BORDER_BLUE,
                new Texture(Gdx.files.internal("blue-long-button.png")));
        instance.addTexture(ImageButton.TEXTURE_LONG_BORDER_RED,
                new Texture(Gdx.files.internal("red-long-button.png")));
        instance.addTexture(ImageButton.TEXTURE_LONG_BORDER_WHITE,
                new Texture(Gdx.files.internal("white-long-button.png")));
    }//from  w w  w . j  a v  a 2  s  .c  o  m
    return instance;
}

From source file:net.bplaced.therefactory.nomoore.cutscenes.CutsceneMedieval.java

License:Open Source License

@Override
public void render(float delta) {
    Gdx.gl.glClearColor(0, 0, 0, 1);//from  w  w  w  . jav  a  2 s  . c o m
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    update();

    sr.setProjectionMatrix(camera.combined);
    sr.begin(ShapeRenderer.ShapeType.Filled);

    sr.setColor(Color.BLACK);
    sr.rect(-70, -70, viewport.getWorldWidth(), 70);
    sr.rect(-70, 220, viewport.getWorldWidth(), 70);
    sr.rect(-70, 0, 70, 220);
    sr.rect(500, 0, 70, 220);
    sr.end();

    batch.setProjectionMatrix(camera.combined);
    batch.begin();

    if (numTouches == -1) {
        message = "";
        String msg = "535 years ago.";
        font.draw(batch, msg, 250 - Utils.getFontWidth(msg, font) / 2, 115);
    }

    if (numTouches >= 0 && numTouches < 9) {
        bg.draw(batch);
        batch.draw(king.getTexture(), 200, 20);
        particles.renderBigFire(batch, delta, 150, 55);
    }

    if (numTouches > -1 && numTouches < 3) {
        batch.draw(mother.getTexture(), 60, 20);
    }
    if (numTouches >= 3 && numTouches < 9) {
        batch.draw(mother.getTexture(), 68, 20);
    }

    if (numTouches >= 0 && numTouches < 3) {
        batch.draw(girl.getTexture(), 95, 25);
        batch.draw(mother.getTexture(), 60, 20);
    }
    if (numTouches == 3) {
        batch.draw(girl.getTexture(), 130, 44);
        message = "* slap *";
    }
    if (numTouches == 4) {
        batch.draw(girldBurned1.getTexture(), 130, 44);
        message = "";
    }
    if (numTouches == 5) {
        batch.draw(girldBurned2.getTexture(), 130, 44);
    }
    if (numTouches == 6) {
        batch.draw(girldBurned3.getTexture(), 130, 44);
    }
    if (numTouches == 7) {
        batch.draw(girldBurned4.getTexture(), 130, 44);
    } else if (numTouches == 9) {
        message = "";
        String msg = "I have been burned.";
        font.draw(batch, msg, 250 - Utils.getFontWidth(msg, font) / 2, 115);
    }

    font.draw(batch, message, 265 - Utils.getFontWidth(message, font) / 2, -29);
    batch.end();
}

From source file:net.bplaced.therefactory.nomoore.cutscenes.CutsceneModernTimes.java

License:Open Source License

@Override
public void render(float delta) {
    Gdx.gl.glClearColor(0, 0, 0, 1);//from   w w w.  j a v a 2  s  .c o m
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    update();

    sr.setProjectionMatrix(camera.combined);
    sr.begin(ShapeRenderer.ShapeType.Filled);

    sr.setColor(Color.BLACK);
    sr.rect(-70, -70, viewport.getWorldWidth(), 70);
    sr.rect(-70, 220, viewport.getWorldWidth(), 70);
    sr.rect(-70, 0, 70, 220);
    sr.rect(500, 0, 70, 220);
    sr.end();

    batch.setProjectionMatrix(camera.combined);
    batch.begin();

    if (numTouches == -2) {
        message = "";
        // String msg = "One Room. One Passion. 3 Ages.";
        // font.draw(batch, msg, 250 - Utils.getFontWidth(msg, font) / 2,
        // 115);
    }

    if (numTouches == -1)
        message = "My name is Moore.";

    if (numTouches >= -1 && numTouches < 13)
        bg.draw(batch);

    if (numTouches >= -1 && numTouches < 7)
        batch.draw(girl.getTexture(), 250, 20);

    if (numTouches >= 3 && numTouches <= 6)
        batch.draw(knife.getTexture(), 243, 34);
    else if (numTouches == 7)
        batch.draw(girlStabbed1.getTexture(), 250, 20);
    else if (numTouches == 8) {
        batch.draw(girlStabbed2.getTexture(), 250, 20);
        batch.draw(knife.getTexture(), 230, 10);
    } else if (numTouches == 9) {
        batch.draw(girlStabbed3.getTexture(), 245, 0);
        batch.draw(knife.getTexture(), 230, 10);
    } else if (numTouches == 10) {
        batch.draw(girlStabbed4.getTexture(), 245, 0);
        batch.draw(knife.getTexture(), 230, 10);
    } else if (numTouches == 11) {
        batch.draw(girlStabbed4.getTexture(), 245, 0);
        batch.draw(knife.getTexture(), 230, 10);
        batch.draw(human1.getTexture(), 30, 20);
        message = "No!";
    } else if (numTouches == 12) {
        batch.draw(girlStabbed4.getTexture(), 245, 0);
        batch.draw(knife.getTexture(), 230, 10);
        batch.draw(human2.getTexture(), 220, 25);
        message = "NOOOOOOOOOOOOOOOO!!!!!";
    } else if (numTouches == 13) {
        message = "";
        String msg = "I have been cut.";
        font.draw(batch, msg, 250 - Utils.getFontWidth(msg, font) / 2, 115);
    } else if (numTouches == 14) {
        String msg = "5 years later.";
        font.draw(batch, msg, 250 - Utils.getFontWidth(msg, font) / 2, 115);
    }

    font.draw(batch, message, 265 - Utils.getFontWidth(message, font) / 2, -29);

    batch.end();
}