Panels and buttons

Stardragon

22-03-2010 11:23:23

Hey,

I was wondering if there might be a chance for a code snippet or a wiki tutorial on panels and buttons. I'm feeling very stupid lately, you see. :P I've decided to reduce the number of buttons on my Select Level screen, and stick them in panels (which will be invisible) for the purposes of Better Efficiency. :)

I also wanted to ask this: since there will be 50 buttons in all, would it be better to have 10 panels of 5 buttons or 5 panels of 10?

kungfoomasta

23-03-2010 18:49:30

Each Window is its own Texture, which would make up a batch. Whenever a Texture becomes dirty, the entire texture is redrawn, which takes up CPU. So having one giant texture to represent the UI would not be very efficient in terms of CPU usage, if the Texture needed to be redrawn a lot. However it would render very quickly. On the flip side, having a few textures would be a few batches, but each texture would probably be smaller and faster to update.

If your game is not super intensive, I would try 10 windows of 5 buttons. 10 batches won't probably make or break your game in terms of performance, and each window will probably be small and less CPU intensive to recreate it when dirty.

Stardragon

23-03-2010 21:34:15

That's fair enough. 10x5 is also easier for me, too, since the buttons are arranged in 10 rows of 5, and the numbers in each row are contiguous.

Rah. Thanks anyway, KFM. :-)