From: <ice...@us...> - 2009-06-29 11:02:12
|
Revision: 2063 http://crayzedsgui.svn.sourceforge.net/crayzedsgui/?rev=2063&view=rev Author: ice-drezday Date: 2009-06-29 11:02:09 +0000 (Mon, 29 Jun 2009) Log Message: ----------- added ability to specify initial font and colours to the BasicRenderedStringParser. Fixed class description for BasicRenderedStringParser. Modified Paths: -------------- cegui_mk2/trunk/cegui/include/CEGUIBasicRenderedStringParser.h cegui_mk2/trunk/cegui/src/CEGUIBasicRenderedStringParser.cpp Modified: cegui_mk2/trunk/cegui/include/CEGUIBasicRenderedStringParser.h =================================================================== --- cegui_mk2/trunk/cegui/include/CEGUIBasicRenderedStringParser.h 2009-06-29 10:24:11 UTC (rev 2062) +++ cegui_mk2/trunk/cegui/include/CEGUIBasicRenderedStringParser.h 2009-06-29 11:02:09 UTC (rev 2063) @@ -39,18 +39,29 @@ { /*! \brief - A middle level string parser that is intended to be subclassed in order to - implement actual creation of the RenderedStringComponent objects based upon - control constructs extracted from the input string. + Basic RenderedStringParser class that offers support for 'colour', 'font', + 'image' and 'window' control tags. */ class CEGUIEXPORT BasicRenderedStringParser : public RenderedStringParser { public: //! Constructor. BasicRenderedStringParser(); + /*! + \brief + Initialising constructor. + + \param initial_font + Reference to a String holding the name of the initial font to be used. + + \param initial_colours + Reference to a ColourRect describing the initial colours to be used. + */ + BasicRenderedStringParser(const String& initial_font, + const ColourRect& initial_colours); //! Destructor. virtual ~BasicRenderedStringParser(); - + // implement required interface from RenderedStringParser RenderedString parse(const String& input_string); @@ -64,12 +75,17 @@ //! initialise the default state virtual void initialiseDefaultState(); + //! initial font name + String d_initialFontName; + //! initial colours + ColourRect d_initialColours; //! active padding values. Rect d_padding; //! active colour values. ColourRect d_colours; //! active font. String d_fontName; + }; } // End of CEGUI namespace section Modified: cegui_mk2/trunk/cegui/src/CEGUIBasicRenderedStringParser.cpp =================================================================== --- cegui_mk2/trunk/cegui/src/CEGUIBasicRenderedStringParser.cpp 2009-06-29 10:24:11 UTC (rev 2062) +++ cegui_mk2/trunk/cegui/src/CEGUIBasicRenderedStringParser.cpp 2009-06-29 11:02:09 UTC (rev 2063) @@ -36,12 +36,22 @@ namespace CEGUI { //----------------------------------------------------------------------------// -BasicRenderedStringParser::BasicRenderedStringParser() +BasicRenderedStringParser::BasicRenderedStringParser() : + d_initialColours(0xFFFFFFFF) { initialiseDefaultState(); } //----------------------------------------------------------------------------// +BasicRenderedStringParser::BasicRenderedStringParser(const String& initial_font, + const ColourRect& initial_colours) : + d_initialFontName(initial_font), + d_initialColours(initial_colours) +{ + initialiseDefaultState(); +} + +//----------------------------------------------------------------------------// BasicRenderedStringParser::~BasicRenderedStringParser() { } @@ -53,7 +63,7 @@ RenderedString rs; String curr_section; - + size_t curr_pos = 0; while (curr_pos < input_string.length()) @@ -173,8 +183,8 @@ void BasicRenderedStringParser::initialiseDefaultState() { d_padding = Rect(0, 0, 0, 0); - d_colours.setColours(0xFFFFFFFF); - d_fontName.clear(); + d_colours = d_initialColours; + d_fontName = d_initialFontName; } //----------------------------------------------------------------------------// This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |