diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/client.cc | 6 | ||||
-rw-r--r-- | src/client/console.cc | 45 | ||||
-rw-r--r-- | src/client/view.cc | 11 |
3 files changed, 35 insertions, 27 deletions
diff --git a/src/client/client.cc b/src/client/client.cc index 6a4d23e..97c0128 100644 --- a/src/client/client.cc +++ b/src/client/client.cc @@ -91,13 +91,13 @@ void Client::init(int count, char **arguments) // client variables core::Cvar *cvar = 0; cvar = core::Cvar::get("cl_name", "Player", core::Cvar::Archive | core::Cvar::Info); - cvar->set_info("[str] client player name"); + cvar->set_info("[str] player name"); cvar = core::Cvar::get("cl_color", "1.0 1.0 1.0", core::Cvar::Archive | core::Cvar::Info); - cvar->set_info("[r g b] client player clor"); + cvar->set_info("[r g b] player color"); cl_framerate = core::Cvar::get("cl_framerate", "120", core::Cvar::Archive); - cl_framerate->set_info("client framerate in frames/sec"); + cl_framerate->set_info("[int] client framerate in frames/sec"); // initialize SDL, but do not initialize any subsystems SDL_Init(0); diff --git a/src/client/console.cc b/src/client/console.cc index b60e179..4c65581 100644 --- a/src/client/console.cc +++ b/src/client/console.cc @@ -82,6 +82,14 @@ void func_con_toggle(std::string const &args) //--- public ------------------------------------------------------ +void clear_notify() +{ + for (size_t i=0; i < MAXNOTIFYLINES; i++) { + notify_text[i].clear(); + notify_time[i] = 0; + } +} + void init() { con_print << "^BInitializing console..." << std::endl; @@ -89,8 +97,10 @@ void init() console_visible = false; // add engine functions - core::Func::add("con_toggle", (core::FuncPtr) func_con_toggle); - + core::Func *func = core::Func::add("con_toggle", (core::FuncPtr) func_con_toggle); + func->set_info("toggle console on or off"); + + clear_notify(); text.clear(); console_scroll = 0; @@ -118,19 +128,13 @@ void shutdown() input_pos = 0; } -void clear_notify() -{ - for (size_t i=0; i < MAXNOTIFYLINES; i++) - notify_time[i] = 0; -} - void draw_notify() { using namespace render; // draw notifications Text::setcolor('N'); - size_t width = (size_t) ((video::width - 8) / Text::fontwidth()); + size_t width = (size_t) ((video::width-8) / Text::fontwidth()); size_t n = notify_pos % MAXNOTIFYLINES; float h = 4 + 2*Text::fontheight(); for (size_t l = 0; l < MAXNOTIFYLINES; l++) { @@ -227,31 +231,32 @@ void draw_console() float con_height = 0.70f; - // draw version below the bottom of the console - std::string version(core::name()); - version += ' '; - version.append(core::version()); - gl::color(0.0f, 1.0f, 0.0f, 0.5f); - Text::draw(video::width-Text::fontwidth()*(version.size()+1), video::height*con_height-Text::fontheight()-4, version); gl::disable(GL_TEXTURE_2D); // draw the transparent console background - gl::color(1.0f, 1.0f, 1.0f, 0.02f); + gl::color(0.0f, 0.0f, 0.0f, 0.5f); gl::begin(gl::Quads); gl::vertex(0.0f, 0.0f, 0.0f); gl::vertex(video::width, 0.0f,0.0f); gl::vertex(video::width,video::height*con_height,0.0f); gl::vertex(0,video::height*con_height,0.0f); gl::end(); - + + gl::enable(GL_TEXTURE_2D); + + // draw version below the bottom of the console + std::string version(core::name()); + version += ' '; + version.append(core::version()); + gl::color(0.0f, 1.0f, 0.0f, 0.5f); + Text::draw(video::width-Text::fontwidth()*(version.size()+1), video::height*con_height-Text::fontheight()-4, version); + // draw the console text if (console_scroll > text.size()) console_scroll = text.size(); - - gl::enable(GL_TEXTURE_2D); size_t height = (size_t) (video::height * con_height / Text::fontheight()) -1; - size_t width = (size_t) (video::width / Text::fontwidth()) -2; + size_t width = (size_t) ((video::width-8) / Text::fontwidth()); size_t bottom = text.size() - console_scroll; size_t current_line = 0; diff --git a/src/client/view.cc b/src/client/view.cc index 0fa47d4..63c373e 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -29,7 +29,7 @@ namespace client { core::Cvar *draw_stats = 0; -core::Cvar *draw_crosshaircolor = 0; +core::Cvar *cl_crosshaircolor = 0; namespace view { @@ -41,7 +41,10 @@ void init() camera::init(); draw_stats = core::Cvar::get("draw_stats", "0", core::Cvar::Archive); - draw_crosshaircolor = core::Cvar::get("draw_crosshaircolor", "1 1 1", core::Cvar::Archive); + draw_stats->set_info("[bool] draw network and render statistics"); + + cl_crosshaircolor = core::Cvar::get("cl_crosshaircolor", "1 1 1", core::Cvar::Archive); + cl_crosshaircolor->set_info("[r g b] crosshairs color"); } void shutdown() @@ -180,8 +183,8 @@ void draw_cursor() render::Textures::bind("bitmaps/crosshair"); math::Color color; - if (draw_crosshaircolor && draw_crosshaircolor->value()) { - std::stringstream colorstr(draw_crosshaircolor->str()); + if (cl_crosshaircolor && cl_crosshaircolor->value()) { + std::stringstream colorstr(cl_crosshaircolor->str()); colorstr >> color; } |