Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-12-26 12:21:48 +0000
committerStijn Buys <ingar@osirion.org>2008-12-26 12:21:48 +0000
commitb875124824794a7762414db76ed9f953b8ba320f (patch)
tree86f27d64e4a9e91a93cb4b30752f27eeec6526ac /src
parentbfa10f9990a8a045b03474d11af75984c12a856a (diff)
default player settings in player.ini,
palette text colors, cleanups
Diffstat (limited to 'src')
-rw-r--r--src/client/client.cc4
-rw-r--r--src/client/video.cc27
-rw-r--r--src/client/video.h3
-rw-r--r--src/client/view.cc4
-rw-r--r--src/core/gameserver.cc2
-rw-r--r--src/core/gameserver.h3
-rw-r--r--src/game/base/game.cc120
-rw-r--r--src/game/base/game.h16
-rw-r--r--src/game/intro/intro.cc2
-rw-r--r--src/render/text.cc14
-rw-r--r--src/render/text.h3
-rw-r--r--src/ui/paint.cc5
-rw-r--r--src/ui/paint.h3
-rw-r--r--src/ui/palette.cc83
-rw-r--r--src/ui/palette.h155
-rw-r--r--src/ui/ui.cc57
-rw-r--r--src/ui/ui.h3
17 files changed, 378 insertions, 126 deletions
diff --git a/src/client/client.cc b/src/client/client.cc
index edec13c..bb6fb55 100644
--- a/src/client/client.cc
+++ b/src/client/client.cc
@@ -252,6 +252,8 @@ void Client::notify_connect()
view()->notify()->clear();
view()->chat()->clear();
ui::root()->hide_menu();
+
+ video::set_caption();
}
void Client::notify_disconnect()
@@ -262,6 +264,8 @@ void Client::notify_disconnect()
view()->notify()->clear();
view()->chat()->clear();
+
+ video::set_caption();
}
void Client::notify_zonechange()
diff --git a/src/client/video.cc b/src/client/video.cc
index 53e5dbc..1db1ba4 100644
--- a/src/client/video.cc
+++ b/src/client/video.cc
@@ -10,6 +10,7 @@
#include "client/client.h"
#include "render/render.h"
#include "core/core.h"
+#include "core/gameserver.h"
#include "filesystem/filesystem.h"
#include "sys/sys.h"
#include "ui/ui.h"
@@ -133,20 +134,17 @@ bool init()
#endif // HAVE_DEBUG_MESSAGES
+ // set window caption
+ set_caption();
+
// save r_width and r_height variables
(*r_width) = width;
(*r_height) = height;
- // set window caption
- std::string version(core::name());
- version += ' ';
- version.append(core::version());
- SDL_WM_SetCaption(version.c_str(), 0);
-
// resize user interface
ui::root()->set_size((float) width, (float) height);
ui::root()->event_resize();
-
+
// to grab or not to grab
if (ui::console()->visible()) {
SDL_WM_GrabInput(SDL_GRAB_OFF);
@@ -158,12 +156,27 @@ bool init()
// initialize renderer
render::init(width, height);
+
+ // apply render options
+ ui::root()->apply_render_options();
view::init();
return true;
}
+void set_caption()
+{
+ // set window caption
+ std::string version;
+ if (core::server() && core::server()->module()) {
+ version.assign(core::server()->module()->name());
+ } else {
+ version.assign(core::name() + ' ' + core::version());
+ }
+ SDL_WM_SetCaption(version.c_str(), 0);
+}
+
void resize(int w, int h)
{
if (fullscreen)
diff --git a/src/client/video.h b/src/client/video.h
index 7a8d386..833ebc4 100644
--- a/src/client/video.h
+++ b/src/client/video.h
@@ -30,6 +30,9 @@ namespace video
/// draw the next client video frame
void frame(float elapsed);
+ /// set the window caption
+ void set_caption();
+
} // namespace video
} // namespace client
diff --git a/src/client/view.cc b/src/client/view.cc
index 1c35708..1c1b108 100644
--- a/src/client/view.cc
+++ b/src/client/view.cc
@@ -418,7 +418,7 @@ void draw_entity_offscreen_target(core::Entity *entity, bool is_active_target)
gl::end();
if (entity == core::localplayer()->mission_target()) {
- gl::color(1, 0.5f, 1, 1); // FIXME mission color
+ gl::color(ui::root()->palette()->mission());
} else if (entity->type() == core::Entity::Controlable) {
gl::color(0, 1, 0, 1); // FIXME allegiance color
} else {
@@ -488,7 +488,7 @@ void draw_entity_target(core::Entity *entity, bool is_active_target)
}
if (entity == core::localplayer()->mission_target()) {
- gl::color(1, 0.5f, 1, 1); // FIXME mission color
+ gl::color(ui::root()->palette()->mission());
} else if (entity->type() == core::Entity::Controlable) {
gl::color(0, 1, 0, 1); // FIXME allegiance color
} else {
diff --git a/src/core/gameserver.cc b/src/core/gameserver.cc
index f614fa9..44b8ccb 100644
--- a/src/core/gameserver.cc
+++ b/src/core/gameserver.cc
@@ -205,7 +205,7 @@ GameServer::~GameServer()
save_config();
if (server_module) {
- if (server_module->running() && !Cvar::sv_dedicated->value())
+ if (!Cvar::sv_dedicated->value())
player_disconnect(localplayer());
delete server_module;
diff --git a/src/core/gameserver.h b/src/core/gameserver.h
index 8d9ca9b..59db0c5 100644
--- a/src/core/gameserver.h
+++ b/src/core/gameserver.h
@@ -39,6 +39,9 @@ public:
/// current server game time
virtual inline unsigned long timestamp() const { return server_timestamp; }
+ /// current module
+ inline const Module *module() const { return server_module; }
+
/*----- mutators -------------------------------------------------- */
/// is called when a player connects to the game server
diff --git a/src/game/base/game.cc b/src/game/base/game.cc
index c591ba4..8a096b2 100644
--- a/src/game/base/game.cc
+++ b/src/game/base/game.cc
@@ -28,7 +28,23 @@
namespace game
{
-/* -- class Base static members ----------------------------------- */
+/* -- class Default ----------- ----------------------------------- */
+
+// default player settings
+core::Zone *Default::zone = 0;
+core::Entity *Default::view = 0;
+ShipModel *Default::shipmodel = 0;
+long Default::credits = 0;
+
+void Default::clear()
+{
+ zone = 0;
+ view = 0;
+ shipmodel = 0;
+ credits = 0;
+}
+
+/* -- class Game static members ----------------------------------- */
// game variables
core::Cvar *Game::g_impulsespeed = 0;
@@ -36,9 +52,6 @@ core::Cvar *Game::g_impulseacceleration = 0;
core::Cvar *Game::g_jumppointrange = 0;
core::Cvar *Game::g_devel = 0;
-core::Zone *Game::default_zone = 0;
-ShipModel *Game::default_shipmodel = 0;
-
core::Module *factory()
{
return new Game();
@@ -61,7 +74,7 @@ void Game::func_join(core::Player *player, std::string const &args)
if (player->control())
return;
- Ship *ship = new Ship(player, Game::default_shipmodel);
+ Ship *ship = new Ship(player, Default::shipmodel);
ship->set_zone(player->zone());
player->set_control(ship);
@@ -78,7 +91,7 @@ void Game::func_join(core::Player *player, std::string const &args)
message.append("^B joins the game.");
core::server()->broadcast(message);
- player->send("^BYou received " + aux::article(Game::default_shipmodel->name()));
+ player->send("^BYou received " + aux::article(Default::shipmodel->name()));
player->sound("game/buy-ship");
player->player_dirty = true;
@@ -100,7 +113,7 @@ void Game::func_spectate(core::Player *player, std::string const &args)
}
if (!player->zone())
- player->set_zone(Game::default_zone);
+ player->set_zone(Default::zone);
player->set_view(0);
}
@@ -255,9 +268,7 @@ void Game::func_goto(core::Player *player, const std::string &args)
Game::Game() : core::Module("Project::OSiRiON", true)
{
- default_shipmodel = 0;
- default_zone = 0;
-
+ Default::clear();
ShipModel::clear();
if (!load_ships()) {
@@ -269,12 +280,17 @@ Game::Game() : core::Module("Project::OSiRiON", true)
abort();
return;
}
+
+ if (!load_player()) {
+ abort();
+ return;
+ }
// add engine functions
core::Func *func = 0;
func = core::Func::add("list_ship", Game::func_list_ship);
- func->set_info("list ship statistics");
+ func->set_info("[string] list ship statistics");
func = core::Func::add("join", Game::func_join);
func->set_info("join the game");
@@ -391,11 +407,6 @@ bool Game::load_world()
}
}
- if (!default_zone) {
- con_error << "No default zone found!" << std::endl;
- return false;
- }
-
return true;
}
@@ -501,9 +512,6 @@ bool Game::load_zone(core::Zone *zone)
} else if (zoneini.got_key_string("sky", strval)) {
zone->set_sky(strval);
continue;
- } else if (zoneini.got_key_bool("default", b)) {
- if (b) default_zone = zone;
- continue;
} else {
zoneini.unkown_key();
}
@@ -733,18 +741,15 @@ bool Game::load_ships()
using math::Vector3f;
using math::Color;
- default_shipmodel = 0;
-
filesystem::IniFile shipsini;
shipsini.open("ships");
if (!shipsini.is_open()) {
- con_error << "Could not open ini/ships.ini!" << std::endl;
+ con_error << "Could not open " << shipsini.name() << "!" << std::endl;
return false;
}
ShipModel *shipmodel = 0;
std::string label;
- bool b;
long l;
float f;
@@ -760,9 +765,6 @@ bool Game::load_ships()
continue;
} else if (shipsini.got_key_string("model", shipmodel->shipmodel_modelname)) {
continue;
- } else if (shipsini.got_key_bool("default", b)) {
- if (b) default_shipmodel = shipmodel;
- continue;
} else if (shipsini.got_key_long("price", l)) {
shipmodel->set_price(l);
continue;
@@ -788,8 +790,8 @@ bool Game::load_ships()
} else if (shipsini.got_section("ship")) {
if (shipmodel && !ShipModel::find(shipmodel)) delete shipmodel;
shipmodel = new ShipModel();
- if (!default_shipmodel)
- default_shipmodel = shipmodel;
+ if (!Default::shipmodel)
+ Default::shipmodel = shipmodel;
} else if (shipsini.got_section()) {
shipsini.unknown_section();
@@ -801,7 +803,65 @@ bool Game::load_ships()
con_debug << " " << shipsini.name() << " " << ShipModel::registry.size() << " ship models" << std::endl;
- if (!default_shipmodel) {
+ return true;
+}
+
+// load default player settings
+bool Game::load_player()
+{
+ Default::clear();
+
+ filesystem::IniFile inifile;
+ inifile.open("player");
+ if (!inifile.is_open()) {
+ con_error << "Could not open " << inifile.name() << "!" << std::endl;
+ return false;
+ }
+
+ long l;
+ std::string str;
+
+ while (inifile.getline()) {
+
+ if (inifile.got_section()) {
+
+ if (inifile.got_section("player")) {
+ continue;
+ } else {
+ inifile.unknown_section();
+ }
+
+ } else if (inifile.got_key()) {
+
+ if (inifile.in_section("player")) {
+ if (inifile.got_key_long("credits", l)) {
+ Default::credits = l;
+ } else if (inifile.got_key_string("zone", str)) {
+ aux::to_label(str);
+ Default::zone = core::Zone::find(str);
+ } else if (inifile.got_key_string("ship", str)) {
+ aux::to_label(str);
+ Default::shipmodel = ShipModel::find(str);
+ }
+ }
+ }
+ }
+
+ inifile.close();
+
+ if (!Default::zone) {
+ con_error << "No default zone found!\n";
+ return false;
+ }
+
+ if (!Default::zone->default_view()) {
+ con_error << "Zone '" << Default::zone->label() << "' has no default view!\n";
+ return false;
+ }
+
+ Default::view = Default::zone->default_view();
+
+ if (!Default::shipmodel) {
con_error << "No default ship model found!\n";
return false;
}
@@ -818,7 +878,7 @@ void Game::frame(float seconds)
void Game::player_connect(core::Player *player)
{
std::string args;
- player->set_zone(default_zone);
+ player->set_zone(Default::zone);
player->set_view(0); // not docked
func_spectate(player, args);
diff --git a/src/game/base/game.h b/src/game/base/game.h
index caeb50a..9f31f4f 100644
--- a/src/game/base/game.h
+++ b/src/game/base/game.h
@@ -32,6 +32,17 @@ const unsigned int jumppoint_enttype = 260;
const unsigned int jumpgate_enttype = 261;
const unsigned int station_enttype = 262;
+/// default player settings
+class Default {
+public:
+ static core::Zone *zone;
+ static core::Entity *view;
+ static ShipModel *shipmodel;
+ static long credits;
+
+ static void clear();
+};
+
/// the base Project::OSiRiON game model
class Game : public core::Module {
public:
@@ -72,9 +83,8 @@ private:
bool load_menus(core::Entity *entity, const std::string &menufilename);
bool load_ships();
-
- static core::Zone *default_zone;
- static ShipModel *default_shipmodel;
+
+ bool load_player();
/* ---- engine functions ----------------------------------- */
diff --git a/src/game/intro/intro.cc b/src/game/intro/intro.cc
index edb80d4..3fafa0f 100644
--- a/src/game/intro/intro.cc
+++ b/src/game/intro/intro.cc
@@ -19,7 +19,7 @@ core::Module *factory()
return new Intro();
}
-Intro::Intro() : core::Module("Introduction", false)
+Intro::Intro() : core::Module("Project::OSiRiON", false)
{
if (!load_world()) {
abort();
diff --git a/src/render/text.cc b/src/render/text.cc
index 127605b..f4b75c4 100644
--- a/src/render/text.cc
+++ b/src/render/text.cc
@@ -62,6 +62,15 @@ void Text::shutdown()
}
}
+void Text::assign_color(const char c, const math::Color &color)
+{
+ if (('A' <= c) && (c <= 'Z')) {
+ core_color[(size_t) (c - 'A')]->assign(color);
+ } else if (('0' <= c) && (c <= '9')) {
+ base_color[(size_t) (c - '0')]->assign(color);
+ }
+}
+
void Text::setcolor(const char color)
{
if (('A' <= color) && (color <= 'Z')) {
@@ -71,11 +80,6 @@ void Text::setcolor(const char color)
else if (('0' <= color) && (color <= '9')) {
gl::color(*base_color[(size_t) (color - '0')]);
}
-
- else {
- gl::color(1, 1, 1);
- }
-
}
void Text::setfont(const char *texture, float width, float height)
diff --git a/src/render/text.h b/src/render/text.h
index 5cf18ea..4762639 100644
--- a/src/render/text.h
+++ b/src/render/text.h
@@ -23,6 +23,9 @@ public:
static void shutdown();
+ /// assign system colors
+ static void assign_color(const char c, const math::Color &color);
+
/// draw a text string
static void draw(float x, float y, const std::string & text);
diff --git a/src/ui/paint.cc b/src/ui/paint.cc
index 86058cf..e6f2402 100644
--- a/src/ui/paint.cc
+++ b/src/ui/paint.cc
@@ -17,6 +17,11 @@ namespace ui
// contains the interface between the user interface and the render library
namespace paint {
+void assign_color(const char c, const math::Color &color)
+{
+ render::Text::assign_color(c, color);
+}
+
void color(float r, float g, float b, float a)
{
gl::color(r, g, b, a);
diff --git a/src/ui/paint.h b/src/ui/paint.h
index 95f1c62..840e18a 100644
--- a/src/ui/paint.h
+++ b/src/ui/paint.h
@@ -15,6 +15,9 @@ namespace ui
/// low-level widget paint functions
namespace paint {
+/// assign system colors
+void assign_color(const char c, const math::Color &color);
+
/// set paint color
void color(float r=0.0f, float g=0.0f, float b=0.0f, float a=1.0f);
diff --git a/src/ui/palette.cc b/src/ui/palette.cc
index 79388d8..f8d16c1 100644
--- a/src/ui/palette.cc
+++ b/src/ui/palette.cc
@@ -10,17 +10,18 @@
namespace ui
{
-Palette::Palette()
+Palette::Palette() :
+ palette_foreground(1.0f, 1.0f),
+ palette_background(0.5f, 0.75f),
+ palette_border(0.0f, 0.8f, 0.0f, 0.5f),
+ palette_text(0.75f),
+ palette_highlight(1.0f, 1.0f, 0.5f),
+ palette_pointer(0.0f, 0.75f, 0.0f),
+ palette_active(0.0f, 1.0f, 0.0f),
+ palette_debug(0.50f, 0.75f),
+ palette_mission(1.0f, 0.5f, 1.0f)
{
- palette_foreground.assign(1.0f, 1.0f);
- palette_highlight.assign(1.0f, 1.0f, 0.5f);
- palette_text.assign(0.75f);
- palette_background.assign(0.5f, 0.75f);
- palette_border.assign(0.0f, 0.8f, 0.0f, 0.5f);
- palette_pointer.assign(0.0f, 0.75f, 0.0f);
- palette_active.assign(0.0f, 1.0f, 0.0f);
- palette_debug.assign(1.0f, 0.0f, 1.0f, 0.75f);
}
Palette::~Palette()
@@ -36,12 +37,15 @@ const math::Color &Palette::color(Color palettecolor) const
case Background:
return background();
break;
- case Highlight:
- return highlight();
- break;
case Border:
return border();
break;
+ case Text:
+ return text();
+ break;
+ case Highlight:
+ return highlight();
+ break;
case Pointer:
return pointer();
break;
@@ -50,51 +54,28 @@ const math::Color &Palette::color(Color palettecolor) const
break;
case Debug:
return debug();
+ break;
+ case Mission:
+ return mission();
+ break;
+ case Bold:
+ return bold();
+ break;
+ case Fancy:
+ return fancy();
+ break;
+ case Warning:
+ return warning();
+ break;
+ case Error:
+ return error();
+ break;
default:
return foreground();
break;
}
}
-void Palette::set_foreground(math::Color const &color)
-{
- palette_foreground.assign(color);
-}
-
-void Palette::set_highlight(math::Color const &color)
-{
- palette_highlight.assign(color);
-}
-
-void Palette::set_text(math::Color const &color)
-{
- palette_text.assign(color);
-}
-
-void Palette::set_background(math::Color const &color)
-{
- palette_background.assign(color);
-}
-
-void Palette::set_border(math::Color const &color)
-{
- palette_border.assign(color);
-}
-
-void Palette::set_pointer(math::Color const &color)
-{
- palette_pointer.assign(color);
-}
-
-void Palette::set_active(math::Color const &color)
-{
- palette_active.assign(color);
-}
-
-void Palette::set_debug(math::Color const &color)
-{
- palette_debug.assign(color);
-}
}
diff --git a/src/ui/palette.h b/src/ui/palette.h
index 1ef49c7..1aabc59 100644
--- a/src/ui/palette.h
+++ b/src/ui/palette.h
@@ -12,77 +12,190 @@
namespace ui
{
+/// color palette used by the user interface
class Palette
{
public:
+ /// default constructor, creates a default palette
Palette();
+
+ /// default destructor
~Palette();
- enum Color { Foreground=0, Background=1, Highlight=2, Border=3, Pointer=4, Active=5, Debug=6 };
+ /// color index
+ enum Color { Foreground=0, Background=1, Border=2, Text=3, Highlight=4, Pointer=5, Active=6, Debug=7, Mission=8,
+ Bold=9, Fancy=10, Warning=11, Error=12 };
+
+ /* ---- mutators ------------------------------------------- */
/// set foreground color
- void set_foreground(math::Color const &color);
+ inline void set_foreground(const math::Color &color)
+ {
+ palette_foreground.assign(color);
+ }
+
+ /// set background color
+ inline void set_background(const math::Color &color)
+ {
+ palette_background.assign(color);
+ }
+
+ /// set border color
+ inline void set_border(const math::Color &color)
+ {
+ palette_border.assign(color);
+ }
+
+ /// set text color
+ inline void set_text(const math::Color &color)
+ {
+ palette_text.assign(color);
+ }
/// set highlight color
- void set_highlight(math::Color const &color);
-
- void set_text(math::Color const &color);
+ inline void set_highlight(const math::Color &color)
+ {
+ palette_highlight.assign(color);
+ }
- void set_background(math::Color const &color);
+ /// set pointer color
+ inline void set_pointer(const math::Color &color)
+ {
+ palette_pointer.assign(color);
+ }
- void set_border(math::Color const &color);
+ /// set active pointer color
+ inline void set_active(const math::Color &color)
+ {
+ palette_active.assign(color);
+ }
- void set_pointer(math::Color const &color);
+ /// set debug color
+ inline void set_debug(const math::Color &color)
+ {
+ palette_debug.assign(color);
+ }
- void set_active(math::Color const &color);
+ /// set mission color
+ inline void set_mission(const math::Color &color)
+ {
+ palette_mission.assign(color);
+ }
- void set_debug(math::Color const &olor);
+ /// set bold text color
+ inline void set_bold(const math::Color &color)
+ {
+ palette_bold.assign(color);
+ }
- inline const math::Color &foreground() const {
- return palette_foreground;
+ /// set fancy text color
+ inline void set_fancy(const math::Color &color)
+ {
+ palette_fancy.assign(color);
}
- inline const math::Color &highlight() const {
- return palette_highlight;
+ /// set warning text color
+ inline void set_warning(const math::Color &color)
+ {
+ palette_warning.assign(color);
}
- inline const math::Color &text() const {
- return palette_text;
+ /// set error text color
+ inline void set_error(const math::Color &color)
+ {
+ palette_error.assign(color);
+ }
+
+ /* ---- inspectors ----------------------------------------- */
+
+ /// foreground color
+ inline const math::Color &foreground() const {
+ return palette_foreground;
}
+ /// background color
inline const math::Color &background() const {
return palette_background;
}
+ /// border color
inline const math::Color &border() const {
return palette_border;
}
-
+
+ /// text color
+ inline const math::Color &text() const {
+ return palette_text;
+ }
+
+ /// highlight color
+ inline const math::Color &highlight() const {
+ return palette_highlight;
+ }
+
+ /// pointer color
inline const math::Color &pointer() const {
return palette_pointer;
}
+ /// active pointer color
inline const math::Color &active() const {
return palette_active;
}
+ /// debug color
inline const math::Color &debug() const {
return palette_debug;
}
+ /// mission color
+ inline const math::Color &mission() const {
+ return palette_mission;
+ }
+
+ /// bold text color
+ inline const math::Color &bold() const {
+ return palette_bold;
+ }
+
+ /// fancy text color
+ inline const math::Color &fancy() const {
+ return palette_fancy;
+ }
+
+ /// warning text color
+ inline const math::Color &warning() const {
+ return palette_warning;
+ }
+
+ /// error text color
+ inline const math::Color &error() const {
+ return palette_error;
+ }
+
+ // indexed color
const math::Color &color(Palette::Color palettecolor) const;
private:
-
+ // UI colors
math::Color palette_foreground;
- math::Color palette_highlight;
math::Color palette_background;
+ math::Color palette_border;
+ math::Color palette_text;
+ math::Color palette_highlight;
math::Color palette_pointer;
math::Color palette_active;
- math::Color palette_border;
math::Color palette_debug;
- math::Color palette_text;
+
+ // HUD colors
+ math::Color palette_mission;
+
+ // additional text colors
+ math::Color palette_bold;
+ math::Color palette_fancy;
+ math::Color palette_warning;
+ math::Color palette_error;
};
}
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());
}
diff --git a/src/ui/ui.h b/src/ui/ui.h
index ae42ad6..95577cf 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -33,6 +33,9 @@ public:
/// reload menu files
void load();
+
+ /// apply UI options to the render engine
+ void apply_render_options();
/// make a window the active window
void show_menu(const char *label);