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

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

Introduction

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

Prototype

Color RED

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

Click Source Link

Usage

From source file:com.izacc.ability.Aurelion.java

@Override
public void render(float delta) {
    shapeRenderer.setColor(Color.RED);
    shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
    shapeRenderer.circle(x, y, r);/*from  ww  w . j  a  v  a 2  s  .c  o  m*/
    shapeRenderer.end();
}

From source file:com.johnogel.astrobros.levels.LevelThree.java

@Override
public void initialize() {

    this.initializeWorld();

    this.ray_handler = mngr.getRayHandler();
    this.world = mngr.getWorld();
    this.camera = mngr.getCamera();

    width = mngr.getWidth();//from  ww  w  .  j av  a  2s. co  m
    height = mngr.getHeight();

    //this.ray_handler.dispose();

    //this.free_bros.add(new Player(world, camera, 1));
    //this.free_bros.add(new Player(world, camera, 120));
    //this.free_bros.add(new Player(world, camera, 100));
    this.free_bros.add(new Player(world, camera, 130));
    this.free_bros.add(new Player(world, camera, 160));
    this.free_bros.add(new Player(world, camera, 200));
    this.free_bros.add(new Player(world, camera, 240));

    //world.createJoint(joint_def);

    this.initializePlayer();
    this.initializeArrays();
    this.initializeContactListener();

    //adds sun to suns array without storing locally
    new Sun(this, suns, 8000, Color.RED, 1000, width / 2, height / 2);

    suns.get(0).initializeTexture(texture_handler, TextureHandler.SUN);

    this.setOrbits();

    this.initializeBoundaries();
    this.initializeBackground();
    this.initializeLocators();

}

From source file:com.johnogel.astrobros.managers.screens.GameOverScreen.java

@Override
public void initialize() {
    initializeWorld();/*from w  w  w .  j ava  2  s  .  com*/
    this.updateReferences();
    mngr.getSuperManager().getSoundPlayer().initializeLevelSounds();
    Music s = mngr.getSuperManager().getSoundPlayer().getSunSound();

    s.setLooping(true);
    s.play();
    new PointLight(ray_handler, 5000, Color.RED, 500, -camera.viewportWidth / 2, -300);
    new PointLight(ray_handler, 5000, Color.RED, 500, camera.viewportWidth / 2, -300);
    new PointLight(ray_handler, 5000, Color.RED, 500, -camera.viewportWidth / 2, 300);
    new PointLight(ray_handler, 5000, Color.RED, 500, camera.viewportWidth / 2, 300);

}

From source file:com.johnogel.astrobros.managers.screens.LevelLossScreen.java

@Override
public void initialize() {

    initializeWorld();/*from ww w .  ja  v  a  2s . c o m*/
    this.updateReferences();
    SoundPlayer sp = mngr.getSuperManager().getSoundPlayer();
    sp.setSong(SoundPlayer.BURNED_OUT);
    sp.setLooping(false);
    sp.setVolume(.9f);
    sp.playSong();
    new PointLight(ray_handler, 5000, Color.YELLOW, 500, -camera.viewportWidth / 2, -300);
    new PointLight(ray_handler, 5000, Color.YELLOW, 500, camera.viewportWidth / 2, -300);
    new PointLight(ray_handler, 5000, Color.YELLOW, 500, -camera.viewportWidth / 2, 300);
    new PointLight(ray_handler, 5000, Color.RED, 500, camera.viewportWidth / 2, 300);

}

From source file:com.kotcrab.vis.editor.module.physicseditor.models.RigidBodyModel.java

License:Apache License

public void computePhysics(Polygonizer polygonizer) {
    polygons.clear();//  w  w  w.  j ava 2s  . c o m
    circles.clear();

    for (ShapeModel shape : shapes) {
        if (!shape.isClosed())
            continue;

        if (shape.getType() == Type.POLYGON) {
            Vector2[] vertices = shape.getVertices().toArray(Vector2.class);
            Vector2[][] polys = Clipper.polygonize(polygonizer, vertices);
            if (polys != null)
                for (Vector2[] poly : polys) {

                    if (PolygonUtils.isDegenerate(poly)) {
                        App.eventBus.post(
                                new StatusBarEvent("Shape polygon is degenerated, removing shape", Color.RED));
                        shapesToRemove.add(shape);
                        continue;
                    }

                    polygons.add(new PolygonModel(poly));
                }

        }
        if (shape.getType() == Type.CIRCLE) {
            Vector2 center = shape.getVertices().get(0);
            float radius = Math.abs(shape.getVertices().get(1).cpy().sub(center).len());
            circles.add(new CircleModel(center, radius));
        }
    }

    shapes.removeAll(shapesToRemove, true);
    shapesToRemove.clear();

    firePropertyChanged(PROP_PHYSICS);
}

From source file:com.kotcrab.vis.editor.module.scene.entitymanipulator.tool.PolygonTool.java

License:Apache License

@Override
public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
    camera.unproject(tmpVector.set(x, y, 0));
    camera.project(tmpVector);// w  w  w.j  a v  a  2 s. c  om

    x = tmpVector.x;
    y = tmpVector.y;

    if (changePolygonAction != null) {
        if (PolygonUtils.isDegenerate(component.faces)) {
            changePolygonAction.takeSnapshot();
            changePolygonAction.undo();
            statusBar.setText("Polygon is degenerate", Color.RED, 3);
        } else if (checkCurrentVertexIntersection()) {
            changePolygonAction.takeSnapshot();
            changePolygonAction.undo();
            statusBar.setText("Invalid intersecting polygon", Color.RED, 3);
        } else {
            updateComponentFaces();
            changePolygonAction.takeSnapshot();
            undoModule.add(changePolygonAction);
            entityManipulator.selectedEntitiesChanged();
        }
        changePolygonAction = null;
    }

    if (button == Buttons.LEFT) {
        selectedVertex = null;
        if (component != null) {
            for (Vector2 v : component.vertices) {
                if (isInsidePoint(v, x, y, POLYGON_RECT_SIZE)) {
                    selectedVertex = v;
                    resetAfterTouchUp();
                    return;
                }
            }
        }
    }

    super.touchUp(event, x, y, pointer, button);
}

From source file:com.kotcrab.vis.editor.module.scene.entitymanipulator.tool.RotateTool.java

License:Apache License

@Override
public void render(ShapeRenderer shapeRenderer) {
    super.render(shapeRenderer);

    if (totalSelectionBounds != null) {
        innerRadius = camera.getZoom() * 0.6f * 100f / scene.pixelsPerUnit;
        outerRadius = camera.getZoom() * 0.7f * 100f / scene.pixelsPerUnit;

        circleCenterX = totalSelectionBounds.x + totalSelectionBounds.width / 2;
        circleCenterY = totalSelectionBounds.y + totalSelectionBounds.height / 2;

        shapeRenderer.setColor(Color.WHITE);
        shapeRenderer.begin(ShapeType.Line);
        shapeRenderer.circle(circleCenterX, circleCenterY, innerRadius, 36);
        shapeRenderer.circle(circleCenterX, circleCenterY, outerRadius, 36);

        float rotation = entityManipulator.getSelectedEntities().peek().getRotation();
        float startX = circleCenterX;
        float startY = circleCenterY - innerRadius;
        float endX = circleCenterX;
        float endY = circleCenterY + innerRadius;

        shapeRenderer.setColor(Color.RED);
        ShapeRendererUtils.lineRotatedAroundPoint(shapeRenderer, startX, startY, endX, endY, rotation,
                circleCenterX, circleCenterY);
        shapeRenderer.setColor(Color.GREEN);
        ShapeRendererUtils.lineRotatedAroundPoint(shapeRenderer, startX, startY, endX, endY, rotation + 90,
                circleCenterX, circleCenterY);

        shapeRenderer.end();//from ww  w. ja va 2 s  . c o m
    }
}

From source file:com.kotcrab.vis.editor.module.scene.entitymanipulator.tool.ScaleTool.java

License:Apache License

@Override
public void render(ShapeRenderer shapeRenderer) {
    super.render(shapeRenderer);

    if (totalSelectionBounds != null) {
        float centerX = totalSelectionBounds.x + totalSelectionBounds.width / 2;
        float centerY = totalSelectionBounds.y + totalSelectionBounds.height / 2;

        float centerRectSize = 0.1f * camera.getZoom() * 100f / scene.pixelsPerUnit;
        float lineLengthX = 1 * camera.getZoom() * 100f / scene.pixelsPerUnit;
        float lineLengthY = 1 * camera.getZoom() * 100f / scene.pixelsPerUnit;
        if (Gdx.input.isButtonPressed(Buttons.LEFT)) {
            if (mouseLooping.isOnVirtualScreen() == false) {
                if (mouseInsideRectX)
                    lineLengthX = camera.getInputX() - centerX;
                if (mouseInsideRectY)
                    lineLengthY = camera.getInputY() - centerY;
            } else {
                //if mouse is on virtual screen, method above won't work because line would be flipped
                //but also on virtual screen line end won't be visible anyways so we are just drawing very long line
                if (mouseInsideRectX)
                    lineLengthX = 100000;
                if (mouseInsideRectY)
                    lineLengthY = 100000;
            }/* w  ww. j a  va  2  s  .  c  o m*/
        }

        shapeRenderer.setColor(Color.GREEN);
        shapeRenderer.begin(ShapeType.Line);
        shapeRenderer.line(centerX, centerY, centerX + lineLengthX, centerY);
        shapeRenderer.end();

        shapeRenderer.setColor(mouseInsideRectX ? xRectOver : xRect);
        shapeRenderer.begin(ShapeType.Filled);
        rect(shapeRenderer, xScaleRect.set(centerX + lineLengthX - centerRectSize / 2,
                centerY - centerRectSize / 2, centerRectSize, centerRectSize));
        shapeRenderer.end();

        shapeRenderer.setColor(Color.RED);
        shapeRenderer.begin(ShapeType.Line);
        shapeRenderer.line(centerX, centerY, centerX, centerY + lineLengthY);
        shapeRenderer.end();

        shapeRenderer.setColor(mouseInsideRectY ? yRectOver : yRect);
        shapeRenderer.begin(ShapeType.Filled);
        rect(shapeRenderer, yScaleRect.set(centerX - centerRectSize / 2,
                centerY + lineLengthY - centerRectSize / 2, centerRectSize, centerRectSize));
        shapeRenderer.end();
    }
}

From source file:com.kotcrab.vis.editor.ui.dialog.EnterPathDialog.java

License:Apache License

public EnterPathDialog(FileHandle root, String relativePath,
        WindowResultListener<EnterPathDialogResult> listener) {
    super("Enter new path");
    this.listener = listener;

    setModal(true);/*from w  w w  . ja v  a2 s  .  c o  m*/
    addCloseButton();
    closeOnEscape();
    centerWindow();
    TableUtils.setSpacingDefaults(this);

    String extension = relativePath.substring(relativePath.lastIndexOf(".") + 1);

    VisLabel errorLabel = new VisLabel(" ");
    errorLabel.setColor(Color.RED);
    VisValidatableTextField fieldPath = new VisValidatableTextField(relativePath);

    VisTextButton refactorButton = new VisTextButton("Refactor");

    FormValidator validator = new FormValidator(refactorButton, errorLabel);
    validator.notEmpty(fieldPath, "Path is empty");
    validator.fileNotExists(fieldPath, root, "This file already exist");
    validator.custom(fieldPath, new FormInputValidator("The path is unchanged") {
        @Override
        protected boolean validate(String input) {
            return input.equals(relativePath) == false;
        }
    });
    validator.custom(fieldPath, new FormInputValidator("Extension cannot be changed") {
        @Override
        protected boolean validate(String input) {
            String newExt = input.substring(input.lastIndexOf(".") + 1);
            return newExt.equals(extension);
        }
    });

    add(fieldPath).colspan(2).expandX().fillX().row();
    add(errorLabel).width(200).expand().fill();
    add(refactorButton).padBottom(2).padRight(1);

    refactorButton.addListener(new VisChangeListener((event, actor) -> {
        listener.finished(new EnterPathDialogResult(fieldPath.getText()));
        fadeOut();
    }));

    pack();
}

From source file:com.kotcrab.vis.editor.ui.dialog.NewProjectDialogGeneric.java

License:Apache License

private void createUI() {
    projectRoot = new VisValidatableTextField("");
    outputDirectory = new VisValidatableTextField("");
    chooseRootButton = new VisTextButton("Choose...");
    chooseOutputButton = new VisTextButton("Choose...");

    errorLabel = new VisLabel();
    errorLabel.setColor(Color.RED);
    errorLabel.setWrap(true);/*  w  ww .j a  v  a2 s  .c  om*/

    TableUtils.setSpacingDefaults(this);
    columnDefaults(0).left();
    columnDefaults(1).expandX().fillX();

    row().padTop(4);
    add(new VisLabel("Project root"));
    add(projectRoot);
    add(chooseRootButton);
    row();

    add(new VisLabel("Output folder"));
    add(outputDirectory);
    add(chooseOutputButton);
    row();
    add(new VisLabel("Output folder is cleared on each export!")).colspan(3).row();

    VisTable buttonTable = new VisTable(true);
    buttonTable.defaults().minWidth(70);

    cancelButton = new VisTextButton("Cancel");
    createButton = new VisTextButton("Create");
    createButton.setDisabled(true);

    buttonTable.add(errorLabel).fill().expand();
    buttonTable.add(cancelButton).top();
    buttonTable.add(createButton).top();

    add(buttonTable).colspan(3).fillX().expandX();
}