Custom Actor Issues

Anything about development not directly related to libgdx, e.g. OpenGL, Android APIs etc.

Custom Actor Issues

Postby x_tech » Fri Apr 27, 2018 3:28 am

hey, so I've found the source of some performance issues I've been having. I built a custom ProgressIndicator actor to replace the ProgressBar actor. It's got a lot of sweet features (icons, text, animations, and you can also set the color of the fill without having to create a ninepatch). So here's my progress indicator: https://gist.github.com/wdavies973/2439 ... 9348503543. The performance issues are happening in the draw method. As you can see, I benchmarked different sections of it and got these timing results: Shapes: 429us Background: 45us Icon: 429us Font: 388us Warning: 18us what I'm not sure about is that background is a 64 x 64 png and takes no time to draw, while the icon is a 64 x 64 png and requires 10 times the time to draw. Also, some of the width and height variables may look fishy (using height for width) and this is simply because the icons are square, so I scale them to a square. Any idea on how to fix the performance issues? (This is only occuring on mobile)
x_tech
 
Posts: 5
Joined: Fri Nov 24, 2017 5:24 am

Re: Custom Actor Issues

Postby evilentity » Fri Apr 27, 2018 8:26 am

And all of this is in same atlas?
Making a font inside an actor is pretty poor idea. Pass it in.
Dont break the batch just to draw round rect. Use ninepatch or generate it if it really has to be specific size.
I hope these numbers are avarages over 10000 runs, not a value picked at random.
Looking for a freelancer? PM me!
evilentity
 
Posts: 4461
Joined: Wed Aug 24, 2011 11:37 am

Re: Custom Actor Issues

Postby x_tech » Fri Apr 27, 2018 9:32 pm

Good point on the found.

Is Pixmap the best one to use for generating shapes?

I didn't actually calculate a value, just look through about a 100 of them in the output and picked the most normal looking one lol... probably a bad practice.
x_tech
 
Posts: 5
Joined: Fri Nov 24, 2017 5:24 am


Return to General Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron