com.kotcrab.vis.ui.VisUI Java Examples

The following examples show how to use com.kotcrab.vis.ui.VisUI. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestFloatingGroup.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
@Override
public void create () {
	VisUI.load();

	stage = new Stage(new ScreenViewport());
	final Table root = new Table();
	root.setFillParent(true);
	stage.addActor(root);

	TestWindow window = new TestWindow();
	TestCollapsible collapsible = new TestCollapsible();
	window.setKeepWithinParent(true);
	window.setPosition(110, 110);
	collapsible.setKeepWithinParent(true);
	collapsible.setPosition(200, 200);

	FloatingGroup floatingGroup = new FloatingGroup(1000, 600);
	floatingGroup.addActor(window);
	floatingGroup.addActor(collapsible);

	root.debugAll();
	root.left().bottom();
	root.add(floatingGroup).padLeft(100).padBottom(100);

	Gdx.input.setInputProcessor(stage);
}
 
Example #2
Source File: TestVertical.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
private void addNormalWidgets () {
	ProgressBar progressbar = new ProgressBar(0, 100, 1, true, VisUI.getSkin());
	Slider slider = new Slider(0, 100, 1, true, VisUI.getSkin());
	Slider sliderDisabled = new Slider(0, 100, 1, true, VisUI.getSkin());

	progressbar.setValue(50);
	slider.setValue(50);
	sliderDisabled.setValue(50);
	sliderDisabled.setDisabled(true);

	VisTable progressbarTable = new VisTable(true);
	progressbarTable.add(progressbar);
	progressbarTable.add(slider);
	progressbarTable.add(sliderDisabled);

	add(progressbarTable);
}
 
Example #3
Source File: CalibrationScreen.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Screen that only shows the chosen sprites and can be exited with an exit button
 * @param game
 */
public CalibrationScreen( Game game) {
    this.game = game;
    this.cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    if(this.game instanceof OverlayGame) {
        this.renderer = new Renderer(cam, ((OverlayGame) this.game).getSprites());
    }
    else {
        this.renderer = new Renderer(cam, new Sprites());
    }

    this.stage = new Stage();

    // Load UI for buttons if not already loaded
    if(!VisUI.isLoaded())
        VisUI.load();

    // Create back button
    createBackButton();
}
 
Example #4
Source File: BasicColorPicker.java    From vis-ui with Apache License 2.0 6 votes vote down vote up
protected BasicColorPicker (ColorPickerWidgetStyle style, ColorPickerListener listener, boolean loadExtendedShaders) {
	this.listener = listener;
	this.style = style;
	this.sizes = VisUI.getSizes();

	oldColor = new Color(Color.BLACK);
	color = new Color(Color.BLACK);

	commons = new PickerCommons(style, sizes, loadExtendedShaders);

	createColorWidgets();
	createUI();

	updateValuesFromCurrentColor();
	updateUI();
}
 
Example #5
Source File: AnimationTool.java    From riiablo with Apache License 2.0 6 votes vote down vote up
@Override
public void dispose() {
  for (int l = 0; l < cof.getNumLayers(); l++) {
    COF.Layer layer = cof.getLayer(l);
    Animation.Layer animLayer = anim.getLayer(layer.component);
    if (animLayer != null) animLayer.getDC().dispose();
  }

  Riiablo.palettes.dispose();
  Riiablo.assets.dispose();
  Riiablo.shader.dispose();
  Riiablo.batch.dispose();
  Riiablo.shapes.dispose();
  VisUI.dispose();
  stage.dispose();
}
 
Example #6
Source File: VisImageButton.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
public VisImageButton (Drawable imageUp, Drawable imageDown, Drawable imageChecked) {
	super(new VisImageButtonStyle(VisUI.getSkin().get(VisImageButtonStyle.class)));
	style.imageUp = imageUp;
	style.imageDown = imageDown;
	style.imageChecked = imageChecked;

	init();
}
 
Example #7
Source File: TestTree.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
private void addNormalWidgets () {
	Skin skin = VisUI.getSkin();

	Tree tree = new Tree(skin);
	TestNode item1 = new TestNode(new Label("item 1", skin));
	TestNode item2 = new TestNode(new Label("item 2", skin));
	TestNode item3 = new TestNode(new Label("item 3", skin));

	item1.add(new TestNode(new Label("item 1.1", skin)));
	item1.add(new TestNode(new Label("item 1.2", skin)));
	item1.add(new TestNode(new Label("item 1.3", skin)));

	item2.add(new TestNode(new Label("item 2.1", skin)));
	item2.add(new TestNode(new Label("item 2.2", skin)));
	item2.add(new TestNode(new Label("item 2.3", skin)));

	item3.add(new TestNode(new Label("item 3.1", skin)));
	item3.add(new TestNode(new Label("item 3.2", skin)));
	item3.add(new TestNode(new Label("item 3.3", skin)));

	item1.setExpanded(true);

	tree.add(item1);
	tree.add(item2);
	tree.add(item3);

	add(tree).expand().fill();
}
 
Example #8
Source File: FileChooser.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
/**
 * @param styleName skin style name
 * @param title chooser window title
 * @param mode whether this chooser will be used to open or save files
 */
public FileChooser (String styleName, String title, Mode mode) {
	super(title);
	this.mode = mode;

	style = VisUI.getSkin().get(styleName, FileChooserStyle.class);
	sizes = VisUI.getSizes();

	init(null);
}
 
Example #9
Source File: MainMenuScreen.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Screen that only shows the chosen sprites and can be exited with an exit button
 * @param game
 */
public MainMenuScreen(Game game) {
    this.game = game;
    this.camera = new OrthographicCamera();
    this.viewport = new ExtendViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), this.camera);
    this.stage = new Stage(viewport);

    // Load UI for buttons if not already loaded
    if(!VisUI.isLoaded())
        VisUI.load();

    // Create buttons with listeners
    createButtons();
}
 
Example #10
Source File: TableUtils.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
/** Sets default table spacing for VisUI skin. Uses values from current skin {@link Sizes} class obtained from {@link VisUI#getSizes()}. */
public static void setSpacingDefaults (Table table) {
	Sizes sizes = VisUI.getSizes();
	if (sizes.spacingTop != 0) table.defaults().spaceTop(sizes.spacingTop);
	if (sizes.spacingBottom != 0) table.defaults().spaceBottom(sizes.spacingBottom);
	if (sizes.spacingRight != 0) table.defaults().spaceRight(sizes.spacingRight);
	if (sizes.spacingLeft != 0) table.defaults().spaceLeft(sizes.spacingLeft);
}
 
Example #11
Source File: TabbedPane.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
public TabButtonTable (Tab tab) {
	this.tab = tab;
	button = new VisTextButton(getTabTitle(tab), style.buttonStyle) {
		@Override
		public void setDisabled (boolean isDisabled) {
			super.setDisabled(isDisabled);
			closeButton.setDisabled(isDisabled);
			deselect();
		}
	};
	button.setFocusBorderEnabled(false);
	button.setProgrammaticChangeEvents(false);

	closeButtonStyle = new VisImageButtonStyle(VisUI.getSkin().get("close", VisImageButtonStyle.class));

	closeButton = new VisImageButton(closeButtonStyle);
	closeButton.setGenerateDisabledImage(true);
	closeButton.getImage().setScaling(Scaling.fill);
	closeButton.getImage().setColor(Color.RED);

	addListeners();

	buttonStyle = new VisTextButtonStyle((VisTextButtonStyle) button.getStyle());
	button.setStyle(buttonStyle);
	closeButtonStyle = closeButton.getStyle();
	up = buttonStyle.up;

	add(button);
	if (tab.isCloseableByUser()) {
		add(closeButton).size(14 * sizes.scaleFactor, button.getHeight());
	}
}
 
Example #12
Source File: ModuleWrapperGroup.java    From talos with Apache License 2.0 5 votes vote down vote up
@Override
public void read(Json json, JsonValue jsonData) {
    init(VisUI.getSkin());
    Color color = json.readValue(Color.class, jsonData.get("color"));
    String text = jsonData.getString("text");
    wrappers = json.readValue(ObjectSet.class, jsonData.get("modules"));
    setText(text);
    setColor(color);
}
 
Example #13
Source File: FontMetricsTool.java    From riiablo with Apache License 2.0 5 votes vote down vote up
@Override
public void dispose() {
  Riiablo.palettes.dispose();
  VisUI.dispose();
  Riiablo.assets.dispose();
  stage.dispose();
  Riiablo.shader.dispose();
  Riiablo.batch.dispose();
  Riiablo.shader.dispose();
}
 
Example #14
Source File: DS1Viewer.java    From riiablo with Apache License 2.0 5 votes vote down vote up
@Override
public void dispose() {
  VisUI.dispose();
  stage.dispose();
  shapes.dispose();
  palette.dispose();
  Riiablo.assets.dispose();
  Riiablo.batch.dispose();
  Riiablo.shader.dispose();
}
 
Example #15
Source File: TabbedPane.java    From riiablo with Apache License 2.0 5 votes vote down vote up
public TabbedPane() {
  clickListener = new ClickListener() {
    @Override
    public void clicked(InputEvent event, float x, float y) {
      Button button = (Button) event.getListenerActor();
      contentPanel.setActor(map.get(button.getName()));
      notifyTabSwitched(buttons.getChecked().getName(), button.getName());
    }
  };

  add(tabs = new VisTable()).growX().row();
  add(new Image(VisUI.getSkin().getDrawable("list-selection"))).growX().row();
  add(contentPanel = new Container<>()).align(Align.top).row();
}
 
Example #16
Source File: PackDialogController.java    From gdx-texture-packer-gui with Apache License 2.0 5 votes vote down vote up
@Override
public void onProcessingFinished() {
    btnClose.setDisabled(false);
    btnClose.setColor(Color.WHITE);

    FocusManager.switchFocus(stage, btnClose);

    window.closeOnEscape();

    if (!errors && cbAutoClose.isChecked()) {
        window.hide();
        showReopenLastDialogNotification();
    }

    // If there is only one pack, show log on error
    if (errors && adapter.size() == 1) {
        adapter.getView(adapter.get(0)).showLogWindow();
    }

    // Indicate total result by changing progress bar color
    {
        ProgressBar.ProgressBarStyle style = new ProgressBar.ProgressBarStyle(progressBar.getStyle());
        Drawable fill = errors ?
                VisUI.getSkin().getDrawable("progressBarErr") :
                VisUI.getSkin().getDrawable("progressBarSucc");
        style.knob = fill;
        style.knobBefore = fill;
        progressBar.setStyle(style);
    }
}
 
Example #17
Source File: Tooltip.java    From vis-ui with Apache License 2.0 5 votes vote down vote up
private Tooltip (Builder builder) {
	super(true);

	TooltipStyle style = builder.style;
	if (style == null) style = VisUI.getSkin().get("default", TooltipStyle.class);

	init(style, builder.target, builder.content);
	if (builder.width != -1) {
		contentCell.width(builder.width);
		pack();
	}
}
 
Example #18
Source File: Separator.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
/** New separator with default style */
public Separator () {
	style = VisUI.getSkin().get(SeparatorStyle.class);
}
 
Example #19
Source File: VisTextField.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
public VisTextField (String text) {
	this(text, VisUI.getSkin().get(VisTextFieldStyle.class));
}
 
Example #20
Source File: VisTextField.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
public VisTextField (String text, String styleName) {
	this(text, VisUI.getSkin().get(styleName, VisTextFieldStyle.class));
}
 
Example #21
Source File: VisTextField.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
public VisTextField () {
	this("", VisUI.getSkin().get(VisTextFieldStyle.class));
}
 
Example #22
Source File: MenuItem.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
public MenuItem (String text, Image image, ChangeListener changeListener) {
	this(text, image, VisUI.getSkin().get(MenuItemStyle.class));
	addListener(changeListener);
}
 
Example #23
Source File: Toast.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
/** @param content table content, preferably instance of {@link ToastTable} */
public Toast (String styleName, Table content) {
	this(VisUI.getSkin().get(styleName, ToastStyle.class), content);
}
 
Example #24
Source File: VisList.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
public VisList () {
	super(VisUI.getSkin());
	init();
}
 
Example #25
Source File: VisTextButton.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
public VisTextButton (String text, ChangeListener listener) {
	super(text, VisUI.getSkin().get(VisTextButtonStyle.class));
	init();
	addListener(listener);
}
 
Example #26
Source File: VisTree.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
public VisTree () {
	super(VisUI.getSkin());
	init();
}
 
Example #27
Source File: VisTree.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
public VisTree (String styleName) {
	super(VisUI.getSkin(), styleName);
	init();
}
 
Example #28
Source File: Menu.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
public Menu (String title, String styleName) {
	this(title, VisUI.getSkin().get(styleName, MenuStyle.class));
}
 
Example #29
Source File: ListView.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
public ListView (ListAdapter<ItemT> adapter, String styleName) {
	this(adapter, VisUI.getSkin().get(styleName, ListViewStyle.class));
}
 
Example #30
Source File: VisRadioButton.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
public VisRadioButton (String text) {
	this(text, VisUI.getSkin().get("radio", VisCheckBoxStyle.class));
}