Console logging is now identical in all builds; warning and error show the console...
[supertux.git] / src / supertux / console.cpp
index 71a7fd5..883ec09 100644 (file)
@@ -363,7 +363,7 @@ Console::addLine(std::string s)
     lines.pop_back();
 
   // increase console height if necessary
-  if (height < 64) {
+  if ((stayOpen > 0) && (height < 64)) {
     if(height < 4)
       height = 4;
     height += fontheight * line_count;
@@ -371,10 +371,6 @@ Console::addLine(std::string s)
 
   // reset console to full opacity
   alpha = 1.0;
-
-  // increase time that console stays open
-  if(stayOpen < 6)
-    stayOpen += 1.5;
 }
 
 void
@@ -439,6 +435,13 @@ Console::show()
 }
 
 void
+Console::open()
+{
+  if(stayOpen < 2)
+    stayOpen += 1.5;
+}
+
+void
 Console::hide()
 {
   focused = false;
@@ -501,10 +504,10 @@ Console::draw(DrawingContext& context)
   if (focused) {
     lineNo++;
     float py = height-4-1 * font->get_height();
-    context.draw_text(font.get(), "> "+inputBuffer, Vector(4, py), ALIGN_LEFT, layer);
+    context.draw_text(font, "> "+inputBuffer, Vector(4, py), ALIGN_LEFT, layer);
     if (SDL_GetTicks() % 1000 < 750) {
       int cursor_px = 2 + inputBufferPosition;
-      context.draw_text(font.get(), "_", Vector(4 + (cursor_px * font->get_text_width("X")), py), ALIGN_LEFT, layer);
+      context.draw_text(font, "_", Vector(4 + (cursor_px * font->get_text_width("X")), py), ALIGN_LEFT, layer);
     }
   }
 
@@ -514,7 +517,7 @@ Console::draw(DrawingContext& context)
     lineNo++;
     float py = height - 4 - lineNo*font->get_height();
     if (py < -font->get_height()) break;
-    context.draw_text(font.get(), *i, Vector(4, py), ALIGN_LEFT, layer);
+    context.draw_text(font, *i, Vector(4, py), ALIGN_LEFT, layer);
   }
   context.pop_transform();
 }