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

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

Introduction

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

Prototype

Color WHITE

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

Click Source Link

Usage

From source file:com.kevlanche.threedeetest.ScalableObjLoader.java

License:Apache License

public ModelMaterial getMaterial(final String name) {
    for (final ModelMaterial m : materials)
        if (m.id.equals(name))
            return m;
    ModelMaterial mat = new ModelMaterial();
    mat.id = name;// w  ww  .  ja v  a  2s.  c  o m
    mat.diffuse = new Color(Color.WHITE);
    materials.add(mat);
    return mat;
}

From source file:com.kotcrab.vis.editor.module.editor.StatusBarModule.java

License:Apache License

public void setText(String newText, int timeSeconds) {
    setText(newText, Color.WHITE, timeSeconds);
}

From source file:com.kotcrab.vis.editor.module.editor.StatusBarModule.java

License:Apache License

public void setText(String newText, Color color, int timeSeconds) {
    statusLabel.setText(newText);/*www  . j  a  v a 2s  . co m*/
    statusLabel.setColor(color == null ? Color.WHITE : color);
    timer.clear();
    timer.scheduleTask(resetTask, timeSeconds);
}

From source file:com.kotcrab.vis.editor.module.project.assetsmanager.AssetDragAndDrop.java

License:Apache License

private void addSource(FileItem item) {
    if (item.isMainFile() == false) {
        dragAndDrop.addSource(new VisDropSource(dragAndDrop, item)
                .defaultView("This file type is unsupported in this marked directory."));
        return;/*from w ww  .j  a  v  a  2  s  .  co m*/
    }
    String relativePath = fileAccess.relativizeToAssetsFolder(item.getFile());

    if (item.getType().equals(AssetType.TEXTURE)) {
        dragAndDrop.addSource(new Source(item) {
            @Override
            public Payload dragStart(InputEvent event, float x, float y, int pointer) {
                TextureRegionAsset asset = new TextureRegionAsset(
                        fileAccess.relativizeToAssetsFolder(item.getFile()));
                return createTexturePayload(item.getRegion(), asset);
            }
        });
    }

    if (item.getType().equals(AssetType.TTF_FONT)) {
        dragAndDrop.addSource(new Source(item) {
            @Override
            public Payload dragStart(InputEvent event, float x, float y, int pointer) {
                Payload payload = new Payload();

                TtfFontAsset asset = new TtfFontAsset(fileAccess.relativizeToAssetsFolder(item.getFile()),
                        FontCacheModule.DEFAULT_FONT_SIZE);
                payload.setObject(asset);

                BitmapFont font = fontCache.get(asset, 1);

                LabelStyle style = new LabelStyle(font, Color.WHITE);
                Label label = new VisLabel(FontCacheModule.DEFAULT_TEXT, style);
                payload.setDragActor(label);

                float invZoom = 1.0f / dropTarget.getCameraZoom();
                label.setFontScale(invZoom);
                dragAndDrop.setDragActorPosition(-label.getWidth() * invZoom / 2, label.getHeight() / 2);

                return payload;
            }
        });
    }

    if (item.getType().equals(AssetType.BMP_FONT_FILE) || item.getType().equals(AssetType.BMP_FONT_TEXTURE)) {
        dragAndDrop.addSource(new Source(item) {
            @Override
            public Payload dragStart(InputEvent event, float x, float y, int pointer) {
                Payload payload = new Payload();

                FileHandle fontFile;

                if (item.getType().equals(AssetType.BMP_FONT_FILE))
                    fontFile = item.getFile();
                else
                    fontFile = FileUtils.sibling(item.getFile(), "fnt");

                BmpFontAsset asset = new BmpFontAsset(fileAccess.relativizeToAssetsFolder(fontFile),
                        new BitmapFontParameter());

                payload.setObject(asset);

                LabelStyle style = new LabelStyle(fontCache.get(asset, 1), Color.WHITE);
                Label label = new VisLabel(FontCacheModule.DEFAULT_TEXT, style);
                payload.setDragActor(label);

                float invZoom = 1.0f / dropTarget.getCameraZoom();
                label.setFontScale(invZoom);
                dragAndDrop.setDragActorPosition(-label.getWidth() * invZoom / 2, label.getHeight() / 2);

                return payload;
            }
        });
    }

    if (item.getType().equals(AssetType.PARTICLE_EFFECT)) {
        dragAndDrop.addSource(new VisDropSource(dragAndDrop, item)
                .defaultView("New Particle Effect \n (drop on scene to add)")
                .setPayload(new ParticleAsset(relativePath)));
    }

    if (item.getType().equals(AssetType.MUSIC)) {
        dragAndDrop.addSource(new VisDropSource(dragAndDrop, item)
                .defaultView("New Music \n (drop on scene to add)").setPayload(new MusicAsset(relativePath)));
    }

    if (item.getType().equals(AssetType.SOUND)) {
        dragAndDrop.addSource(new VisDropSource(dragAndDrop, item)
                .defaultView("New Sound \n (drop on scene to add)").setPayload(new SoundAsset(relativePath)));
    }

    if (item.getType().equals(AssetType.UNKNOWN) == false && item.getSupport() != null) {
        Source source = item.getSupport().createDropSource(dragAndDrop, item);
        if (source != null)
            dragAndDrop.addSource(source);
    }
}

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

License:Apache License

@Override
public void render(Batch batch) {
    batch.end();/*w ww  . ja  v  a 2s.  co m*/
    shapeRenderer.setProjectionMatrix(camera.getCombinedMatrix());

    if (currentTool.isRenderBoundsEnabled() && entitiesSelection.size() > 0) {
        shapeRenderer.setColor(Color.WHITE);
        shapeRenderer.begin(ShapeType.Line);

        for (SelectionFragment fragment : entitiesSelection.getFragmentedSelection()) {
            Rectangle bounds = fragment.getBoundingRectangle();
            shapeRenderer.rect(bounds.x, bounds.y, bounds.width, bounds.height);
        }

        shapeRenderer.end();
    }
    entityMoveTimerTask.update();

    currentTool.render(shapeRenderer);

    batch.begin();

    currentTool.render(batch);
}

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

License:Apache License

@Override
public void render(Batch batch) {
    lineOverStartVertex = null;/*from   w ww  .  j  ava  2s. c  om*/

    if (component != null) {
        batch.setProjectionMatrix(stage.getCamera().combined);

        camera.unproject(tmpVector.set(Gdx.input.getX(), Gdx.input.getY(), 0));

        float worldMouseX = tmpVector.x;
        float worldMouseY = tmpVector.y;

        drawnFacesLines.clear();
        if ((dynamicUpdateCheck.isChecked() == false && Gdx.input.isButtonPressed(Buttons.LEFT)) == false) {
            batch.setColor(Color.GRAY);
            if (component.faces != null) {
                for (int i = 0; i < component.faces.length; i++) {
                    Vector2[] faces = component.faces[i];

                    for (int j = 1; j < faces.length; j++) {
                        drawFaceLine(batch, faces[j], faces[j - 1]);
                    }

                    drawFaceLine(batch, faces[0], faces[faces.length - 1]);
                }
            }
        }

        Array<Vector2> vertices = component.vertices;
        batch.setColor(mainColor);
        for (int i = 1; i < vertices.size; i++) {
            drawPolygonBorderLine(batch, vertices.get(i), vertices.get(i - 1), worldMouseX, worldMouseY);
        }

        if (vertices.size > 1) {
            drawPolygonBorderLine(batch, vertices.get(0), vertices.get(vertices.size - 1), worldMouseX,
                    worldMouseY);
        }

        batch.setColor(Color.WHITE);
        for (Vector2 vertex : vertices) {
            tmpVector.set(vertex.x, vertex.y, 0);
            camera.project(tmpVector);

            TextureRegion region = polygon;

            if (vertex == selectedVertex)
                region = polygonDown;
            else if (vertex == overVertex)
                region = polygonOver;

            batch.draw(region, tmpVector.x - POLYGON_RECT_SIZE / 2, tmpVector.y - POLYGON_RECT_SIZE / 2);
        }
    }
}

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.  j  av a2 s  . c  om
    }
}

From source file:com.kotcrab.vis.editor.module.scene.EntityManipulatorModule.java

License:Apache License

@Override
public void render(Batch batch) {
    batch.end();// w ww. java 2 s  . c om
    if (selectedEntities.size > 0) {

        shapeRenderer.setProjectionMatrix(camera.getCombinedMatrix());
        shapeRenderer.setColor(Color.WHITE);
        shapeRenderer.begin(ShapeType.Line);

        for (EditorObject entity : selectedEntities) {
            Rectangle bounds = entity.getBoundingRectangle();
            shapeRenderer.rect(bounds.x, bounds.y, bounds.width, bounds.height);
        }

        shapeRenderer.end();

    }

    rectangularSelection.render(shapeRenderer);

    batch.begin();
}

From source file:com.kotcrab.vis.editor.ui.IndeterminateTextField.java

License:Apache License

public IndeterminateTextField(VisValidatableTextField textField) {
    this.textField = textField;
    textField.setStyle(new VisTextField.VisTextFieldStyle(textField.getStyle()));
    textField.setProgrammaticChangeEvents(false);
    textField.addListener(new ChangeListener() {
        @Override/*from w ww . j  a v  a  2  s.com*/
        public void changed(ChangeEvent event, Actor actor) {
            if (indeterminate) {
                textField.getStyle().fontColor = Color.WHITE;
                indeterminate = false;
            }

            text = textField.getText();
        }
    });
    text = textField.getText();
}

From source file:com.kotcrab.vis.editor.ui.IndeterminateTextField.java

License:Apache License

private void updateText() {
    if (indeterminate) {
        textField.setText("<?>");
        textField.getStyle().fontColor = Color.LIGHT_GRAY;
    } else {/*from w  w w .  j a va 2  s .  co m*/
        textField.setText(text);
        textField.getStyle().fontColor = Color.WHITE;
    }
}