Panel turns gray

Posted By: betuveen

Panel turns gray - 04/26/08 14:15


Hi, I'm using A7 and Sphere.
All of my panels turn white when the Sphere outdoor level loaded (they're still alright if I load them at the splash screen).

For example, the TGA Panel with alpha like this:


Will turns gray like this:



Do I have to set some flags? I've tried some but it doesn't work.
Thanks 4 reading n thank you very much for replying!
Posted By: mpdeveloper_B

Re: Panel turns gray - 04/26/08 14:26

make sure to put the entity on a layer, like layer = 2 or something. Also is it defined as a panel or an entity
Posted By: betuveen

Re: Panel turns gray - 04/26/08 20:57

Thanks mpdeveloper_B, it is defined as a panel, I tried to turn it to entity and it worked, the entity-interface displayed correctly.

But I want to re-use the Sphere's menu, which is defined as panel, the (turning gray) TGA panel will be used as the sphere's menu background, so to make them stick together well I have to use panel instead of entity.

Does anyone have the same problem and how to solve this turn gray bug? Please help me!

And I have another question ^^, if you did it and have some code that make a panel always be at the center of the screen (even if the player change resolution) please show me. Thank you!
Posted By: Xarthor

Re: Panel turns gray - 04/27/08 08:54

 Quote:

if you did it and have some code that make a panel always be at the center of the screen (even if the player change resolution) please show me. Thank you!

Pretty simple.
All you need is the panels bitmap width and height and the screen size values:
 Code:
function pan_center(_pan, _bitmap)
{
  _pan.pos_x = (screen_size.x - bmap_width(_bitmap)) / 2;
  _pan.pos_y = (screen_size.y - bmap_height(_bitmap)) / 2;
}

// TESTING:
bmap my_bitmap = <my_bitmap.tga>;
...
panel test_pan { bmap = my_bitmap; ... }
...
pan_center(test_pan,my_bitmap);

PLEASE NOTE: This is rather pseudo code and written down from the top of my head. Not sure if it works, but it should give you an idea how to solve your problem.
Posted By: betuveen

Re: Panel turns gray - 04/27/08 20:35

Thanks Xarthor, I'm an artist, not so good with coding! \:D
You're pro and nice, thanks for your help, I'm appreciated! \:\)
© 2024 lite-C Forums