android - Libgdx Scene2d Image from NinePatchDrawable doesn't rotate -


i creating image using ninepatchdrawable , trying rotate using rotateby method simply, not rotating somehow. using following code snippet:

textureatlas ninepatchatlas = game.getassetsinterface().gettextureatlas(constants.game_atlas); atlasregion region = ninepatchatlas.findregion("drawpatch"); ninepatch ninepatch = new ninepatch(region, 59, 59, 59, 59); ninepatchdrawable ninepatchdrawable = new ninepatchdrawable(ninepatch); image image = new image(ninepatchdrawable); image.setorigin(image.getwidth() / 2, image.getheight() / 2); image.setposition(200, 400); image.setwidth(150); image.rotateby(45); 

rotate working if use drawable instead of ninepatchdrawable on constructor of image. there facing same issue?

after investigating have decided use containers follows:

textureatlas ninepatchatlas = game.getassetsinterface().gettextureatlas(constants.game_atlas); atlasregion region = ninepatchatlas.findregion("drawpatch"); ninepatch ninepatch = new ninepatch(region, 59, 59, 59, 59); ninepatchdrawable ninepatchdrawable = new ninepatchdrawable(ninepatch); image image = new image(ninepatchdrawable); image.setwidth(150);  container<image> container = new container<image>(image); container.fill(); container.setsize(image.getwidth(), image.getheight()); container.setorigin(container.getwidth() / 2, container.getheight() / 2); container.settransform(true); container.setposition(image.getx(), image.gety()); container.rotateby(45); 

you can add container directly stage or use draw method in custom widget implementation.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -