ConsoleLines.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #if !defined(AFX_ConsoleLINES_H__2DA65C94_3E52_43C6_B75B_D0CEDBF6A9DE__INCLUDED_)
00022 #define AFX_ConsoleLINES_H__2DA65C94_3E52_43C6_B75B_D0CEDBF6A9DE__INCLUDED_
00023 
00024 #include <GLEXT/GLFont2d.h>
00025 #include <deque>
00026 #include <string>
00027 
00028 class ConsoleLine
00029 {
00030 public:
00031         enum LineType
00032         {
00033                 eNone,
00034                 eCommand,
00035                 eCommandCont
00036         };
00037 
00038         ConsoleLine();
00039         virtual ~ConsoleLine();
00040 
00041         void set(const LangString &line, LineType type);
00042         void drawLine(float x, float y, GLFont2d *font);
00043 
00044         LineType getLineType() { return lineType_; }
00045         const LangString &getLine() { return line_; }
00046 
00047 protected:
00048         unsigned int lineNumber_;
00049         LangString line_;
00050         LangString lineNumberStr_;
00051         static unsigned nextLineNumber_;
00052         LineType lineType_;
00053 
00054 };
00055 
00056 class ConsoleLines  
00057 {
00058 public:
00059         ConsoleLines(int maxLines);
00060         virtual ~ConsoleLines();
00061 
00062         void addLine(const std::string &line, bool showPointer);
00063         void drawLines(GLFont2d *font, float startHeight, float totalHeight, float totalWidth);
00064 
00065         void clear();
00066 
00067         void resetScroll() { currentLine_ = 0; }
00068         void scroll(int lines);
00069 
00070         std::deque<ConsoleLine *> &getLines() { return lines_; }
00071 
00072 protected:
00073         std::deque<ConsoleLine *> lines_;
00074         int maxLines_;
00075         int currentLine_;
00076 
00077         void addSmallLine(int section, const LangString &line, bool showPointer);
00078 
00079 };
00080 
00081 #endif // !defined(AFX_ConsoleLINES_H__2DA65C94_3E52_43C6_B75B_D0CEDBF6A9DE__INCLUDED_)

Generated on Mon Feb 16 15:14:37 2009 for Scorched3D by  doxygen 1.5.3