more source files converted to use font::SIZE_*
- hopefully all hardcoded text heights are done now
This commit is contained in:
parent
6c4554b46e
commit
bff2c19a41
15 changed files with 93 additions and 89 deletions
|
@ -1735,7 +1735,7 @@ size_t move_unit(display* disp, const game_data& gamedata,
|
|||
//show messages on the screen here
|
||||
if(discovered_unit) {
|
||||
//we've been ambushed, so display an appropriate message
|
||||
font::add_floating_label(_("Ambushed!"),24,font::BAD_COLOUR,
|
||||
font::add_floating_label(_("Ambushed!"),font::SIZE_XLARGE,font::BAD_COLOUR,
|
||||
disp->map_area().w/2,disp->map_area().h/3,
|
||||
0.0,0.0,100,disp->map_area(),font::CENTER_ALIGN);
|
||||
}
|
||||
|
@ -1802,7 +1802,7 @@ size_t move_unit(display* disp, const game_data& gamedata,
|
|||
}
|
||||
const std::string message = config::interpolate_variables_into_string(msg.str(),&symbols);
|
||||
|
||||
font::add_floating_label(message,24,font::BAD_COLOUR,
|
||||
font::add_floating_label(message,font::SIZE_XLARGE,font::BAD_COLOUR,
|
||||
disp->map_area().w/2,disp->map_area().h/3,
|
||||
0.0,0.0,100,disp->map_area(),font::CENTER_ALIGN);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ const int SIZE_NORMAL = 14,
|
|||
SIZE_TINY = 10,
|
||||
SIZE_SMALL = 12,
|
||||
|
||||
SIZE_15 = 15,
|
||||
SIZE_PLUS = 16,
|
||||
SIZE_LARGE = 18,
|
||||
SIZE_XLARGE = 24
|
||||
|
@ -57,6 +58,7 @@ const int SIZE_NORMAL = 10,
|
|||
SIZE_TINY = 6,
|
||||
SIZE_SMALL = 8,
|
||||
|
||||
SIZE_15 = 11,
|
||||
SIZE_PLUS = 12,
|
||||
SIZE_LARGE = 14,
|
||||
SIZE_XLARGE = 20
|
||||
|
|
|
@ -887,7 +887,7 @@ bool event_handler::handle_event_command(const queued_event& event_info, const s
|
|||
//displaying a message on-screen
|
||||
else if(cmd == "print") {
|
||||
const std::string& text = cfg["text"];
|
||||
const int size = lexical_cast_default<int>(cfg["size"],12);
|
||||
const int size = lexical_cast_default<int>(cfg["size"],font::SIZE_SMALL);
|
||||
const int lifetime = lexical_cast_default<int>(cfg["duration"],20);
|
||||
const int red = lexical_cast_default<int>(cfg["red"],0);
|
||||
const int green = lexical_cast_default<int>(cfg["green"],0);
|
||||
|
|
89
src/help.cpp
89
src/help.cpp
|
@ -50,11 +50,11 @@ namespace {
|
|||
config dummy_cfg;
|
||||
std::vector<std::string> empty_string_vector;
|
||||
const int max_section_level = 15;
|
||||
const int menu_font_size = 14;
|
||||
const int title_size = 18;
|
||||
const int title2_size = 15;
|
||||
const int menu_font_size = font::SIZE_NORMAL;
|
||||
const int title_size = font::SIZE_LARGE;
|
||||
const int title2_size = font::SIZE_15;
|
||||
const int box_width = 2;
|
||||
const int normal_font_size = 12;
|
||||
const int normal_font_size = font::SIZE_SMALL;
|
||||
const unsigned max_history = 100;
|
||||
const std::string topic_img = "help/topic.png";
|
||||
const std::string closed_section_img = "help/closed_section.png";
|
||||
|
@ -644,29 +644,29 @@ std::vector<topic> generate_unit_topics() {
|
|||
// Dummy element, icons are below.
|
||||
first_row.push_back(item("", 0));
|
||||
first_row.push_back(item(bold(_("Name")),
|
||||
font::line_width(cap(_("Name")),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
font::line_width(cap(_("Name")),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
first_row.push_back(item(bold(_("Type")),
|
||||
font::line_width(_("Type"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
font::line_width(_("Type"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
first_row.push_back(item(bold(_("Dmg")),
|
||||
font::line_width(_("Dmg"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
font::line_width(_("Dmg"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
first_row.push_back(item(bold(_("Strikes")),
|
||||
font::line_width(_("Strikes"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
font::line_width(_("Strikes"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
first_row.push_back(item(bold(_("Range")),
|
||||
font::line_width(_("Range"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
font::line_width(_("Range"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
first_row.push_back(item(bold(_("Special")),
|
||||
font::line_width(_("Special"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
font::line_width(_("Special"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
table.push_back(first_row);
|
||||
// Print information about every attack.
|
||||
for (std::vector<attack_type>::const_iterator attack_it =attacks.begin();
|
||||
|
@ -685,7 +685,7 @@ std::vector<topic> generate_unit_topics() {
|
|||
std::stringstream attack_ss;
|
||||
attack_ss << "<img>src='" << (*attack_it).icon() << "'</img>";
|
||||
row.push_back(std::make_pair(attack_ss.str(),
|
||||
image_width(attack_it->icon())));
|
||||
image_width(attack_it->icon())));
|
||||
attack_ss.str("");
|
||||
push_tab_pair(row, lang_weapon);
|
||||
push_tab_pair(row, lang_type);
|
||||
|
@ -711,8 +711,9 @@ std::vector<topic> generate_unit_topics() {
|
|||
attack_ss << "<ref>dst='" << escape(ref_id) << "' text='"
|
||||
<< escape(lang_special) << "'</ref>";
|
||||
row.push_back(std::make_pair(attack_ss.str(),
|
||||
font::line_width(lang_special, normal_font_size)));
|
||||
|
||||
font::line_width(lang_special,
|
||||
normal_font_size)));
|
||||
|
||||
}
|
||||
table.push_back(row);
|
||||
}
|
||||
|
@ -725,13 +726,13 @@ std::vector<topic> generate_unit_topics() {
|
|||
table_spec resistance_table;
|
||||
std::vector<std::pair<std::string, unsigned> > first_res_row;
|
||||
first_res_row.push_back(std::make_pair(bold(_("Attack Type")),
|
||||
font::line_width(_("Attack Type"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
font::line_width(_("Attack Type"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
first_res_row.push_back(std::make_pair(bold(_("Resistance")),
|
||||
font::line_width(_("Resistance"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
font::line_width(_("Resistance"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
resistance_table.push_back(first_res_row);
|
||||
const unit_movement_type &movement_type = type.movement_type();
|
||||
string_map dam_tab = movement_type.damage_table();
|
||||
|
@ -754,7 +755,7 @@ std::vector<topic> generate_unit_topics() {
|
|||
str.str("");
|
||||
str << resistance << "%";
|
||||
row.push_back(std::make_pair(markup,
|
||||
font::line_width(str.str(), normal_font_size)));
|
||||
font::line_width(str.str(), normal_font_size)));
|
||||
resistance_table.push_back(row);
|
||||
}
|
||||
ss << generate_table(resistance_table);
|
||||
|
@ -765,17 +766,17 @@ std::vector<topic> generate_unit_topics() {
|
|||
std::vector<std::pair<std::string, unsigned> > first_row;
|
||||
table_spec table;
|
||||
first_row.push_back(std::make_pair(bold(_("Terrain")),
|
||||
font::line_width(_("Terrain"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
font::line_width(_("Terrain"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
first_row.push_back(std::make_pair(bold(_("Movement")),
|
||||
font::line_width(_("Movement"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
font::line_width(_("Movement"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
first_row.push_back(std::make_pair(bold(_("Defense")),
|
||||
font::line_width(_("Defense"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
font::line_width(_("Defense"),
|
||||
normal_font_size,
|
||||
TTF_STYLE_BOLD)));
|
||||
table.push_back(first_row);
|
||||
for (std::set<std::string>::const_iterator terrain_it =
|
||||
preferences::encountered_terrains().begin();
|
||||
|
@ -795,8 +796,8 @@ std::vector<topic> generate_unit_topics() {
|
|||
str << "<ref>text='" << escape(name) << "' dst='"
|
||||
<< escape(std::string("terrain_") + terrain) << "'</ref>";
|
||||
row.push_back(std::make_pair(str.str(),
|
||||
font::line_width(name,
|
||||
normal_font_size)));
|
||||
font::line_width(name,
|
||||
normal_font_size)));
|
||||
str.str("");
|
||||
if(moves < 100)
|
||||
str << moves;
|
||||
|
@ -1279,7 +1280,7 @@ void help_text_area::set_items(const std::vector<std::string> &parsed_items,
|
|||
const std::string show_title =
|
||||
font::make_text_ellipsis(shown_topic_->title, title_size, text_width());
|
||||
surface surf(font::get_rendered_text(show_title, title_size,
|
||||
font::NORMAL_COLOUR, TTF_STYLE_BOLD));
|
||||
font::NORMAL_COLOUR, TTF_STYLE_BOLD));
|
||||
if (surf != NULL) {
|
||||
add_item(item(surf, 0, 0, show_title));
|
||||
curr_loc_.second = title_spacing_;
|
||||
|
|
|
@ -82,8 +82,8 @@ void map_labels::set_label(const gamemap::location& loc, const std::string& str)
|
|||
const gamemap::location loc_nextx(loc.x+1,loc.y);
|
||||
const gamemap::location loc_nexty(loc.x,loc.y+1);
|
||||
const int xloc = (disp_.get_location_x(loc) + disp_.get_location_x(loc_nextx)*2)/3;
|
||||
const int yloc = disp_.get_location_y(loc_nexty) - 14;
|
||||
const int handle = font::add_floating_label(text,14,colour,xloc,yloc,0,0,-1,disp_.map_area());
|
||||
const int yloc = disp_.get_location_y(loc_nexty) - font::SIZE_NORMAL;
|
||||
const int handle = font::add_floating_label(text,font::SIZE_NORMAL,colour,xloc,yloc,0,0,-1,disp_.map_area());
|
||||
|
||||
labels_.insert(std::pair<gamemap::location,int>(loc,handle));
|
||||
|
||||
|
|
|
@ -137,10 +137,10 @@ public:
|
|||
generate_menu(true);
|
||||
|
||||
const std::string text = _("Waiting for game to start...");
|
||||
SDL_Rect rect = font::draw_text(NULL,disp_.screen_area(),14,font::NORMAL_COLOUR,text,0,0);
|
||||
SDL_Rect rect = font::draw_text(NULL,disp_.screen_area(),font::SIZE_NORMAL,font::NORMAL_COLOUR,text,0,0);
|
||||
rect.x = area.x + area.w/2 - rect.w/2;
|
||||
rect.y = area.y + (area.h*3)/4 - rect.h/2;
|
||||
font::draw_text(&disp_,rect,14,font::NORMAL_COLOUR,text,rect.x,rect.y);
|
||||
font::draw_text(&disp_,rect,font::SIZE_NORMAL,font::NORMAL_COLOUR,text,rect.x,rect.y);
|
||||
|
||||
cancel_button_.assign(new gui::button(disp_,_("Cancel")));
|
||||
cancel_button_->set_location(area.x+area.w - cancel_button_->width() - gui::ButtonHPadding,
|
||||
|
@ -775,10 +775,10 @@ void leader_preview_pane::draw()
|
|||
SDL_BlitSurface(unit_image,NULL,screen,&image_rect);
|
||||
}
|
||||
|
||||
font::draw_text(&disp(),area,16,font::NORMAL_COLOUR,faction,area.x + 80, area.y + 30);
|
||||
const SDL_Rect leader_rect = font::draw_text(&disp(),area,12,font::NORMAL_COLOUR,
|
||||
font::draw_text(&disp(),area,font::SIZE_PLUS,font::NORMAL_COLOUR,faction,area.x + 80, area.y + 30);
|
||||
const SDL_Rect leader_rect = font::draw_text(&disp(),area,font::SIZE_SMALL,font::NORMAL_COLOUR,
|
||||
_("Leader: "),area.x, area.y + 80);
|
||||
font::draw_wrapped_text(&disp(),area,12,font::NORMAL_COLOUR,
|
||||
font::draw_wrapped_text(&disp(),area,font::SIZE_SMALL,font::NORMAL_COLOUR,
|
||||
_("Recruits: ") + recruit_string.str(),area.x, area.y + 102,
|
||||
area.w);
|
||||
|
||||
|
|
|
@ -367,27 +367,27 @@ void mp_connect::set_area(const SDL_Rect& rect)
|
|||
//Title and labels
|
||||
gui::draw_dialog_title(left,top,disp_,_("Game Lobby"));
|
||||
|
||||
SDL_Rect labelr = font::draw_text(NULL,rect,14,font::GOOD_COLOUR,
|
||||
SDL_Rect labelr = font::draw_text(NULL,rect,font::SIZE_NORMAL,font::GOOD_COLOUR,
|
||||
_("Player/Type"),0,0);
|
||||
font::draw_text(disp_,rect,14,font::GOOD_COLOUR,
|
||||
font::draw_text(disp_,rect,font::SIZE_NORMAL,font::GOOD_COLOUR,
|
||||
_("Player/Type"),(left+30)+(launch_.width()/2)-(labelr.w/2),top+35);
|
||||
labelr = font::draw_text(NULL,rect,14,font::GOOD_COLOUR,_("Faction"),0,0);
|
||||
labelr = font::draw_text(NULL,rect,font::SIZE_NORMAL,font::GOOD_COLOUR,_("Faction"),0,0);
|
||||
|
||||
font::draw_text(disp_,rect,14,font::GOOD_COLOUR,
|
||||
font::draw_text(disp_,rect,font::SIZE_NORMAL,font::GOOD_COLOUR,
|
||||
_("Faction"),(left+145)+(launch_.width()/2)-(labelr.w/2),top+35);
|
||||
|
||||
labelr = font::draw_text(NULL,rect,14,font::GOOD_COLOUR,_("Team"),0,0);
|
||||
labelr = font::draw_text(NULL,rect,font::SIZE_NORMAL,font::GOOD_COLOUR,_("Team"),0,0);
|
||||
|
||||
font::draw_text(disp_,disp_->screen_area(),14,font::GOOD_COLOUR,
|
||||
font::draw_text(disp_,disp_->screen_area(),font::SIZE_NORMAL,font::GOOD_COLOUR,
|
||||
_("Team"),(left+260)+(launch_.width()/2)-(labelr.w/2),top+35);
|
||||
|
||||
labelr = font::draw_text(NULL,rect,14,font::GOOD_COLOUR,_("Color"),0,0);
|
||||
labelr = font::draw_text(NULL,rect,font::SIZE_NORMAL,font::GOOD_COLOUR,_("Color"),0,0);
|
||||
|
||||
font::draw_text(disp_,disp_->screen_area(),14,font::GOOD_COLOUR,
|
||||
font::draw_text(disp_,disp_->screen_area(),font::SIZE_NORMAL,font::GOOD_COLOUR,
|
||||
_("Color"),(left+375)+(launch_.width()/2)-(labelr.w/2),top+35);
|
||||
|
||||
labelr = font::draw_text(NULL,rect,14,font::GOOD_COLOUR,_("Gold"),0,0);
|
||||
font::draw_text(disp_,rect,14,font::GOOD_COLOUR,
|
||||
labelr = font::draw_text(NULL,rect,font::SIZE_NORMAL,font::GOOD_COLOUR,_("Gold"),0,0);
|
||||
font::draw_text(disp_,rect,font::SIZE_NORMAL,font::GOOD_COLOUR,
|
||||
_("Gold"),(left+480)+(launch_.width()/2)-(labelr.w/2),top+35);
|
||||
|
||||
//Per player settings
|
||||
|
@ -411,7 +411,7 @@ void mp_connect::set_area(const SDL_Rect& rect)
|
|||
const int side_num = sd - sides.first;
|
||||
|
||||
//Player number
|
||||
font::draw_text(disp_,rect, 24, font::GOOD_COLOUR,
|
||||
font::draw_text(disp_,rect, font::SIZE_XLARGE, font::GOOD_COLOUR,
|
||||
(*sd)->values["side"], left+10, top+53+(60*side_num));
|
||||
|
||||
//Player type
|
||||
|
@ -451,7 +451,7 @@ void mp_connect::set_area(const SDL_Rect& rect)
|
|||
r.w = 30;
|
||||
r.x = left+603;
|
||||
gold_bg_.push_back(surface_restorer(&disp_->video(),r));
|
||||
font::draw_text(disp_, disp_->screen_area(), 12, font::GOOD_COLOUR,
|
||||
font::draw_text(disp_, disp_->screen_area(), font::SIZE_SMALL, font::GOOD_COLOUR,
|
||||
"100", r.x, r.y);
|
||||
}
|
||||
|
||||
|
@ -543,7 +543,7 @@ void mp_connect::gui_update()
|
|||
rect.w = 30;
|
||||
rect.h = launch_.height();
|
||||
gold_bg_[n].restore();
|
||||
font::draw_text(disp_, disp_->screen_area(), 12,
|
||||
font::draw_text(disp_, disp_->screen_area(), font::SIZE_SMALL,
|
||||
font::GOOD_COLOUR,
|
||||
side["gold"],
|
||||
rect.x, rect.y);
|
||||
|
@ -557,11 +557,11 @@ void mp_connect::gui_update()
|
|||
message_bg_.restore();
|
||||
message_bg_ = surface_restorer();
|
||||
} else {
|
||||
SDL_Rect rect = font::draw_text(NULL,rect_,12,font::NORMAL_COLOUR,_("Waiting for network players to join"),0,0);
|
||||
SDL_Rect rect = font::draw_text(NULL,rect_,font::SIZE_SMALL,font::NORMAL_COLOUR,_("Waiting for network players to join"),0,0);
|
||||
rect.x = ai_.location().x + ai_.location().w + 10;
|
||||
rect.y = ai_.location().y;
|
||||
message_bg_ = surface_restorer(&disp_->video(),rect);
|
||||
font::draw_text(disp_,rect,12,font::NORMAL_COLOUR,_("Waiting for network players to join"),rect.x,rect.y);
|
||||
font::draw_text(disp_,rect,font::SIZE_SMALL,font::NORMAL_COLOUR,_("Waiting for network players to join"),rect.x,rect.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -695,7 +695,7 @@ lobby::RESULT mp_connect::process()
|
|||
rect.w = 30;
|
||||
rect.h = launch_.height();
|
||||
gold_bg_[n].restore();
|
||||
font::draw_text(disp_, rect_, 12,font::GOOD_COLOUR,(*sides.first[n])["gold"],
|
||||
font::draw_text(disp_, rect_, font::SIZE_SMALL,font::GOOD_COLOUR,(*sides.first[n])["gold"],
|
||||
rect.x, rect.y);
|
||||
update_rect(rect);
|
||||
level_changed = true;
|
||||
|
|
|
@ -2520,7 +2520,7 @@ void turn_info::create_textbox(floating_textbox::MODE mode, const std::string& l
|
|||
const int border_size = 10;
|
||||
|
||||
const int ypos = area.y+area.h-30 - (textbox_.check != NULL ? textbox_.check->height() + border_size : 0);
|
||||
textbox_.label = font::add_floating_label(label,14,font::YELLOW_COLOUR,area.x+border_size,ypos,0,0,-1,
|
||||
textbox_.label = font::add_floating_label(label,font::SIZE_NORMAL,font::YELLOW_COLOUR,area.x+border_size,ypos,0,0,-1,
|
||||
area,font::LEFT_ALIGN);
|
||||
if(textbox_.label == 0) {
|
||||
return;
|
||||
|
|
|
@ -655,9 +655,9 @@ slider_label_width_(0), tab_(GENERAL_TAB)
|
|||
{
|
||||
set_location(preferences_dialog_area);
|
||||
|
||||
slider_label_width_ = maximum<size_t>(font::text_area(music_label_,14).w,
|
||||
maximum<size_t>(font::text_area(sound_label_,14).w,
|
||||
maximum<size_t>(font::text_area(scroll_label_,14).w,font::text_area(gamma_label_,14).w)));
|
||||
slider_label_width_ = maximum<size_t>(font::text_area(music_label_,font::SIZE_NORMAL).w,
|
||||
maximum<size_t>(font::text_area(sound_label_,font::SIZE_NORMAL).w,
|
||||
maximum<size_t>(font::text_area(scroll_label_,font::SIZE_NORMAL).w,font::text_area(gamma_label_,font::SIZE_NORMAL).w)));
|
||||
|
||||
sound_slider_.set_min(1);
|
||||
sound_slider_.set_max(100);
|
||||
|
@ -809,7 +809,7 @@ void preferences_dialog::draw()
|
|||
|
||||
int ypos = location().y;
|
||||
if(tab_ == GENERAL_TAB) {
|
||||
font::draw_text(&disp(),location(),14,font::NORMAL_COLOUR,scroll_label_,location().x,ypos);
|
||||
font::draw_text(&disp(),location(),font::SIZE_NORMAL,font::NORMAL_COLOUR,scroll_label_,location().x,ypos);
|
||||
const SDL_Rect scroll_rect = {location().x + slider_label_width_,ypos,location().w - slider_label_width_ - border,scroll_slider_.location().h};
|
||||
scroll_slider_.set_location(scroll_rect);
|
||||
|
||||
|
@ -840,7 +840,7 @@ void preferences_dialog::draw()
|
|||
ypos += 50;
|
||||
|
||||
if(adjust_gamma()) {
|
||||
font::draw_text(&disp(),location(),14,font::NORMAL_COLOUR,gamma_label_,location().x,ypos);
|
||||
font::draw_text(&disp(),location(),font::SIZE_NORMAL,font::NORMAL_COLOUR,gamma_label_,location().x,ypos);
|
||||
}
|
||||
|
||||
const SDL_Rect gamma_rect = {location().x + slider_label_width_,ypos,location().w - slider_label_width_ - border,gamma_slider_.location().h};
|
||||
|
@ -862,13 +862,13 @@ void preferences_dialog::draw()
|
|||
video_mode_button_.set_location(location().x,ypos);
|
||||
|
||||
} else if(tab_ == SOUND_TAB) {
|
||||
font::draw_text(&disp(),location(),14,font::NORMAL_COLOUR,music_label_,location().x,ypos);
|
||||
font::draw_text(&disp(),location(),font::SIZE_NORMAL,font::NORMAL_COLOUR,music_label_,location().x,ypos);
|
||||
const SDL_Rect music_rect = {location().x + slider_label_width_,ypos,location().w - slider_label_width_ - border,music_slider_.location().h};
|
||||
music_slider_.set_location(music_rect);
|
||||
|
||||
ypos += 50;
|
||||
|
||||
font::draw_text(&disp(),location(),14,font::NORMAL_COLOUR,sound_label_,location().x,ypos);
|
||||
font::draw_text(&disp(),location(),font::SIZE_NORMAL,font::NORMAL_COLOUR,sound_label_,location().x,ypos);
|
||||
const SDL_Rect sound_rect = {location().x + slider_label_width_,ypos,location().w - slider_label_width_ - border,sound_slider_.location().h};
|
||||
sound_slider_.set_location(sound_rect);
|
||||
}
|
||||
|
@ -1026,7 +1026,7 @@ void show_hotkeys_dialog (display & disp, config *save_config)
|
|||
gui::draw_dialog(xpos,ypos,width,height,disp,_("Hotkey Settings"),NULL,&buttons,&restorer);
|
||||
|
||||
SDL_Rect clip_rect = { 0, 0, disp.x (), disp.y () };
|
||||
SDL_Rect text_size = font::draw_text(NULL, clip_rect, 16,
|
||||
SDL_Rect text_size = font::draw_text(NULL, clip_rect, font::SIZE_PLUS,
|
||||
font::NORMAL_COLOUR,_("Press desired HotKey"),
|
||||
0, 0);
|
||||
|
||||
|
@ -1084,7 +1084,7 @@ void show_hotkeys_dialog (display & disp, config *save_config)
|
|||
centery-text_size.h/2 - 6,
|
||||
text_size.w+40,
|
||||
text_size.h+12,disp);
|
||||
font::draw_text (&disp, clip_rect, 18,font::NORMAL_COLOUR,
|
||||
font::draw_text (&disp, clip_rect, font::SIZE_LARGE,font::NORMAL_COLOUR,
|
||||
_("Press desired HotKey"),centerx-text_size.w/2-10,
|
||||
centery-text_size.h/2-3);
|
||||
disp.update_display();
|
||||
|
|
|
@ -180,7 +180,7 @@ SDL_Rect draw_dialog_title(int x, int y, display* disp, const std::string& text)
|
|||
rect = disp->screen_area();
|
||||
}
|
||||
|
||||
return font::draw_text(disp,rect,18,font::TITLE_COLOUR,text,x,y+5,NULL,false,font::USE_MARKUP,TTF_STYLE_BOLD);
|
||||
return font::draw_text(disp,rect,font::SIZE_LARGE,font::TITLE_COLOUR,text,x,y+5,NULL,false,font::USE_MARKUP,TTF_STYLE_BOLD);
|
||||
}
|
||||
|
||||
void draw_dialog(int x, int y, int w, int h, display& disp, const std::string& title,
|
||||
|
@ -384,8 +384,8 @@ int show_dialog(display& disp, surface image,
|
|||
const std::vector<std::string>& menu_items =
|
||||
(menu_items_ptr == NULL) ? std::vector<std::string>() : *menu_items_ptr;
|
||||
|
||||
static const int message_font_size = 16;
|
||||
static const int caption_font_size = 18;
|
||||
static const int message_font_size = font::SIZE_PLUS;
|
||||
static const int caption_font_size = font::SIZE_LARGE;
|
||||
|
||||
CVideo& screen = disp.video();
|
||||
surface const scr = screen.getSurface();
|
||||
|
@ -410,7 +410,7 @@ int show_dialog(display& disp, surface image,
|
|||
text_widget.set_width(minimum<size_t>(disp.x()/2,maximum<size_t>(area.w,text_widget.location().w)));
|
||||
text_widget.set_height(minimum<size_t>(disp.y()/2,maximum<size_t>(area.h,text_widget.location().h)));
|
||||
text_widget_width = font::text_area(text_widget_label,message_font_size).w + text_widget.location().w;;
|
||||
text_widget_height = text_widget.location().h + 16;
|
||||
text_widget_height = text_widget.location().h + message_font_size;
|
||||
}
|
||||
|
||||
menu menu_(disp,menu_items,type == MESSAGE);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include "font.hpp"
|
||||
#include "language.hpp"
|
||||
#include "sdl_utils.hpp"
|
||||
#include "theme.hpp"
|
||||
|
@ -10,7 +11,7 @@ namespace {
|
|||
const int XDim = 1024;
|
||||
const int YDim = 768;
|
||||
|
||||
const size_t DefaultFontSize = 14;
|
||||
const size_t DefaultFontSize = font::SIZE_NORMAL;
|
||||
|
||||
SDL_Rect read_rect(const config& cfg) {
|
||||
SDL_Rect rect;
|
||||
|
|
|
@ -30,7 +30,7 @@ struct tooltip
|
|||
std::string message;
|
||||
};
|
||||
|
||||
static const int font_size = 12;
|
||||
static const int font_size = font::SIZE_SMALL;
|
||||
|
||||
std::vector<tooltip> tips;
|
||||
std::vector<tooltip>::const_iterator current_tooltip = tips.end();
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
namespace gui {
|
||||
|
||||
const int font_size = 12;
|
||||
const int font_size = font::SIZE_SMALL;
|
||||
const int horizontal_padding = 10;
|
||||
const int vertical_padding = 10;
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ void file_chooser::display_current_files() {
|
|||
const std::string display_string = std::string(" ,") + *it;
|
||||
to_show.push_back(display_string);
|
||||
}
|
||||
const int menu_font_size = 14; // Known from menu.cpp.
|
||||
const int menu_font_size = font::SIZE_NORMAL; // Known from menu.cpp.
|
||||
for (it = to_show.begin(); it != to_show.end(); it++) {
|
||||
// Make sure that all lines fit.
|
||||
// Guess the width of the scrollbar to be 30 since it is not accessible from here.
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
namespace gui {
|
||||
|
||||
const int font_size = 16;
|
||||
const int font_size = font::SIZE_PLUS;
|
||||
|
||||
textbox::textbox(display& d, int width, const std::string& text, bool editable, size_t max_size)
|
||||
: widget(d), max_size_(max_size), text_(string_to_wstring(text)),
|
||||
|
|
Loading…
Add table
Reference in a new issue