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

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

Introduction

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

Prototype

Color GRAY

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

Click Source Link

Usage

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

License:Apache License

@Override
public void postInit() {
    Gdx.app.postRunnable(() -> {/*from  w w  w . jav a  2s  . c  o  m*/
        Menu toolMenus = menuBar.getToolsMenu();
        if (toolMenus.getChildren().size == 0) {
            toolMenus.add(new VisLabel("No tools available", Color.GRAY)).pad(2, 5, 2, 3);
            toolMenus.pack();
        }
    });

}

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

License:Apache License

private void createToolbarTable() {
    fileHistoryManager = new FileHistoryManager(VisUI.getSkin().get(FileChooserStyle.class),
            new FileHistoryCallback() {
                @Override/*  w w  w .j a va2s.c  o m*/
                public FileHandle getCurrentDirectory() {
                    return currentDirectory;
                }

                @Override
                public void setDirectory(FileHandle directory, HistoryPolicy policy) {
                    changeCurrentDirectory(directory, policy);
                }

                @Override
                public Stage getStage() {
                    return stage;
                }
            });

    contentTitleLabel = new VisLabel("Content");
    dirDescriptorTitleLabel = new VisLabel("", Color.GRAY);
    searchField = new SearchField(newText -> {
        if (currentDirectory == null)
            return true;
        if (currentDirectory.list().length == 0 || searchField.getText().length() == 0)
            return true;

        refreshFilesList();

        return filesDisplayed != 0;
    });

    navigateToParentButton = new VisImageButton(Icons.FOLDER_PARENT.drawable(), "Go to Parent Directory");
    navigateToParentButton.setGenerateDisabledImage(true);

    createFolderButton = new VisImageButton(Icons.FOLDER_NEW.drawable(), "Create New Folder");

    VisImageButton exploreButton = new VisImageButton(Icons.FOLDER_OPEN.drawable(), "Open in Explorer");
    //      VisImageButton settingsButton = new VisImageButton(Icons.SETTINGS_VIEW.drawable(), "Change view");
    //      VisImageButton importButton = new VisImageButton(Icons.IMPORT.drawable(), "Import");

    toolbarTable.add(navigateToParentButton);
    toolbarTable.add(createFolderButton);
    toolbarTable.add(fileHistoryManager.getButtonsTable());
    toolbarTable.add(contentTitleLabel).left().expand();
    toolbarTable.add(dirDescriptorTitleLabel);
    toolbarTable.add(exploreButton);
    //toolbarTable.add(settingsButton); //FIXME buttons
    //toolbarTable.add(importButton);
    toolbarTable.add(searchField);

    navigateToParentButton.addListener(new VisChangeListener((event, actor) -> {
        if (currentDirectory.equals(assetsFolder))
            return;
        changeCurrentDirectory(currentDirectory.parent());
    }));

    createFolderButton.addListener(new VisChangeListener((event, actor) -> {
        Dialogs.showInputDialog(mainTable.getStage(), FileChooserText.NEW_DIRECTORY_DIALOG_TITLE.get(),
                FileChooserText.NEW_DIRECTORY_DIALOG_TEXT.get(), true, new InputDialogAdapter() {
                    @Override
                    public void finished(String input) {
                        if (FileUtils.isValidFileName(input) == false) {
                            Dialogs.showErrorDialog(mainTable.getStage(),
                                    FileChooserText.NEW_DIRECTORY_DIALOG_ILLEGAL_CHARACTERS.get());
                            return;
                        }

                        for (FileHandle file : currentDirectory.list()) {
                            if (file.name().equals(input)) {
                                Dialogs.showErrorDialog(mainTable.getStage(),
                                        FileChooserText.NEW_DIRECTORY_DIALOG_ALREADY_EXISTS.get());
                                return;
                            }
                        }

                        currentDirectory.child(input).mkdirs();
                        refreshFilesList();
                    }
                });
    }));

    exploreButton.addListener(new VisChangeListener((event, actor) -> FileUtils.browse(currentDirectory)));
}

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

License:Apache License

private void createDefaultView(String type, String itemTypeName, boolean hideExtension) {
    this.type = type;

    VisLabel assetTypeLabel = new VisLabel(
            (hideExtension ? "" : file.extension().toUpperCase() + " ") + itemTypeName, Color.GRAY);
    assetTypeLabel.setWrap(true);/*from   ww w  . j  av a2 s.co  m*/
    assetTypeLabel.setAlignment(Align.center);
    add(assetTypeLabel).expandX().fillX().row();
    name = new VisLabel(file.nameWithoutExtension());
}

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

License:Apache License

public FolderItem(FileHandle file, boolean root) {
    this.file = file;
    VisLabel name = new VisLabel(file.name(), "small");
    name.setEllipsis(true);//from w ww .  j a  v  a  2  s . c  o m
    add(new Image(Icons.FOLDER.drawable())).size(20).padTop(3);
    add(name).expand().fill().padRight(5);
    if (root) {
        VisLabel rootLabel = new VisLabel("[root]", "small");
        rootLabel.setColor(Color.GRAY);
        add(rootLabel);
    }
}

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

License:Apache License

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

    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.ui.scene.entityproperties.autotable.provider.SelectFileFragmentProvider.java

License:Apache License

@Override
public void createUI(ATSelectFile annotation, Field field, Class<?> fieldType) {
    String fieldName = annotation.fieldName().equals("") ? field.getName() : annotation.fieldName();

    VisLabel fileLabel = new VisLabel();
    fileLabel.setColor(Color.GRAY);
    fileLabel.setEllipsis(true);/*from   w  ww .j av a  2s.com*/

    VisImageButton selectFileButton = new VisImageButton(Icons.MORE.drawable());

    VisTable table = new VisTable(true);
    table.left();
    table.add(new VisLabel(fieldName));
    table.add(fileLabel)
            .width(new VisWidgetValue(context -> Math.min(context.getMinWidth(), MAX_FILE_LABEL_WIDTH)));
    table.add(selectFileButton);

    Tooltip tooltip = new Tooltip.Builder("").target(fileLabel).build();

    uiTable.add(table).expandX().fillX().row();

    ATSelectFileHandlerGroup group = getHandlerGroup(annotation);
    ATSelectFileHandler handler = group.getByAlias(annotation.handlerAlias());
    ATExtSelectFileHandler extHandler = group.getExtByAlias(annotation.extHandlerAlias());
    if (handler == null)
        throw new IllegalStateException("Could not find handler for alias: " + annotation.handlerAlias()
                + " in group: " + annotation.handlerGroupClass());

    Holder<ATSelectFileHandler> handlerHolder = Holder.of(handler);
    FileHandle folder = fileAccessModule.getAssetsFolder();

    AssetDirectoryDescriptor directoryDescriptor = assetsMetadata
            .getDirectoryDescriptorForId(handlerHolder.value.getAssetDirectoryDescriptorId());
    final SelectFileDialog selectFileDialog = new SelectFileDialog(annotation.extension(),
            annotation.hideExtension(), folder, assetsMetadata, directoryDescriptor, file -> {
                for (EntityProxy proxy : properties.getSelectedEntities()) {
                    handlerHolder.value.applyChanges(proxy.getEntity(), file);
                }

                properties.getParentTab().dirty();
                properties.selectedEntitiesValuesChanged();
                properties.endSnapshot();
            });

    selectFileButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            if (extHandler != null) {
                String extension = extHandler.resolveExtension(properties.getSelectedEntities());
                if (extension == null) {
                    Dialogs.showOKDialog(stage, "Message",
                            "Select file dialog can't be showed for current selection because there is no common extension"
                                    + "for selected entities.");
                    return;
                }
                selectFileDialog.setExtensions(extension);
            }

            selectFileDialog.rebuildFileList();
            properties.beginSnapshot();
            stage.addActor(selectFileDialog.fadeIn());
        }
    });

    fileDialogLabels.put(field,
            new SelectFileDialogSet(fileLabel, tooltip, selectFileDialog, handler, extHandler));
}

From source file:com.kotcrab.vis.editor.ui.scene.entityproperties.MusicObjectTable.java

License:Apache License

@Override
protected void init() {
    loopingCheck = new IndeterminateCheckbox("Loop");
    playOnStartCheck = new IndeterminateCheckbox("Play on start");

    loopingCheck.addListener(properties.getSharedCheckBoxChangeListener());
    playOnStartCheck.addListener(properties.getSharedCheckBoxChangeListener());

    label = new VisLabel();
    label.setColor(Color.GRAY);

    left();/*from   ww w .  ja v  a  2  s .  c o  m*/
    defaults().left();
    add(TableBuilder.build(new VisLabel("Music:"), label)).row();
    add(TableBuilder.build(loopingCheck, playOnStartCheck));
}

From source file:com.kotcrab.vis.editor.ui.scene.entityproperties.specifictable.TextUITable.java

License:Apache License

@Override
protected void init() {
    textField = new VisValidatableTextField();
    textField.addListener(properties.getSharedChangeListener());
    textField.setProgrammaticChangeEvents(false);

    VisTable textTable = new VisTable(true);
    textTable.add(new VisLabel("Text"));
    textTable.add(textField).expandX().fillX();

    fontLabel = new VisLabel();
    fontLabel.setColor(Color.GRAY);
    fontLabel.setEllipsis(true);// ww w  .j ava2 s.  co  m
    fontLabelTooltip = new Tooltip(fontLabel, "");
    selectFontButton = new VisImageButton(Icons.MORE.drawable());

    fontPropertiesTable = new VisTable(true);
    fontPropertiesTable.add(new VisLabel("Font"));
    fontPropertiesTable.add(fontLabel)
            .width(new VisWidgetValue(context -> Math.min(context.getMinWidth(), MAX_FONT_LABEL_WIDTH)));
    fontPropertiesTable.add(selectFontButton);

    autoCenterOrigin = new IndeterminateCheckbox("Auto Set Origin to Center");
    autoCenterOrigin.addListener(properties.getSharedCheckBoxChangeListener());

    properties.getSceneModuleContainer().injectModules(this);

    selectFontButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            selectFontDialog.rebuildFileList();
            properties.beginSnapshot();
            getStage().addActor(selectFontDialog.fadeIn());
        }
    });

    selectFontDialog = new SelectFileDialog(getFontExtension(), fileAccess.getAssetsFolder(), file -> {
        for (EntityProxy proxy : properties.getSelectedEntities()) {
            Entity entity = proxy.getEntity();
            VisText text = entity.getComponent(VisText.class);
            AssetReference assetRef = entity.getComponent(AssetReference.class);
            VisAssetDescriptor asset = assetRef.asset;

            VisAssetDescriptor newAsset = null;

            if (asset instanceof BmpFontAsset) {
                BmpFontAsset fontAsset = (BmpFontAsset) asset;
                newAsset = new BmpFontAsset(fileAccess.relativizeToAssetsFolder(file),
                        fontAsset.getFontParameter());
            } else if (asset instanceof TtfFontAsset) {
                TtfFontAsset fontAsset = (TtfFontAsset) asset;
                newAsset = new TtfFontAsset(fileAccess.relativizeToAssetsFolder(file), fontAsset.getFontSize());
            } else
                throw new UnsupportedAssetDescriptorException(asset);

            text.setFont(fontCache.getGeneric(newAsset,
                    properties.getSceneModuleContainer().getScene().pixelsPerUnit));
            assetRef.asset = newAsset;
        }

        properties.getParentTab().dirty();
        properties.selectedEntitiesChanged();
        properties.endSnapshot();
    });

    defaults().left();
    add(autoCenterOrigin).row();
    add(textTable).expandX().fillX();
    row();
    add(fontPropertiesTable);
}

From source file:com.kotcrab.vis.editor.ui.scene.entityproperties.TextObjectTable.java

License:Apache License

@Override
protected void init() {
    textField = new VisValidableTextField();
    textField.addListener(properties.getSharedChangeListener());
    textField.setProgrammaticChangeEvents(false);

    VisTable textTable = new VisTable(true);
    textTable.add(new VisLabel("Text"));
    textTable.add(textField).expandX().fillX();

    fontLabel = new VisLabel();
    fontLabel.setColor(Color.GRAY);
    fontLabel.setEllipsis(true);/*from   ww w  .j a  v a2 s  . c o  m*/
    selectFontButton = new VisImageButton(Assets.getIcon(Icons.MORE));

    fontPropertiesTable = new VisTable(true);
    fontPropertiesTable.add(new VisLabel("Font"));
    fontPropertiesTable.add(fontLabel).width(100);
    fontPropertiesTable.add(selectFontButton);

    selectFontButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            selectFontDialog.rebuildFontList();
            properties.beginSnapshot();
            getStage().addActor(selectFontDialog.fadeIn());
        }
    });

    selectFontDialog = new SelectFontDialog(getFontExtension(), getFontFolder(), file -> {
        for (EditorObject entity : properties.getEntities()) {
            TextObject obj = (TextObject) entity;
            obj.setFont(properties.getFontCacheModule().get(file));
        }

        properties.getParentTab().dirty();
        properties.updateValues();
        properties.endSnapshot();
    });

    defaults().left();
    add(textTable).expandX().fillX();
    row();
    add(fontPropertiesTable);
}

From source file:com.kotcrab.vis.editor.ui.scene.LayerSettingsDialog.java

License:Apache License

public LayerSettingsDialog(ModuleInjector injector, EditorScene scene) {
    super("Layer Settings");
    injector.injectModules(this);

    EditorLayer layer = scene.getActiveLayer();

    TableUtils.setSpacingDefaults(this);
    setModal(true);/*w ww  .  jav  a2s  . c  om*/
    addCloseButton();
    closeOnEscape();

    defaults().left();

    VisLabel idLabel = new VisLabel();
    idLabel.setColor(Color.GRAY);
    VisValidatableTextField nameField = new VisValidatableTextField();
    EnumSelectBox<LayerCordsSystem> cordsSelectBox = new EnumSelectBox<>(LayerCordsSystem.class,
            new PrettyEnumNameProvider<>());
    add(new VisLabel("Layer ID"), idLabel);
    row();
    add(new VisLabel("Name"), nameField);
    row();
    add(new VisLabel("Coordinates system"));
    add(cordsSelectBox).width(150);
    row();

    idLabel.setText(String.valueOf(layer.id));
    nameField.setText(layer.name);
    cordsSelectBox.setSelectedEnum(layer.cordsSystem);

    VisLabel errorLabel = new VisLabel();
    errorLabel.setColor(Color.RED);

    VisTextButton cancelButton = new VisTextButton("Cancel");
    VisTextButton applyButton = new VisTextButton("Apply");

    cancelButton.addListener(new VisChangeListener((event, actor) -> fadeOut()));
    applyButton.addListener(new VisChangeListener((event, actor) -> {
        undoModule.execute(
                new ChangeLayerProperties(scene, layer, nameField.getText(), cordsSelectBox.getSelectedEnum()));
        fadeOut();
    }));

    VisTable bottomTable = new VisTable();

    bottomTable.add(errorLabel).expandX().fillX();
    bottomTable.add(TableBuilder.build(cancelButton, applyButton)).padTop(2).padLeft(3).padBottom(3).right();

    add(bottomTable).colspan(2).expandX().fillX();

    FormValidator validator = new FormValidator(applyButton, errorLabel);
    validator.notEmpty(nameField, "Name cannot be empty");
    validator.custom(nameField, new FormInputValidator("This name is already used") {
        @Override
        protected boolean validate(String input) {
            if (input.equals(layer.name))
                return true;

            return scene.getLayerByName(input) == null;
        }
    });

    pack();
    centerWindow();
}