From b875124824794a7762414db76ed9f953b8ba320f Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 26 Dec 2008 12:21:48 +0000 Subject: default player settings in player.ini, palette text colors, cleanups --- src/ui/ui.cc | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 5 deletions(-) (limited to 'src/ui/ui.cc') diff --git a/src/ui/ui.cc b/src/ui/ui.cc index bc6f544..b06e29b 100644 --- a/src/ui/ui.cc +++ b/src/ui/ui.cc @@ -44,6 +44,7 @@ void func_ui_restart(std::string const &args) { if (global_ui) { global_ui->load(); + global_ui->apply_render_options(); } } @@ -291,6 +292,12 @@ void UI::load() } else if (ini.got_section("colors")) { continue; + } else if (ini.got_section("hud")) { + continue; + + } else if (ini.got_section("text")) { + continue; + } else { ini.unknown_section(); continue; @@ -310,12 +317,16 @@ void UI::load() continue; } else if (ini.got_key_float("elementwidth", w)) { elementsize.assign(w, h); + continue; } else if (ini.got_key_float("elementheight", h)) { elementsize.assign(w, h); + continue; } else if (ini.got_key_float("elementmargin", m)) { elementmargin = m; + continue; } else { ini.unkown_key(); + continue; } } else if (ini.in_section("colors")) { @@ -323,26 +334,51 @@ void UI::load() if (ini.got_key_color("foreground", color)) { ui_palette->set_foreground(color); continue; - } else if (ini.got_key_color("highlight", color)) { - ui_palette->set_highlight(color); - continue; - } else if (ini.got_key_color("text", color)) { - ui_palette->set_text(color); } else if (ini.got_key_color("background", color)) { ui_palette->set_background(color); continue; } else if (ini.got_key_color("border", color)) { ui_palette->set_border(color); continue; + } else if (ini.got_key_color("text", color)) { + ui_palette->set_text(color); + } else if (ini.got_key_color("highlight", color)) { + ui_palette->set_highlight(color); + continue; } else if (ini.got_key_color("pointer", color)) { ui_palette->set_pointer(color); + continue; } else if (ini.got_key_color("active", color)) { ui_palette->set_active(color); + continue; } else if (ini.got_key_color("debug", color)) { ui_palette->set_debug(color); + continue; } else { ini.unkown_key(); + continue; } + + } else if (ini.in_section("hud")) { + + if (ini.got_key_color("mission", color)) { + ui_palette->set_mission(color); + continue; + } else { + ini.unkown_key(); + continue; + } + + } else if (ini.in_section("text")) { + } else if (ini.got_key_color("bold", color)) { + ui_palette->set_bold(color); + } else if (ini.got_key_color("fancy", color)) { + ui_palette->set_fancy(color); + } else if (ini.got_key_color("warning", color)) { + ui_palette->set_warning(color); + } else if (ini.got_key_color("error", color)) { + ui_palette->set_error(color); + continue; } } } @@ -376,6 +412,17 @@ void UI::load() menu->add_button("Join", "join; menu hide"); menu->add_button("Game menu", "menu game"); } +} + +void UI::apply_render_options() +{ + // apply palette colors + paint::assign_color('N', palette()->text()); + paint::assign_color('D', palette()->debug()); + paint::assign_color('B', palette()->bold()); + paint::assign_color('F', palette()->fancy()); + paint::assign_color('W', palette()->warning()); + paint::assign_color('E', palette()->error()); } -- cgit v1.2.3