Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/console.cc')
-rw-r--r--src/client/console.cc45
1 files changed, 25 insertions, 20 deletions
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;