made position of buttons on title screen more configurable

This commit is contained in:
uid68803 2004-02-24 20:30:44 +00:00
parent 5b918e32bf
commit 1340c72fc9
4 changed files with 10 additions and 8 deletions

View file

@ -32,6 +32,7 @@
buttons_x=750
buttons_y=300
buttons_padding=20
logo_x=500
logo_y=20

View file

@ -29,7 +29,7 @@ namespace game_config
bool debug = false;
std::string game_icon, game_title, game_logo, title_music;
int title_logo_x = 0, title_logo_y = 0, title_buttons_x = 0, title_buttons_y = 0;
int title_logo_x = 0, title_logo_y = 0, title_buttons_x = 0, title_buttons_y = 0, title_buttons_padding = 0;
std::string missile_n_image, missile_ne_image;
@ -80,6 +80,7 @@ namespace game_config
title_logo_y = atoi(v["logo_y"].c_str());
title_buttons_x = atoi(v["buttons_x"].c_str());
title_buttons_y = atoi(v["buttons_y"].c_str());
title_buttons_padding = atoi(v["buttons_padding"].c_str());
map_image = v["map_image"];
rightside_image = v["sidebar_image"];

View file

@ -42,7 +42,7 @@ namespace game_config
foot_left_nw,foot_left_n,foot_right_nw,foot_right_n,
missile_n_image,missile_ne_image;
extern int title_logo_x, title_logo_y, title_buttons_x, title_buttons_y;
extern int title_logo_x, title_logo_y, title_buttons_x, title_buttons_y, title_buttons_padding;
void load_config(const config* cfg);
}

View file

@ -779,17 +779,18 @@ TITLE_RESULT show_title(display& screen)
10,font::NORMAL_COLOUR,version_str,0,versiony);
}
const int menu_xbase = (game_config::title_buttons_x*screen.x())/1024;
const int menu_xincr = 0;
const int menu_ybase = (game_config::title_buttons_y*screen.y())/768;
const int menu_yincr = 40;
//members of this array must correspond to the enumeration TITLE_RESULT
static const std::string button_labels[] = { "tutorial_button", "campaign_button", "multiplayer_button",
"load_button", "language_button", "preferences", "about_button", "quit_button" };
static const size_t nbuttons = sizeof(button_labels)/sizeof(*button_labels);
const int menu_xbase = (game_config::title_buttons_x*screen.x())/1024;
const int menu_xincr = 0;
const int menu_ybase = (game_config::title_buttons_y*screen.y())/768;
const int menu_yincr = 40;
const int padding = game_config::title_buttons_padding;
std::vector<button> buttons;
size_t b, max_width = 0;
for(b = 0; b != nbuttons; ++b) {
@ -798,7 +799,6 @@ TITLE_RESULT show_title(display& screen)
max_width = maximum<size_t>(max_width,buttons.back().width());
}
const size_t padding = 10;
std::string style = "mainmenu";
draw_dialog_frame(menu_xbase-padding,menu_ybase-padding,max_width+padding*2,menu_yincr*(nbuttons-1)+buttons.back().height()+padding*2,screen,&style);