KeosConsoleLookDefault.h

Go to the documentation of this file.
00001 /*
00002  * This source file is part of KEOS (Free 3D Engine)
00003  * For the latest info, see http://www.keosengine.org/
00004  * E-mails : thierry.vouriot@keosengine.org, yeri@keosengine.org
00005  *
00006  * This program is free software; you can redistribute it and/or modify it under
00007  * the terms of the GNU Lesser General Public License as published by the Free Software
00008  * Foundation; either version 2 of the License, or (at your option) any later
00009  * version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00013  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00018  * http://www.gnu.org/copyleft/lesser.txt.
00019  *
00020  */
00021 #ifndef KEOS_CONSOLELOOKDEFAULT_H
00022 #define KEOS_CONSOLELOOKDEFAULT_H
00023 
00024 #include "KeosPrerequisites.h"
00025 #include "KeosMesh.h"
00026 #include "KeosConsoleLook.h"
00027 #include "KeosMatrix4.h"
00028 #include "KeosColor.h"
00029 
00030 namespace Keos
00031 {
00032 
00033   namespace Console
00034   {
00035 
00036     //-----------------------------------------------------------------------
00040     class KEOS_EXPORT CLookDefault : public ILook
00041     {
00042     public :
00043 
00052       CLookDefault( const String& strFont, TVector2F Size, const String& strTexture,
00053                     const CColor& TextColor = CColor::White, const CColor& TextOkColor = CColor(150, 200, 150),
00054                     const CColor& TextErrorColor = CColor(200, 150, 150) );
00055 
00059       virtual void Update();
00060 
00064       virtual void Draw() const;
00065 
00070       virtual void Show(bool bVisible);
00071 
00076       virtual void CommandCalled(const String& strResult);
00077 
00082       virtual void TextChanged(const String& strNewText);
00083 
00088       virtual void Error(const String& strMessage);
00089 
00095       void SetTextColors(const CColor& TextColor, const CColor& TextOkColor, const CColor& TextErrorColor)
00096       {
00097         m_TextColor   = TextColor;
00098         m_TextOkColor  = TextOkColor;
00099         m_TextErrorColor = TextErrorColor;
00100       }
00101 
00102     private :
00103 
00105       enum TState {STOPPED_VISIBLE, STOPPED_INVISIBLE, HIDDING, SHOWING};
00106 
00111       void AddLine(const String& strLine, const CColor& Color);
00112 
00114       TMeshPtr                  m_Background;
00116       std::list<CGraphicString> m_Lines;
00118       CMatrix4                  m_Transfo;
00120       TState                    m_State;
00122       TVector2F                 m_nSize;
00123 
00125       String      m_strFont;
00127       size_t      m_nFontHeight;
00129       CColor  m_TextColor;
00131       CColor  m_TextErrorColor;
00133       CColor  m_TextOkColor;
00134     };
00135 
00139     struct Print
00140     {
00141       Print(const std::string& Text) : m_Text(Text)
00142       {}
00143 
00144       const std::string& operator ()() const
00145       {
00146         return m_Text;
00147       }
00148 
00149 private :
00150 
00151       std::string m_Text;
00152     };
00153 
00154   } // namespace Console
00155 
00156 } // namespace Keos
00157 
00158 #endif // KEOS_CONSOLELOOKDEFAULT_H

Generated on Fri Mar 9 14:29:02 2007 for Keos by  doxygen 1.5.1-p1