Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

# 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 "KeosModel.h"
    00026 #include "KeosConsoleLook.h"
    00027 #include "KeosMatrix4.h"
    00028 #include "KeosColor.h"
    00029
    00030 namespace Keos {
    00031
    00032         namespace Console {
    00033
    00034         //-----------------------------------------------------------------------
    00037             class KEOS_EXPORT CLookDefault : public ILook
    00038             {
    00039             public :
    00040
    00049                     CLookDefault(       const String& strFont, TVector2F Size, const String& strTexture,
    00050                                                     const CColor& TextColor = CColor::White, const CColor& TextOkColor = CColor(150, 200, 150),
    00051                                                     const CColor& TextErrorColor = CColor(200, 150, 150) );
    00052
    00056                     virtual void Update();
    00057
    00061                     virtual void Draw() const;
    00062
    00067                     virtual void Show(bool bVisible);
    00068
    00073                     virtual void CommandCalled(const String& strResult);
    00074
    00079                     virtual void TextChanged(const String& strNewText);
    00080
    00085                     virtual void Error(const String& strMessage);
    00086
    00092                     void SetTextColors(const CColor& TextColor, const CColor& TextOkColor, const CColor& TextErrorColor)
    00093                     {
    00094                             m_TextColor                 = TextColor;
    00095                             m_TextOkColor               = TextOkColor;
    00096                             m_TextErrorColor    = TextErrorColor;
    00097                     }
    00098
    00099             private :
    00100
    00102                 enum TState {STOPPED_VISIBLE, STOPPED_INVISIBLE, HIDDING, SHOWING};
    00103
    00108                     void AddLine(const String& strLine, const CColor& Color);
    00109
    00111                     TModelPtr                 m_Background;
    00113                     std::list<CGraphicString> m_Lines;
    00115             CMatrix4                  m_Transfo;
    00117                     TState                    m_State;
    00119             TVector2F                 m_nSize;
    00120
    00122                     String    m_strFont;
    00124                     size_t    m_nFontHeight;
    00126                     CColor              m_TextColor;
    00128                     CColor              m_TextErrorColor;
    00130                     CColor              m_TextOkColor;
    00131                     };
    00132
    00136             struct Print
    00137         {
    00138             Print(const std::string& Text) : m_Text(Text) {}
    00139
    00140             const std::string& operator ()() const
    00141             {
    00142                 return m_Text;
    00143             }
    00144
    00145         private :
    00146
    00147             std::string m_Text;
    00148         };
    00149
    00150         } // namespace Console
    00151
    00152 } // namespace Keos
    00153
    00154 #endif // KEOS_CONSOLELOOKDEFAULT_H