@EvilSOB: Hm, sounds good... I did it the way Enduriel explained, but your solution for this problem sounds good, too!


@JCL: Defining the pos_x and pos_y coordinates in a panel definition has nothing to do with movement. If the variable given changes after the panel was defined, the panel does not have to change its position as well. The only purpose for a variable to be in a definition is flexibility - the flexibility to define screen-relative (and therefore resolution-independent) panel-positions. Of course this can be done in a function after the definition, but it would be cool if one could define things like

Code:
var my_screen_size_x = 1024;
var my_screen_size_y = 768;

PANEL* my_test_pan =
{
pos_x = my_screen_size_x / 2 + 30;
pos_y = my_screen_size_y / 2 + 50;
[...]
}


void main()
{
screen_size.x = my_screen_size_x;
screen_size.y = my_screen_size_y;

[...]

my_screen_size_x *= 2;        //the panel maintains its absolute position here,
my_screen_size_y *= 2;        //although the resolution is changed!
screen_size.x = my_screen_size_x;
screen_size.y = my_screen_size_y;

}



No matter what I enter for "my_screen_size_x" and "my_screen_size_y", the panel would maintain its relative position on the screen.
Of course, as mentioned, it can be done afterwards by a function. But a definition like the one I did above would make that function unneccessary.

Last edited by Alan; 08/25/09 11:53.