ConsoleImpl.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_ConsoleImpl_H__516D85F7_420B_43EB_B0BE_563DCBE1B143__INCLUDED_)
00022 #define AFX_ConsoleImpl_H__516D85F7_420B_43EB_B0BE_563DCBE1B143__INCLUDED_
00023 
00024 #include <common/LoggerI.h>
00025 #include <engine/GameStateI.h>
00026 #include <GLEXT/GLFont2d.h>
00027 #include <console/Console.h>
00028 #include <console/ConsoleMethods.h>
00029 #include <console/ConsoleLines.h>
00030 #include <console/ConsoleRules.h>
00031 
00032 class ConsoleImpl : public GameStateI, public LoggerI, public Console
00033 {
00034 public:
00035         ConsoleImpl();
00036         virtual ~ConsoleImpl();
00037 
00038         virtual void init();
00039 
00040         virtual void addRule(ConsoleRule *rule) { rules_.addRule(rule); }
00041         virtual void removeRule(ConsoleRule *rule) { rules_.removeRule(rule); }
00042 
00043         virtual void addLine(bool parse, const std::string &line);
00044         virtual void clear() { lines_.clear(); }
00045         virtual void help();
00046 
00047         std::deque<ConsoleLine *> &getLines() { return lines_.getLines(); }
00048 
00049         // Inherited from GameStateI
00050         virtual void simulate(const unsigned state, float frameTime);
00051         virtual void draw(const unsigned state);
00052         virtual void keyboardCheck(const unsigned state, float frameTime, 
00053                                                            char *buffer, unsigned int keyState,
00054                                                            KeyboardHistory::HistoryElement *history, int hisCount, 
00055                                                            bool &skipRest);
00056 
00057         // Inherited from LoggerI
00058         virtual void logMessage(LoggerInfo &info);
00059 
00060 protected:
00061         float height_;
00062         bool opening_;
00063         bool showCursor_;
00064         GLFont2d *font_;
00065         ConsoleLines lines_;
00066         ConsoleRules rules_;
00067         ConsoleMethods methods_;
00068         std::string currentLine_;
00069         int historyPosition_;
00070         std::deque<std::string> history_;
00071 
00072         void resetPositions();
00073         void drawBackdrop(float width, float top);
00074         void drawText(float width, float top);
00075 };
00076 
00077 #endif // !defined(AFX_ConsoleImpl_H__516D85F7_420B_43EB_B0BE_563DCBE1B143__INCLUDED_)

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