|Top Previous Next|
Every few weeks I hear this question: is it possible to have an animated sprite in a panel? Normally, I would answer "no" but this magazine proves me once again that I am wrong; we can create a sprite "entity" and place it anywhere on the screen.
First of all we create the panel:
panel energy_pan // background panel
Then we create the sprite entity, our animated sprite:
It is important to choose the correct x y z values because they will help you place the sprite in the place and with the size you need. All we need to do now is to change the animation frames using a simple function:
New debug code
I'm pretty sure that you know the rows of numbers that appear when you press the "D" key while running a level. I have to admit that I was pretty scared when I saw all those values (I'm still scared, but please keep the secret) mostly because I couldn't tell what they were. This new debug code will show a panel with many important figures and text that explains what they are. I hope that you will be able to optimize your levels with this new tool.
Let's take a look at the interesting values offered by the engine:
digits = 40,20,5,arial10_font,1,num_actions;
flags = overlay, refresh, d3d;
You can see that some of the values inside the panel definition appear without changes; the other values are calculated inside a while loop:
The first line deactivates the standard debug panel that appears when we press "D". All the values related to the video memory are expressed in Kb, so we divide them by 1024 to get them in Mb. We add all these values to get the memory used in the level and we compute the frame rate (1 / time) fast in order to see any frame rate drop / increase. The panel will appear / disappear when we press "D".
Please note that d3d_texfree can show a value that is bigger than the memory installed on your video card, because many modern 3D cards use different compression algorithms. Some of your customers will use older cards so it is better to keep an eye on "Total memory used" instead of "Texture free".