That explains it. Thanks.
All right, here's what I'm going to call the "final" version of the automatic resizing panel function. I can't really take credit for it, given it's so much shorter and elegant than my initial version(which is long because of the per video_mode checks and some sloppy, early code). Anyway, this combines eleroux's basic function with a little bit of Heelx's.
I tested it...it works. I created a black panel at 1600x1200 and set a pox_x/pos_y of 200 in the panel declaration. After switching video_modes, the panel was resized and was in the exact same spot on the screen for every resolution after calling the funcion(in this case a simple pause screen). The bad news about doing it this way is that the video memory usage is going to be large if you use a lot of large bitmaps. That 1600x1200 black panel was around 8MB when active. My fullscreen filmgrain effect(from another contribution) clocks in at around 49MB(6 1600x1200 PCX files).
I don't know enough about bitmap formats and memory consumption, so perhaps using a different format(like DDS) would reduce the mem hit.
Code:
panel* pnl;
var maxRes[2] = 1600, 1200; //0 = represents your maximum supported X; 1 = represents your maxiumum supported Y
function panelRefresh(panel)
{
pnl = panel;
var tempScale[2];
if(pnl)
{
tempScale[0] = pnl.scale_x; //store current panel's X scale
tempScale[1] = pnl.scale_y; //store current panel's Y scale
//Scaling
pnl.scale_x = (screen_size.x / maxRes.x);
pnl.scale_y = (screen_size.y / maxRes.y);
//Modify position:
tempScale[0] = pnl.scale_x / tempScale[0];
tempScale[1] = pnl.scale_y / tempScale[1];
//Apply modification
pnl.pos_x *= tempScale[0];
pnl.pos_y *= tempScale[1];
//Switch the filter flag off if the current resolution = maxRex.x
pnl.filter = (screen_size.x != maxRes.x);
}
}
function scaleAllPanels() //panel names are examples. Change to reflect your own naming convention.
{
panelRefresh(pause);
panelRefresh(loadMenu);
panelRefresh(saveMenu);
panelRefresh(gameSavingScreen);
panelRefresh(mainMenu);
panelRefresh(credits);
panelRefresh(filmGrain);
panelRefresh(blackPanel);
..
..
..
..etc..
}