mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-04 21:17:55 +00:00
User interface polishing:
* MP lobby: improved background * MP lobby: tweaked margins and paddings * MP lobby: getting rid of font::GOOD_COLOUR * MP lobby: fixed multiplayer_wait game_menu_'s width * Slider is now less "bright" * The text of disabled buttons is now grayed out
This commit is contained in:
parent
5005af382e
commit
c3a75bd53b
@ -312,12 +312,14 @@ void set_font_list(const std::vector<subset_descriptor>& fontlist)
|
||||
}
|
||||
|
||||
const SDL_Color NORMAL_COLOUR = {0xDD,0xDD,0xDD,0},
|
||||
LOBBY_COLOUR = {0xBB,0xBB,0xBB,0},
|
||||
GOOD_COLOUR = {0x00,0xFF,0x00,0},
|
||||
BAD_COLOUR = {0xFF,0x00,0x00,0},
|
||||
BLACK_COLOUR = {0x00,0x00,0x00,0},
|
||||
DARK_COLOUR = {0x00,0x00,0x66,0},
|
||||
YELLOW_COLOUR = {0xFF,0xFF,0x00,0},
|
||||
BUTTON_COLOUR = {0xBC,0xB0,0x88,0},
|
||||
STONED_COLOUR = {0xA0,0xA0,0xA0,0},
|
||||
TITLE_COLOUR = {0xBC,0xB0,0x88,0};
|
||||
|
||||
const char LARGE_TEXT='*', SMALL_TEXT='`', GOOD_TEXT='@', BAD_TEXT='#',
|
||||
|
@ -44,8 +44,9 @@ struct subset_descriptor
|
||||
void set_font_list(const std::vector<subset_descriptor>& fontlist);
|
||||
|
||||
//various standard colours
|
||||
extern const SDL_Color NORMAL_COLOUR, GOOD_COLOUR, BAD_COLOUR, BLACK_COLOUR,
|
||||
DARK_COLOUR, YELLOW_COLOUR, BUTTON_COLOUR, TITLE_COLOUR;
|
||||
extern const SDL_Color NORMAL_COLOUR, LOBBY_COLOUR, GOOD_COLOUR, BAD_COLOUR,
|
||||
BLACK_COLOUR, DARK_COLOUR, YELLOW_COLOUR, BUTTON_COLOUR,
|
||||
STONED_COLOUR, TITLE_COLOUR;
|
||||
|
||||
//standard markups
|
||||
extern const char LARGE_TEXT, SMALL_TEXT, GOOD_TEXT, BAD_TEXT, NORMAL_TEXT, BLACK_TEXT, BOLD_TEXT, IMAGE, NULL_MARKUP;
|
||||
|
@ -49,7 +49,7 @@ connect::side::side(connect& parent, const config& cfg, int index) :
|
||||
index_(index),
|
||||
|
||||
player_number_(parent.video(), lexical_cast_default<std::string>(index+1, ""),
|
||||
font::SIZE_XLARGE, font::GOOD_COLOUR),
|
||||
font::SIZE_LARGE, font::LOBBY_COLOUR),
|
||||
combo_controller_(parent.disp(), parent.player_types_),
|
||||
orig_controller_(parent.video(), cfg["description"], font::SIZE_SMALL),
|
||||
combo_faction_(parent.disp(), parent.player_factions_),
|
||||
@ -57,7 +57,7 @@ connect::side::side(connect& parent, const config& cfg, int index) :
|
||||
combo_team_(parent.disp(), parent.player_teams_),
|
||||
combo_colour_(parent.disp(), parent.player_colours_),
|
||||
slider_gold_(parent.video()),
|
||||
label_gold_(parent.video(), "100", font::SIZE_NORMAL, font::GOOD_COLOUR),
|
||||
label_gold_(parent.video(), "100", font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
enabled_(!parent_->params_.saved_game),
|
||||
changed_(false),
|
||||
llm_(parent.era_sides_, &parent.game_data_, enabled_ ? &combo_leader_ : NULL)
|
||||
@ -154,15 +154,15 @@ connect::side::side(const side& a) :
|
||||
|
||||
void connect::side::add_widgets_to_scrollpane(gui::scrollpane& pane, int pos)
|
||||
{
|
||||
pane.add_widget(&player_number_, 10, 3 + pos);
|
||||
pane.add_widget(&combo_controller_, 30, 5 + pos);
|
||||
pane.add_widget(&orig_controller_, 30 + (combo_controller_.width() - orig_controller_.width()) / 2, 35 + pos + (combo_leader_.height() - orig_controller_.height()) / 2);
|
||||
pane.add_widget(&combo_faction_, 145, 5 + pos);
|
||||
pane.add_widget(&combo_leader_, 145, 35 + pos);
|
||||
pane.add_widget(&combo_team_, 260, 5 + pos);
|
||||
pane.add_widget(&combo_colour_, 375, 5 + pos);
|
||||
pane.add_widget(&slider_gold_, 490, 5 + pos);
|
||||
pane.add_widget(&label_gold_, 500 + slider_gold_.width(), 5 + pos);
|
||||
pane.add_widget(&player_number_, 0, 5 + pos);
|
||||
pane.add_widget(&combo_controller_, 20, 5 + pos);
|
||||
pane.add_widget(&orig_controller_, 20 + (combo_controller_.width() - orig_controller_.width()) / 2, 35 + pos + (combo_leader_.height() - orig_controller_.height()) / 2);
|
||||
pane.add_widget(&combo_faction_, 135, 5 + pos);
|
||||
pane.add_widget(&combo_leader_, 135, 35 + pos);
|
||||
pane.add_widget(&combo_team_, 250, 5 + pos);
|
||||
pane.add_widget(&combo_colour_, 365, 5 + pos);
|
||||
pane.add_widget(&slider_gold_, 480, 5 + pos);
|
||||
pane.add_widget(&label_gold_, 490 + slider_gold_.width(), 8 + pos);
|
||||
}
|
||||
|
||||
void connect::side::process_event()
|
||||
@ -478,16 +478,16 @@ connect::connect(display& disp, const config& game_config, const game_data& data
|
||||
|
||||
team_prefix_(std::string(_("Team")) + " "),
|
||||
|
||||
waiting_label_(video(), ""),
|
||||
waiting_label_(video(), "", font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
message_full_(false),
|
||||
default_controller_(default_controller),
|
||||
|
||||
scroll_pane_(video()),
|
||||
type_title_label_(video(), _("Player/Type"), font::SIZE_NORMAL, font::GOOD_COLOUR),
|
||||
faction_title_label_(video(), _("Faction"), font::SIZE_NORMAL, font::GOOD_COLOUR),
|
||||
team_title_label_(video(), _("Team"), font::SIZE_NORMAL, font::GOOD_COLOUR),
|
||||
colour_title_label_(video(), _("Color"), font::SIZE_NORMAL, font::GOOD_COLOUR),
|
||||
gold_title_label_(video(), _("Gold"), font::SIZE_NORMAL, font::GOOD_COLOUR),
|
||||
type_title_label_(video(), _("Player/Type"), font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
faction_title_label_(video(), _("Faction"), font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
team_title_label_(video(), _("Team"), font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
colour_title_label_(video(), _("Color"), font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
gold_title_label_(video(), _("Gold"), font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
|
||||
ai_(video(), _("Computer vs Computer")),
|
||||
launch_(video(), _("I'm Ready")),
|
||||
@ -775,23 +775,23 @@ void connect::layout_children(const SDL_Rect& rect)
|
||||
size_t bottom = ca.y + ca.h;
|
||||
|
||||
//Buttons
|
||||
right_button->set_location(right - right_button->width() - gui::ButtonHPadding,
|
||||
bottom - right_button->height() - gui::ButtonVPadding);
|
||||
left_button->set_location(right - right_button->width() - left_button->width() - gui::ButtonHPadding*2,
|
||||
bottom - left_button->height()-gui::ButtonVPadding);
|
||||
right_button->set_location(right - right_button->width(),
|
||||
bottom - right_button->height());
|
||||
left_button->set_location(right - right_button->width() - left_button->width() - gui::ButtonHPadding,
|
||||
bottom - left_button->height());
|
||||
|
||||
ai_.set_location(left+30, bottom-left_button->height()-gui::ButtonVPadding);
|
||||
waiting_label_.set_location(ai_.location().x + ai_.location().w + 10,
|
||||
bottom-left_button->height()-gui::ButtonVPadding);
|
||||
ai_.set_location(left, bottom-left_button->height());
|
||||
waiting_label_.set_location(ai_.location().x + ai_.location().w + 8,
|
||||
bottom-left_button->height() + 4);
|
||||
|
||||
// Title and labels
|
||||
gui::draw_dialog_title(left,top,&video(),_("Game Lobby"));
|
||||
|
||||
type_title_label_.set_location((left+30)+(launch_.width()/2)-(type_title_label_.width()/2),top+35);
|
||||
faction_title_label_.set_location((left+145)+(launch_.width()/2)-(faction_title_label_.width()/2),top+35);
|
||||
team_title_label_.set_location((left+260)+(launch_.width()/2)-(team_title_label_.width()/2),top+35);
|
||||
colour_title_label_.set_location((left+375)+(launch_.width()/2)-(colour_title_label_.width()/2),top+35);
|
||||
gold_title_label_.set_location((left+480)+(launch_.width()/2)-(gold_title_label_.width()/2),top+35);
|
||||
type_title_label_.set_location(left+30, top+35);
|
||||
faction_title_label_.set_location((left+145), top+35);
|
||||
team_title_label_.set_location((left+260), top+35);
|
||||
colour_title_label_.set_location((left+375), top+35);
|
||||
gold_title_label_.set_location((left+493), top+35);
|
||||
|
||||
SDL_Rect scroll_pane_rect;
|
||||
scroll_pane_rect.x = ca.x;
|
||||
|
@ -38,15 +38,15 @@ create::create(display& disp, const config &cfg, chat& c, config& gamelist) :
|
||||
|
||||
maps_menu_(disp.video(), std::vector<std::string>()),
|
||||
turns_slider_(disp.video()),
|
||||
turns_label_(disp.video(), "", font::SIZE_SMALL, font::GOOD_COLOUR),
|
||||
turns_label_(disp.video(), "", font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
village_gold_slider_(disp.video()),
|
||||
village_gold_label_(disp.video(), "", font::SIZE_SMALL, font::GOOD_COLOUR),
|
||||
village_gold_label_(disp.video(), "", font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
xp_modifier_slider_(disp.video()),
|
||||
xp_modifier_label_(disp.video(), "", font::SIZE_SMALL, font::GOOD_COLOUR),
|
||||
name_entry_label_(disp.video(), _("Name of game:"), font::SIZE_SMALL, font::GOOD_COLOUR),
|
||||
num_players_label_(disp.video(), "", font::SIZE_SMALL, font::GOOD_COLOUR),
|
||||
era_label_(disp.video(), _("Era:"), font::SIZE_SMALL, font::GOOD_COLOUR),
|
||||
map_label_(disp.video(), _("Map to play:"), font::SIZE_SMALL, font::GOOD_COLOUR),
|
||||
xp_modifier_label_(disp.video(), "", font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
name_entry_label_(disp.video(), _("Name of game:"), font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
num_players_label_(disp.video(), "", font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
era_label_(disp.video(), _("Era:"), font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
map_label_(disp.video(), _("Map to play:"), font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
fog_game_(disp.video(), _("Fog Of War"), gui::button::TYPE_CHECK),
|
||||
shroud_game_(disp.video(), _("Shroud"), gui::button::TYPE_CHECK),
|
||||
observers_game_(disp.video(), _("Observers"), gui::button::TYPE_CHECK),
|
||||
@ -378,6 +378,7 @@ void create::layout_children(const SDL_Rect& rect)
|
||||
SDL_Rect ca = client_area();
|
||||
|
||||
const int border_size = 6;
|
||||
const int column_border_size = 10;
|
||||
int xpos = ca.x;
|
||||
int ypos = ca.y;
|
||||
|
||||
@ -408,12 +409,12 @@ void create::layout_children(const SDL_Rect& rect)
|
||||
generator_settings_.set_location(xpos, ypos);
|
||||
|
||||
// Second column: map menu
|
||||
ypos = ypos_columntop + border_size;
|
||||
xpos += minimap_width + border_size;
|
||||
ypos = ypos_columntop;
|
||||
xpos += minimap_width + column_border_size;
|
||||
map_label_.set_location(xpos, ypos);
|
||||
ypos += map_label_.height() + border_size;
|
||||
maps_menu_.set_max_width(200);
|
||||
maps_menu_.set_max_height(ca.x + ca.h - ypos);
|
||||
maps_menu_.set_max_height(ca.h + ca.x - ypos - border_size);
|
||||
maps_menu_.set_location(xpos, ypos);
|
||||
// Menu dimensions are only updated when items are set. So do this now.
|
||||
int mapsel_save = maps_menu_.selection();
|
||||
@ -421,8 +422,8 @@ void create::layout_children(const SDL_Rect& rect)
|
||||
maps_menu_.move_selection(mapsel_save);
|
||||
|
||||
// Third column: big buch of options
|
||||
ypos = ypos_columntop + border_size;
|
||||
xpos += 200 + border_size;
|
||||
ypos = ypos_columntop;
|
||||
xpos += 200 + column_border_size;
|
||||
|
||||
turns_label_.set_location(xpos, ypos);
|
||||
ypos += turns_label_.height() + border_size;
|
||||
@ -467,11 +468,10 @@ void create::layout_children(const SDL_Rect& rect)
|
||||
#endif
|
||||
|
||||
// Buttons
|
||||
right_button->set_location(ca.x + ca.w - right_button->width() - gui::ButtonHPadding,
|
||||
ca.y + ca.h - right_button->height() - gui::ButtonVPadding);
|
||||
right_button->set_location(ca.x + ca.w - right_button->width(),
|
||||
ca.y + ca.h - right_button->height());
|
||||
left_button->set_location(right_button->location().x - left_button->width() -
|
||||
gui::ButtonHPadding,
|
||||
ca.y + ca.h - left_button->height() - gui::ButtonVPadding);
|
||||
gui::ButtonHPadding, ca.y + ca.h - left_button->height());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -216,10 +216,10 @@ SDL_Rect ui::client_area() const
|
||||
{
|
||||
SDL_Rect res;
|
||||
|
||||
res.x = xscale(11) + 6;
|
||||
res.y = yscale(40) + 6;
|
||||
res.w = xscale(833) > 12 ? xscale(833) - 12 : 0;
|
||||
res.h = yscale(524) > 12 ? yscale(524) - 12 : 0;
|
||||
res.x = xscale(10) + 10;
|
||||
res.y = yscale(38) + 10;
|
||||
res.w = xscale(828) > 12 ? xscale(828) - 12 : 0;
|
||||
res.h = yscale(520) > 12 ? yscale(520) - 12 : 0;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ wait::wait(display& disp, const config& cfg, const game_data& data, mp::chat& c,
|
||||
ui(disp, cfg, c, gamelist),
|
||||
|
||||
cancel_button_(disp.video(), _("Cancel")),
|
||||
start_label_(disp.video(), _("Waiting for game to start...")),
|
||||
start_label_(disp.video(), _("Waiting for game to start..."), font::SIZE_SMALL, font::LOBBY_COLOUR),
|
||||
game_menu_(disp.video(), std::vector<std::string>()),
|
||||
|
||||
game_data_(data),
|
||||
@ -268,12 +268,12 @@ void wait::layout_children(const SDL_Rect& rect)
|
||||
ui::layout_children(rect);
|
||||
|
||||
const SDL_Rect ca = client_area();
|
||||
int y = ca.y + ca.h - cancel_button_.height() - gui::ButtonVPadding;
|
||||
int y = ca.y + ca.h - cancel_button_.height();
|
||||
|
||||
game_menu_.set_location(ca.x, ca.y);
|
||||
game_menu_.set_measurements(ca.x + ca.w, y - ca.y - gui::ButtonVPadding);
|
||||
cancel_button_.set_location(ca.x + ca.w - cancel_button_.width() - gui::ButtonHPadding, y);
|
||||
start_label_.set_location(ca.x + gui::ButtonHPadding, y + 4);
|
||||
game_menu_.set_measurements(ca.w, y - ca.y - gui::ButtonVPadding);
|
||||
cancel_button_.set_location(ca.x + ca.w - cancel_button_.width(), y);
|
||||
start_label_.set_location(ca.x, y + 4);
|
||||
}
|
||||
|
||||
void wait::hide_children(bool hide)
|
||||
|
@ -174,12 +174,16 @@ void button::draw_contents()
|
||||
else
|
||||
textx = loc.x + image_w + checkbox_horizontal_padding / 2;
|
||||
|
||||
if (!enabled_)
|
||||
SDL_Color button_colour = font::BUTTON_COLOUR;
|
||||
|
||||
if (!enabled_) {
|
||||
image = greyscale_image(image);
|
||||
button_colour = font::STONED_COLOUR;
|
||||
}
|
||||
|
||||
video().blit_surface(loc.x, loc.y, image);
|
||||
const std::string etext = font::make_text_ellipsis(label_, font_size, loc.w);
|
||||
font::draw_text(&video(), clipArea, font_size, font::BUTTON_COLOUR, etext, textx, texty);
|
||||
font::draw_text(&video(), clipArea, font_size, button_colour, etext, textx, texty);
|
||||
|
||||
update_rect(loc);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ void slider::draw_contents()
|
||||
surface const screen = video().getSurface();
|
||||
|
||||
SDL_Rect line_rect = { loc.x + image->w / 2, loc.y + loc.h / 2, loc.w - image->w, 1 };
|
||||
SDL_FillRect(screen, &line_rect, SDL_MapRGB(screen->format, 255, 255, 255));
|
||||
SDL_FillRect(screen, &line_rect, SDL_MapRGB(screen->format, 221, 221, 221));
|
||||
|
||||
SDL_Rect const &slider = slider_area();
|
||||
video().blit_surface(slider.x, slider.y, image);
|
||||
|
Loading…
x
Reference in New Issue
Block a user