java - How do I make a ProgressBar work in LibGDX? -
i'm trying understand how utilize progressbar in libgdx.
i have created bar don't know how create works. want duplicate knob in order fill bar(background line) in 60 seconds. know how manage time, there no method in progressbar's class fill bar knob. @ least, haven't seen (or don't understand how, possibly). here code:
progressbar's code:
skin = new skin(); pixmap pixmap = new pixmap(10, 10, format.rgba8888); pixmap.setcolor(color.white); pixmap.fill(); skin.add("white", new texture(pixmap)); texturebar = new textureregiondrawable(new textureregion(new texture(gdx.files.internal("bargreen_horizontalmid.png")))); barstyle = new progressbarstyle(skin.newdrawable("white", color.dark_gray), texturebar); bar = new progressbar(0, 10, 0.5f, false, barstyle); bar.setposition(10, 10); bar.setsize(290, bar.getprefheight()); bar.setanimateduration(2); stage.addactor(bar);
i know can move knob method setvalue(float)
. want fill bar knob's texture. here bar's screenshot , knob.
can help me understand this? in advance.
i having same problem, , found out.
you have set style knobbefore attribute accomplish want. seek this:
barstyle = new progressbarstyle(skin.newdrawable("white", color.dark_gray), texturebar); barstyle.knobbefore = barstyle.knob; bar = new progressbar(0, 10, 0.5f, false, barstyle);
hope helps!
java libgdx progress-bar scene2d
No comments:
Post a Comment