Home

Awesome

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

Maven Central

Please refer to libGDX documentation if you don't know how to manage 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.X.X'

Look at CHANGES file to see what version of VisUI you can use for your version of libGDX. Note that using not matching versions is likely to cause runtime exceptions.

Core dependency

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

HTML dependency (only if you are using GWT):

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

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

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

Refresh Gradle dependencies.

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:

VisUIStandard scene2d.ui
VisLabelLabel
LinkLabel-
VisCheckBoxCheckBox
VisListList
VisProgressBarProgressBar
VisRadioButton-
VisScrollPaneScrollPane
VisSelectBoxSelectBox
VisSliderSlider
VisSplitPaneSplitPane
VisTextAreaTextArea
VisTextButtonTextButton
VisImageTextButtonImageTextButton
VisImageButtonImageButton
VisTextFieldTextField
VisValidatableTextField-
VisTreeTree
VisWindowWindow
VisTableTable
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