java - Libgdx when using skin in a Label it does not show when the application is being run -


i've trying give background labels in libgdx because without custom skin, left blank slate white text.

using skin editor found here, able make style of label liking want use in project. however, use of these files build skin, nothing seems happen.

with these files, i've tried using:

skin1 = new skin(gdx.files.internal("skins/uiskin.json"),             new textureatlas(gdx.files.internal("skins/uiskin.atlas"))); 

and using in table:

table table = new table(skin); 

and in labels:

label label = new label("test", skin); 

but no avail.

does have idea why still shows plain white text? thank much.

this uiskin.json file

{ com.badlogic.gdx.graphics.color: {     green: { g: 1, a: 1 },     light_grey: { r: 0.8, g: 0.8, b: 0.8, a: 1 },     white: { r: 1, g: 1, b: 1, a: 1 },     red: { r: 1, a: 1 },     yellow: { r: 1, g: 1, a: 1 },     grey: { r: 0.7, g: 0.7, b: 0.7, a: 1 },     black: { a: 1 } }, com.badlogic.gdx.graphics.g2d.bitmapfont: {     font_p_oorich_20pt: { file: font_p_oorich_20pt.fnt },     font_p_oorich_18pt: { file: font_p_oorich_18pt.fnt },     default-font: { file: default.fnt } }, com.badlogic.gdx.scenes.scene2d.ui.skin$tinteddrawable: {     dialogdim: {         name: white,         color: { a: 1, b: 0.2, g: 0.2, r: 0.2 }     } }, com.badlogic.gdx.scenes.scene2d.ui.progressbar$progressbarstyle: {     default: { background: default-scroll, knobbefore: default-round-large } }, com.badlogic.gdx.scenes.scene2d.ui.textbutton$textbuttonstyle: {     default: {         font: default-font,         fontcolor: { a: 1, b: 1, g: 1, r: 1 },         disabledfontcolor: { a: 1, b: 0.8, g: 0.8, r: 0.8 },         up: default-round,         down: default-round-down     },     toggle: {         font: default-font,         fontcolor: { a: 1, b: 1, g: 1, r: 1 },         downfontcolor: { a: 1, r: 1 },         up: default-round,         down: default-round-down,         checked: default-round-down     } }, com.badlogic.gdx.scenes.scene2d.ui.imagebutton$imagebuttonstyle: {     default: { imageup: paint_brush, up: default-round, down: default-round-down } }, com.badlogic.gdx.scenes.scene2d.ui.splitpane$splitpanestyle: {     default-vertical: { handle: default-splitpane-vertical },     default-horizontal: { handle: default-splitpane } }, com.badlogic.gdx.scenes.scene2d.ui.touchpad$touchpadstyle: {     default: { background: default-pane, knob: default-round-large } }, com.badlogic.gdx.scenes.scene2d.ui.button$buttonstyle: {     default: { up: default-round, down: default-round-down },     toggle: { up: default-round, down: default-round-down, checked: default-round-down } }, com.badlogic.gdx.scenes.scene2d.ui.window$windowstyle: {     default: {         background: default-window,         titlefont: default-font,         titlefontcolor: { a: 1, b: 1, g: 1, r: 1 }     },     dialog: {         background: default-window,         titlefont: default-font,         titlefontcolor: { a: 1, b: 1, g: 1, r: 1 },         stagebackground: dialogdim     } }, com.badlogic.gdx.scenes.scene2d.ui.textfield$textfieldstyle: {     default: {         font: default-font,         fontcolor: { a: 1, b: 1, g: 1, r: 1 },         background: textfield,         cursor: cursor,         selection: selection     } }, com.badlogic.gdx.scenes.scene2d.ui.scrollpane$scrollpanestyle: {     default: {         background: default-rect,         hscroll: default-scroll,         hscrollknob: default-round-large,         vscroll: default-scroll,         vscrollknob: default-round-large     } }, com.badlogic.gdx.scenes.scene2d.ui.label$labelstyle: {     optional: {         font: default-font,         fontcolor: { a: 1, b: 0.7, g: 0.7, r: 0.7 }     },     default: {         font: default-font,         fontcolor: { a: 1, b: 1, g: 1, r: 1 }     },     styletest: {         font: font_p_oorich_20pt,         fontcolor: { a: 1, g: 1, r: 1 },         background: default-round-large     },     error: {         font: default-font,         fontcolor: { a: 1, r: 1 }     },     title: {         font: default-font,         fontcolor: { a: 1, b: 0.8, g: 0.8, r: 0.8 }     },     mainlabel: {         font: font_p_oorich_20pt,         fontcolor: { a: 1, g: 1, r: 1 },         background: default-round-down     } }, com.badlogic.gdx.scenes.scene2d.ui.list$liststyle: {     default: {         font: default-font,         fontcolorselected: { a: 1, b: 1, g: 1, r: 1 },         fontcolorunselected: { a: 1, b: 1, g: 1, r: 1 },         selection: selection     },     dimmed: {         font: default-font,         fontcolorselected: { a: 1, b: 1, g: 1, r: 1 },         fontcolorunselected: { a: 1, b: 1, g: 1, r: 1 },         selection: selection,         background: dialogdim     } }, com.badlogic.gdx.scenes.scene2d.ui.checkbox$checkboxstyle: {     default: {         checkboxon: check-on,         checkboxoff: check-off,         font: default-font,         fontcolor: { a: 1, b: 1, g: 1, r: 1 }     } }, com.badlogic.gdx.scenes.scene2d.ui.tree$treestyle: {     default: { plus: tree-plus, minus: tree-minus, selection: default-select-selection } }, com.badlogic.gdx.scenes.scene2d.ui.slider$sliderstyle: {     default-vertical: { background: default-slider, knob: default-slider-knob },     default-horizontal: { background: default-slider, knob: default-slider-knob } }, com.badlogic.gdx.scenes.scene2d.ui.selectbox$selectboxstyle: {     default: {         font: default-font,         fontcolor: { a: 1, b: 1, g: 1, r: 1 },         background: default-select,         scrollstyle: default,         liststyle: default     } } } 

creating label did:

label label = new label("test", skin); 

takes default labelstyle skin, i.e., labelstyle name "default". in case style is:

default: {     font: default-font,     fontcolor: { a: 1, b: 1, g: 1, r: 1 } }, 

which specifies color white font color. if want different style can either change default color or specify different labelstyle label. e.g:

label label = new label("test", skin, "title"); 

will create label style "title", i.e.:

title: {     font: default-font,     fontcolor: { a: 1, b: 0.8, g: 0.8, r: 0.8 } }, 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -