Well I lost this code during a format so when I returned here to copy it back into a project I was working on I found some errors that escaped my attention so I worked on it a little and here's the new code
VECTOR desktop_size;
var vFont[5] = {8, 12, 24, 30, 36, 48};
var videoFont = 0;
void main()
{
//Set up the Menu
desktop_size.x = sys_metrics(0); // SM_CXSCREEN
desktop_size.y = sys_metrics(1); // SM_CYSCREEN
set_resolution(desktop_size.x,desktop_size.y);
//Create the MenuFonts
strToolFont = create_font("Airal",videoFont, "b");
fnt_tool = font_create(strToolFont);
//CreateMenu
pToolHud = pan_create(strToolHud,1);
panelRefresh(pToolHud);
set(pToolHud, VISIBLE);
}
STRING* strToolFont;
//////////////////////////////
// function set_resolution(x_,y_)
// Sets the screensize to the x_ and y_
//////////////////////////////
function set_resolution(x_,y_)
{
var new_ratio;
var view_aspect;
if(x_ == 640 && y_ == 480) {videoFont = vFont[0];}
if(x_ == 800 && y_ == 600) {videoFont = vFont[1];}
if(x_ == 1024 && y_ == 768) {videoFont = vFont[2];}
if(x_ == 1280 && y_ == 1024) {videoFont = vFont[3];}
if(x_ == 1400 && y_ == 1050) {videoFont = vFont[4];}
if(x_ == 1600 && y_ == 1200) {videoFont = vFont[5];}
video_set(x_, y_, 32, 1);
wait(1);
new_ratio = x_ / y_;
view_aspect = new_ratio / (4/3);
camera.aspect = view_aspect;
}
//////////////////////////////
// function panelRefresh(PANEL* sPanel)
// Rescales sPanel to fit the new resouloution
//////////////////////////////
function panelRefresh(PANEL* sPanel)
{
var HUD_reference[2] = {1600, 1200};
var PosX;
var PosY;
//Temp Postion
PosX = sPanel.pos_x;
PosY = sPanel.pos_y;
//Position
sPanel.pos_x = (screen_size.x / HUD_reference[0]) * PosX;
sPanel.pos_y = (screen_size.y / HUD_reference[1]) * PosY;
//Scaling
sPanel.scale_x = (screen_size.x / HUD_reference[0]);
sPanel.scale_y = (screen_size.y / HUD_reference[1]);
}
//////////////////////////////
// FUNCTION create_font(STRING* strFont, var sizeFont, STRING* strFormat)
// strFont - Name of the Font
// sizeFont = fontSize;
// strFormat = Bold Itallics
//////////////////////////////
function create_font(STRING* strFont, var sizeFont, STRING* strFormat)
{
STRING* tempstr = "#255";
STRING* tempsize = "#2";
str_clip(tempstr,255);
str_clip(tempsize, 2);
str_cpy(tempstr,strFont);
str_cat(tempstr,"#");
str_for_num(tempsize, sizeFont);
str_cat(tempstr,tempsize);
str_cat(tempstr,strFormat);
return(tempstr);
}
*Your pan_create I am sure will look diffrent then mine but heres how I set it up
STRING* strButton0 = "TEST";
FONT* fnt_tool;
//////////////////////////////
// Tool Hud
//////////////////////////////
PANEL* pToolHud;
STRING* strToolHud =
{
bmap = imgToolHud;
button 0, 39, buttonDn, buttonUp, buttonDn, NULL, NULL, NULL;
digits(206, 75, strButton0, fnt_tool, 0, NULL);
flags = CENTER_X, FILTER;
}
This is really an easy way to set up some dynamic menus based on your users settings Hope it works for you all now and you enjoy it