java - libgdx, table in scrollpane -


i'm trying make shop game. in shop, there should 2 scroll pannel : 1 iventory's stuff, other 1 dealer sells.

(it 'd make way) http://i.stack.imgur.com/5glur.jpg

so @ first, tried put list in scrollpane, can't put both image of weapons , text in those. tried put table in scrollpane : long have stuff in inventory, add cells item's texture, 1 name of weapon, ...) there's no way found select table ...

so i'm bit confused : if use list, can't put texture , make fancy, tables, can't select items ...

have guys got ideas of how should ?

thanks !

edit : here code, no since it's pretty ugly !

table test3 = new table(skin2);     for(weaponelement weapon : gamescreen.dataloader.getweaponarray()){              image img = new image(new texture(weapon.geticonpath()));             test3.add(img).width(32);             test3.add().width(10);             test3.add(weapon.getname()).align(align.left).row();      }      panelshop = new scrollpane(test3, skin2);     panelshop.layout(); 

so basically, add weapons test3 table rows add scrollpane, i'd make them selectable, can using lists if so, can't use anymore tables make great...

what using buttons push? example below shows table 1 button row. use button text want display , add picture beside it.

table scrollabletable = new table(skin); scrollabletable.setbounds(0, 0, gdx.graphics.getwidth(), gdx.graphics.getheight());  for(weaponelement weapon : gamescreen.dataloader.getweaponarray()){     final textbutton button = new textbutton(wapon.name, skin, "default");     button.addlistener(new clicklistener() {         @override         public void clicked(inputevent event, float x, float y) {             // stuff         });     scrollabletable.add(button).center();      // add picture     image img = new image(new texture(weapon.geticonpath()));     scrollabletable.add(img).width(32);      // finish row     scrollabletable.row(); } 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -