/vis-ui

libGDX UI toolkit

Primary LanguageJavaApache License 2.0Apache-2.0

VisUI

VisUI allows to create nice looking UI in LibGDX using scene2d.ui. Library contains scene2d.ui skin, useful widgets like color picker and file chooser, it also contains modified scene2d.ui widgets to provide some extra functionality like focus borders, background change on over and click, etc.

VisUI is licensed under Apache2 license meaning that you can use it for free in both commercial and non-commercial projects.

CHANGES file (definitely read before updating!)

Web demo! (source code)

VisUI screenshot Bigger screenshot

Adding VisUI to your project

Please refer to LibGDX documentaion if you don't know how to mange dependencies with Gradle. Alternatively JAR can be downloaded from Maven repository. If you are creating new project, you can use gdx-setup to automatically add VisUI for you. (press 'Show Third Party Extension' button)

Manual Gradle setup:

Open build.gradle in project root. In ext section under allprojects add:

visuiVersion = '1.4.6'

Core dependency

compile "com.kotcrab.vis:vis-ui:$visuiVersion"

HTML dependency (only if you are using HTML)

compile "com.kotcrab.vis:vis-ui:$visuiVersion:sources"

GdxDefinition.gwt.xml and GdxDefinitionSuperdev.gwt.xml:

<inherits name='com.kotcrab.vis.vis-ui' />

Refresh Gradle dependencies.

Multi-OS Engine

If you are using MOE add this line to your ios-moe/proguard.append.cfg file:

-keep class com.kotcrab.** { *; }

LibGDX compatibility

Table bellows shows what version of LibGDX you need for your version of VisUI.

VisUI LibGDX
1.4.3 1.9.9
1.4.5 1.9.10
1.4.6 1.9.11
1.4.7-SNAPSHOT 1.9.11

Using not matching versions may cause runtime exceptions.

CHANGES file (read before updating)

Usage

Using VisUI is pretty simple, to load or unload the skin call:

VisUI.load();
VisUI.dispose();

Create your UI like always, for extra skin features you have to use Vis widgets instead of standard scene2d.ui:

VisUI Standard scene2d.ui
VisLabel Label
LinkLabel -
VisCheckBox CheckBox
VisList List
VisProgressBar ProgressBar
VisRadioButton -
VisScrollPane ScrollPane
VisSelectBox SelectBox
VisSlider Slider
VisSplitPane SplitPane
VisTextArea TextArea
VisTextButton TextButton
VisImageTextButton ImageTextButton
VisImageButton ImageButton
VisTextField TextField
VisValidatableTextField -
VisTree Tree
VisWindow Window
VisTable Table
DragPane -
GridGroup -
ListView -
TabbedPane -
Spinner -
CollapsibleWidget -
ButtonBar -
FlowGroups -

Using Vis widgets is necessary for proper focus border management. All VisUI widgets constructors do not have Skin argument, they are using VisUI.skin field.

VisTable

VisTable allows to easily set default spacing for vis components, construct it like this:

VisTable table = new VisTable(true);

VisTable also allows adding vertical and horizontal separators to table:

table.addSeparator() //horizontal
table.addSeparator(true) //vertical

Using different SkinScales

Default VisUI skin can be too small for high resolution screens or mobile devices, in that case you can load a upscaled skin version simply by calling:

VisUI.load(SkinScale.X2);

Internal classes

Classes inside com.kotcrab.vis.[...].internal packages are considered private and aren't part of public API. Changes to that classes won't be listed in change log.

Default title align

Default title align for VisWindow and VisDialog is Align.left this can be changed by calling:

VisUI.setDefaultTitleAlign(int align)

Calling this method does not affect windows that have been already created.

Modifying skin

Raw skin files are available if you would like to modify them. After you pack them using LibGDX texture packer, add generated atlas to your project with uiskin.json, default.fnt and font-small.fnt and load it by calling:

VisUI.load(Gdx.files.internal("path/to/your/modified/files/uiskin.json"))

Consider using USL if you want to extend existing VisUI styles. Read more

See also

  • vis-ui-contrib - Community driven extension, utilities and skins for VisUI
  • gdx-setup - Alternative gdx-setup application - create your LibGDX projects with ease
  • ktx - Kotlin utilities for LibGDX applications, especially the ktx-vis and ktx-style-vis modules