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

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

Introduction

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

Prototype

Color BLUE

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

Click Source Link

Usage

From source file:com.momia.asg.screens.MainMenu.java

License:Apache License

public MainMenu(final ASG game) {
    this.game = game;
    batch = new SpriteBatch();
    stage = new Stage();
    Gdx.input.setInputProcessor(stage);//w  ww . j a  va 2s  .c  om
    // A skin can be loaded via JSON or defined programmatically, either is fine. Using a skin is optional but strongly
    // recommended solely for the convenience of getting a texture, region, etc as a drawable, tinted drawable, etc.
    skin = new Skin();
    // Generate a 1x1 white texture and store it in the skin named "white".
    Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();
    skin.add("white", new Texture(pixmap));
    // Store the default libgdx font under the name "default".
    skin.add("default", new BitmapFont());
    // Configure a TextButtonStyle and name it "default". Skin resources are stored by type, so this doesn't overwrite the font.
    TextButtonStyle textButtonStyle = new TextButtonStyle();
    textButtonStyle.up = skin.newDrawable("white", Color.DARK_GRAY);
    textButtonStyle.down = skin.newDrawable("white", Color.DARK_GRAY);
    textButtonStyle.checked = skin.newDrawable("white", Color.BLUE);
    textButtonStyle.over = skin.newDrawable("white", Color.LIGHT_GRAY);
    textButtonStyle.font = skin.getFont("default");
    skin.add("default", textButtonStyle);
    // Create a table that fills the screen. Everything else will go inside this table.
    Table table = new Table();
    table.setFillParent(true);
    stage.addActor(table);
    // Create a button with the "default" TextButtonStyle. A 3rd parameter can be used to specify a name other than "default".
    final TextButton button = new TextButton("New Game", skin);
    table.add(button);
    // Add a listener to the button. ChangeListener is fired when the button's checked state changes, eg when clicked,
    // Button#setChecked() is called, via a key press, etc. If the event.cancel() is called, the checked state will be reverted.
    // ClickListener could have been used, but would only fire when clicked. Also, canceling a ClickListener event won't
    // revert the checked state.
    button.addListener(new ClickListener() {
        public void clicked(InputEvent event, float x, float y) {
            if (button.isChecked())
                game.setScreen(new Screen1(game));
        }
    });

}

From source file:com.mrlamont.Model.TitleScreen.java

public void render(float delta) {
    camera = new OrthographicCamera();
    viewport = new FitViewport(V_WIDTH, V_HEIGHT, camera);
    batch = new SpriteBatch();
    // clear the screen with black
    Gdx.gl20.glClearColor(0, 0, 0, 1);/*w  ww. j a va2 s  .com*/
    Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT);
    g = new ShapeRenderer();
    batch = new SpriteBatch();
    g.begin(ShapeRenderer.ShapeType.Filled);
    g.setColor(Color.PURPLE);
    g.rect(550, 0, 110, 600);
    g.setColor(Color.BLUE);
    g.rect(440, 0, 110, 600);
    g.setColor(Color.GREEN);
    g.rect(330, 0, 110, 600);
    g.setColor(Color.YELLOW);
    g.rect(220, 0, 110, 600);
    g.setColor(Color.ORANGE);
    g.rect(110, 0, 110, 600);
    g.setColor(Color.RED);
    g.rect(0, 0, 110, 600);
    g.end();

    //draw different coloured Wheelys on screen
    batch.begin();
    batch.draw(AssetManager.wheelyYellow, 190, -1);
    batch.draw(AssetManager.wheelyOrange, 90, -1);
    batch.draw(AssetManager.wheelyRed, -14, -1);
    batch.draw(AssetManager.wheelyGreenL, 320, -1);
    batch.draw(AssetManager.wheelyBlueL, 420, -1);
    batch.draw(AssetManager.wheelyPurpleL, 520, -1);
    batch.end();

    //If a certain colour is left clicked, that colouro of Wheely is selected
    if (Gdx.input.isButtonPressed(Input.Buttons.LEFT)) {
        Vector3 mouseClick = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
        camera.unproject(mouseClick);
        System.out.println("x: " + mouseClick.x + "    y: " + mouseClick.y);
        //Red
        if (mouseClick.y >= -1 && mouseClick.y <= 0.991 && mouseClick.x >= -1 && mouseClick.x <= -0.6625) {
            red = true;
        }
        //Green
        if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= 0.034374952
                && mouseClick.x <= 0.36874998) {
            green = true;
        }
        //Orange
        if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= -0.653125
                && mouseClick.x <= -0.32187498) {
            orange = true;
        }
        //Yellow
        if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= -0.309375
                && mouseClick.x <= 0.024999976) {
            yellow = true;
        }
        //Blue
        if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= 0.37812495 && mouseClick.x <= 0.7125) {
            blue = true;
        }

        //Purple
        if (mouseClick.y >= -1 && mouseClick.y <= 1 && mouseClick.x >= 0.71875 && mouseClick.x <= 0.99375) {
            purple = true;
        }

    }

}

From source file:com.mygdx.game.LoadingGameScreen.java

License:Apache License

@Override
public void renderProgress(float delta, float progress) {
    Gdx.gl.glClearColor(Color.BLACK.r, Color.BLACK.g, Color.BLACK.b, Color.BLACK.a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    shapeRenderer.setProjectionMatrix(camera.projection);
    shapeRenderer.setTransformMatrix(camera.view);
    shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
    float x = (GdxDemo3D.WIDTH - PROGRESS_BAR_WIDTH) / 2;
    float y = (GdxDemo3D.HEIGHT - PROGRESS_BAR_HEIGHT) / 2;
    float k = 4;/* www .  j  a va 2  s.c o m*/
    shapeRenderer.setColor(Color.WHITE);
    shapeRenderer.rect(x - k, y - k, PROGRESS_BAR_WIDTH + k * 2, PROGRESS_BAR_HEIGHT + k * 2);
    shapeRenderer.setColor(Color.BLUE);
    shapeRenderer.rect(x, y, PROGRESS_BAR_WIDTH * progress, PROGRESS_BAR_HEIGHT);
    shapeRenderer.end();
}

From source file:com.mygdx.game.Splash.java

public void create() {
    batch = new SpriteBatch();
    stage = new Stage();
    Gdx.input.setInputProcessor(stage);//from   ww  w  . java2  s  .  c  om
    skin = new Skin();
    Pixmap pixmap = new Pixmap(100, 100, Format.RGBA8888);
    pixmap.setColor(Color.GREEN);
    pixmap.fill();
    skin.add("white", new Texture(pixmap));
    BitmapFont bfont = new BitmapFont();
    //bfont.scale(1); 
    skin.add("default", bfont);
    TextButtonStyle textButtonStyle = new TextButtonStyle();
    textButtonStyle.up = skin.newDrawable("white", Color.DARK_GRAY);
    textButtonStyle.down = skin.newDrawable("white", Color.DARK_GRAY);
    textButtonStyle.checked = skin.newDrawable("white", Color.BLUE);
    textButtonStyle.over = skin.newDrawable("white", Color.LIGHT_GRAY);

    textButtonStyle.font = skin.getFont("default");

    skin.add("default", textButtonStyle);
    final TextButton textButton = new TextButton("PLAY", textButtonStyle);
    textButton.setPosition(200, 200);
    stage.addActor(textButton);
    stage.addActor(textButton);
    stage.addActor(textButton);
    textButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            //System.out.println("Clicked! Is checked: " + button.isChecked());
            textButton.setText("Starting new game");
            //g.setScreen( new GameWorking());

        }
    });
}

From source file:com.mygdx.game.steerers.FollowPathSteerer.java

License:Apache License

@Override
public boolean processSteering(SteeringAcceleration<Vector3> steering) {

    // Check if steering target path segment changed.
    LinePathParam pathParam = followPathSB.getPathParam();
    int traversedSegment = pathParam.getSegmentIndex();
    if (traversedSegment > currentSegmentIndex) {
        currentSegmentIndex = traversedSegment;
    }//from   www . j a v  a  2s.  c  om

    if (prioritySteering.getSelectedBehaviorIndex() == 0) {
        /*
         * Collision avoidance management
         */
        float pr = proximity.getRadius() * 1.5f;
        if (linePath.getEndPoint().dst2(steerableBody.getPosition()) <= pr * pr) {
            // Disable collision avoidance near the end of the path since the obstacle
            // will likely prevent the entity from reaching the target.
            collisionAvoidanceSB.setEnabled(false);
            deadlockDetectionStartTime = Float.POSITIVE_INFINITY;
        } else if (deadlockDetection) {
            // Accumulate collision time during deadlock detection
            collisionDuration += GdxAI.getTimepiece().getDeltaTime();

            if (GdxAI.getTimepiece().getTime() - deadlockDetectionStartTime > DEADLOCK_TIME
                    && collisionDuration > DEADLOCK_TIME * .6f) {
                // Disable collision avoidance since most of the deadlock detection period has been spent on collision avoidance
                collisionAvoidanceSB.setEnabled(false);
            }
        } else {
            // Start deadlock detection
            deadlockDetectionStartTime = GdxAI.getTimepiece().getTime();
            collisionDuration = 0;
            deadlockDetection = true;
        }
        return true;
    }

    /*
     * Path following management
     */
    float dst2FromPathEnd = steerableBody.getPosition().dst2(linePath.getEndPoint());

    // Check to see if the entity has reached the end of the path
    if (steering.isZero()
            && dst2FromPathEnd < followPathSB.getArrivalTolerance() * followPathSB.getArrivalTolerance()) {
        return false;
    }

    // Check if collision avoidance must be re-enabled
    if (deadlockDetection && !collisionAvoidanceSB.isEnabled()
            && GdxAI.getTimepiece().getTime() - deadlockDetectionStartTime > MAX_NO_COLLISION_TIME) {
        collisionAvoidanceSB.setEnabled(true);
        deadlockDetection = false;
    }

    // If linear speed is very low and the entity is colliding something at his feet, like a step of the stairs
    // for instance, we have to increase the acceleration to make him go upstairs. 
    float minVel = .2f;
    if (steerableBody.getLinearVelocity().len2() > minVel * minVel) {
        stationarityRayColor = null;
    } else {
        steerableBody.getGroundPosition(stationarityRayLow.origin).add(0, 0.05f, 0);
        steerableBody.getDirection(stationarityRayLow.direction).scl(1f, 0f, 1f).nor();
        stationarityRayLength = steerableBody.getBoundingRadius() + 0.4f;
        Entity hitEntityLow = GameScreen.screen.engine.rayTest(stationarityRayLow, null, GameEngine.ALL_FLAG,
                GameEngine.PC_FLAG, stationarityRayLength, null);
        if (hitEntityLow instanceof GameObject) {
            stationarityRayColor = Color.RED;
            stationarityRayHigh.set(stationarityRayLow);
            stationarityRayHigh.origin.add(0, .8f, 0);
            Entity hitEntityHigh = GameScreen.screen.engine.rayTest(stationarityRayHigh, null,
                    GameEngine.ALL_FLAG, GameEngine.PC_FLAG, stationarityRayLength, null);
            if (hitEntityHigh == null) {
                // The entity is touching a small obstacle with his feet like a step of the stairs.
                // Increase the acceleration to make him go upstairs.
                steering.linear.scl(8);
            } else if (hitEntityHigh instanceof GameObject) {
                // The entity is touching a higher obstacle like a tree, a column or something.
                // Here we should invent something to circumvent this kind of obstacles :)
                //steering.linear.rotateRad(Constants.V3_UP, Constants.PI0_25);
            }
        } else {
            stationarityRayColor = Color.BLUE;
        }
    }

    return true;
}

From source file:com.mygdx.game.TruckDrawer.java

@Override
public void draw(ShapeRenderer sr, Vehicle vehicle) {
    sr.setColor(Color.BLUE);
    float x = vehicle.getXOnScreen();
    float y = vehicle.getYOnScreen();

    int widthRect, heightRect;

    if (!vehicle.isTurned()) {
        if (vehicle.getStartMotionDirection() == Constants.leftToRight
                || vehicle.getStartMotionDirection() == Constants.rightToLeft) {
            widthRect = vehicle.getWidth();
            heightRect = vehicle.getHeight();
        } else {//from  w  w w .j  a  v a  2  s.  c  o  m
            widthRect = vehicle.getHeight();
            heightRect = vehicle.getWidth();
        }
    } else {
        if (vehicle.getFinishMotionDirection() == Constants.leftToRight
                || vehicle.getFinishMotionDirection() == Constants.rightToLeft) {
            widthRect = vehicle.getWidth();
            heightRect = vehicle.getHeight();
        } else {
            widthRect = vehicle.getHeight();
            heightRect = vehicle.getWidth();
        }
    }

    sr.rect(x, y, widthRect, heightRect);
}

From source file:com.punchables.rainbowdad.utils.DebugDrawer.java

public void draw() {
    this.begin(ShapeType.Filled);
    setColor(Color.BLUE);
    for (Circle circle : circleList) {
        circle(circle.x, circle.y, circle.radius);
    }/*from w  w  w .j  a  v a2s  .c  o m*/

    //circle(1000, 1000, 100);

    this.end();

    this.begin(ShapeType.Line);
    for (int i = 0; i < lineListA.size(); i++) {
        line(lineListA.get(i), lineListB.get(i));
    }
    this.end();
}

From source file:com.ray3k.skincomposer.dialog.DialogColorPicker.java

License:Open Source License

public DialogColorPicker(Main main, String style, ColorListener listener, Color previousColor) {
    super("", main.getSkin(), style);

    if (previousColor == null) {
        selectedColor = new Color(Color.RED);
    } else {// w  w w. j  a v  a2  s  .  co m
        this.previousColor = new Color(previousColor);
        selectedColor = new Color(previousColor);
    }

    this.skin = main.getSkin();
    this.main = main;
    this.listener = listener;

    spinnerStyle = new Spinner.SpinnerStyle(skin.get("spinner-minus-h", Button.ButtonStyle.class),
            skin.get("spinner-plus-h", Button.ButtonStyle.class),
            skin.get("default", TextField.TextFieldStyle.class));

    gradientAlpha = new GradientDrawable(new Color(1.0f, 0, 0, 0), new Color(1.0f, 0, 0, 0), Color.RED,
            Color.RED);
    Vector3 v = rgbToHsb(selectedColor.r, selectedColor.g, selectedColor.b);
    Color temp = hsbToRgb(v.x * 360.0f, 1.0f, 1.0f);
    gradientS = new GradientDrawable(Color.WHITE, temp, temp, Color.WHITE);
    gradientB = new GradientDrawable(Color.BLACK, Color.BLACK, Color.CLEAR, Color.CLEAR);
    gradientSB = new StackedDrawable(gradientS, gradientB);

    hueGradient = new Array<>();
    hueGradient.add(new GradientDrawable(Color.MAGENTA, Color.MAGENTA, Color.RED, Color.RED));
    hueGradient.add(new GradientDrawable(Color.BLUE, Color.BLUE, Color.MAGENTA, Color.MAGENTA));
    hueGradient.add(new GradientDrawable(Color.CYAN, Color.CYAN, Color.BLUE, Color.BLUE));
    hueGradient.add(new GradientDrawable(Color.GREEN, Color.GREEN, Color.CYAN, Color.CYAN));
    hueGradient.add(new GradientDrawable(Color.YELLOW, Color.YELLOW, Color.GREEN, Color.GREEN));
    hueGradient.add(new GradientDrawable(Color.RED, Color.RED, Color.YELLOW, Color.YELLOW));

    Drawable tinted = ((TextureRegionDrawable) skin.getDrawable("white")).tint(Color.LIGHT_GRAY);
    checker = new CheckerDrawable(skin.getDrawable("white"), tinted, 10.0f, 10.0f);
    alphaStack = new StackedDrawable(checker, gradientAlpha);

    Table root = getContentTable();
    Label label = new Label("Choose a Color", skin, "title");
    label.setAlignment(Align.center);
    root.add(label).growX();

    root.row();
    content = new Table(skin);
    root.add(content);

    addListener(new InputListener() {
        @Override
        public boolean keyDown(InputEvent event, int keycode) {
            if (keycode == Keys.ESCAPE) {
                if (listener != null) {
                    listener.handle(new ColorListener.ColorEvent(null));
                }
                hide();
            }
            return false;
        }
    });

    populate();
}

From source file:com.sasluca.lcl.ui.text.UITextArea.java

License:Apache License

public UITextArea(String font, float width, float height, String text, boolean fitText) {
    image = new UISprite("default");
    image.setSize(width, height).setColor(Color.BLUE);

    m_Font = LCLFontManager.getFont(font);
    m_Mask = new LCLMask(0, 0, width, height);
    m_Text = new LCLString(text);
    m_ScaleW = m_ScaleH = 1f;//from   w  w  w.  j  av a 2 s.co m
    m_Color = new Color(Color.BLACK);
    m_Masking = true;
    m_FitText = fitText;
    m_Smoothing = 4;
    if (m_FitText)
        fitText();
}

From source file:com.sebasxogo2d.pantallas.PantallaMarcadores.java

License:Open Source License

/**
 * Constructor which receive an object of the main class, initialize and create objects
* for the properties of this class. /*w  w w .  j a  v  a 2  s .  c  om*/
 *
 * @param xogo A instance of the main class
 * @author Sebastin Cabanas
 */

public PantallaMarcadores(MeuXogoGame xogo) {
    this.meuxogogame = xogo;

    camara2d = new OrthographicCamera();
    batch = new SpriteBatch();
    fondo = new Texture(Gdx.files.internal("PantallaScore.png"));
    dedo = new Rectangle();
    boton = new Rectangle();

    // Preferences to load the Scores
    prefs = meuxogogame.getPrefs();
    cargarPuntActuales();

    // Write settings.
    bitMapFont = new BitmapFont();
    bitMapFont.setColor(Color.BLUE);
    bitMapFont.setScale(1.5f);
}