From: Rodrigo H. <kw...@us...> - 2004-05-21 13:48:42
|
Update of /cvsroot/aedgui/aedGUI/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23670/include Modified Files: aedColor.h aedFont.h aedRect.h Log Message: aedFont now uses a vector of surfaces for text rendering Index: aedRect.h =================================================================== RCS file: /cvsroot/aedgui/aedGUI/include/aedRect.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** aedRect.h 6 Nov 2003 18:46:33 -0000 1.7 --- aedRect.h 21 May 2004 13:48:29 -0000 1.8 *************** *** 146,150 **** return true; } ! private: Sint32 m_X, m_Y, m_W, m_H; --- 146,150 ---- return true; } ! bool intersectRect(const SDL_Rect& rect1, const SDL_Rect& rect2); private: Sint32 m_X, m_Y, m_W, m_H; Index: aedColor.h =================================================================== RCS file: /cvsroot/aedgui/aedGUI/include/aedColor.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** aedColor.h 6 Nov 2003 18:46:32 -0000 1.6 --- aedColor.h 21 May 2004 13:48:29 -0000 1.7 *************** *** 100,103 **** --- 100,111 ---- return c; } + bool operator!=(aedColor c) + { + return ((c.r!=r)||(c.g!=g)||(c.b!=b)||(c.a!=a)); + } + bool operator==(aedColor c) + { + return ((c.r==r)&&(c.g==g)&&(c.b==b)&&(c.a==a)); + } private: Uint8 r, g, b, a; Index: aedFont.h =================================================================== RCS file: /cvsroot/aedgui/aedGUI/include/aedFont.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** aedFont.h 12 Mar 2004 03:33:25 -0000 1.13 --- aedFont.h 21 May 2004 13:48:29 -0000 1.14 *************** *** 27,31 **** #include "dllmacros.h" #include "aedColor.h" ! #ifdef _MSC_VER #pragma warning(disable:4800) --- 27,32 ---- #include "dllmacros.h" #include "aedColor.h" ! #include <vector> ! using namespace std; #ifdef _MSC_VER #pragma warning(disable:4800) *************** *** 39,43 **** typedef struct _TTF_Font TTF_Font; ! /** The aedFont class handles text rendering. */ // Added DLLEXPORT to some functions to see if it solves the problem with // MinGW gcc 3.2.3 not exporting the symbols --- 40,54 ---- typedef struct _TTF_Font TTF_Font; ! typedef struct chardata ! { ! SDL_Surface *solidSurface; ! SDL_Surface *blendedSurface; ! int yoffset; // how far from the top should the char be blit ! int advance; // how much space to skip for next character ! aedColor blendedColor; ! aedColor solidColor; ! }; ! ! /** The aedFont class handles text rendering thru SDL_ttf. */ // Added DLLEXPORT to some functions to see if it solves the problem with // MinGW gcc 3.2.3 not exporting the symbols *************** *** 69,102 **** // These return rendered string as a surface which the caller must free #ifndef _MSC_VER DLLEXPORT #endif ! SDL_Surface *renderTextSolid(const char *str, const aedColor & color); ! #ifndef _MSC_VER ! DLLEXPORT ! #endif ! SDL_Surface *renderTextShaded(const char *str, const aedColor & fg, ! const aedColor & bg); ! #ifndef _MSC_VER ! DLLEXPORT ! #endif ! SDL_Surface *renderTextBlended(const char *str, const aedColor & color); ! ! // These are just for convenience, render directly to the given surface #ifndef _MSC_VER DLLEXPORT #endif ! void renderTextSolid(SDL_Surface * s, int x, int y, const char *str, ! const aedColor & color); #ifndef _MSC_VER DLLEXPORT #endif ! void renderTextShaded(SDL_Surface * s, int x, int y, const char *str, ! const aedColor & fg, const aedColor & bg); #ifndef _MSC_VER DLLEXPORT #endif ! void renderTextBlended(SDL_Surface * s, int x, int y, const char *str, ! const aedColor & color); static Uint16 getUnicode(const char *utf8, int *advance) { --- 80,163 ---- // These return rendered string as a surface which the caller must free + /* #ifndef _MSC_VER */ + /* DLLEXPORT */ + /* #endif */ + /* SDL_Surface *renderTextSolid(const char *str, const aedColor & color); */ + /* #ifndef _MSC_VER */ + /* DLLEXPORT */ + /* #endif */ + /* SDL_Surface *renderTextShaded(const char *str, const aedColor & fg, */ + /* const aedColor & bg); */ + /* #ifndef _MSC_VER */ + /* DLLEXPORT */ + /* #endif */ + /* SDL_Surface *renderTextBlended(const char *str, const aedColor & color); */ + + // These are just for convenience, render directly to the given surface #ifndef _MSC_VER DLLEXPORT #endif ! /*! renderTextSolid ! Renders the specified text on str to the Surface s with hard edges, ! it clips the text in case it runs past the width of the surface ! \param s Surface where the text should be blit to ! \param x X position for the blit ! \param Y Y position for the blit ! \param str text to blit ! \param color foreground text color ! \return Returns the number of characters blit, including characters which ! were partially blit due to clipping. ! \sa aedFont::renderTextBlended,aedFont::renderTextShaded ! */ ! int renderTextSolid(SDL_Surface * s, int x, int y, const char *str, ! aedColor & color); #ifndef _MSC_VER DLLEXPORT #endif ! /*! renderTextBlended ! Renders the specified text on str to the Surface s with a solid background, ! it clips the text in case it runs past the width of the surface ! \param s Surface where the text should be blit to ! \param x X position for the blit ! \param Y Y position for the blit ! \param str text to blit ! \param fg foreground text color ! \param bg background text color ! \return Returns the number of characters blit, including characters which ! were partially blit due to clipping. ! \sa aedFont::renderTextSolid,aedFont::renderTextBlended ! */ ! int renderTextShaded(SDL_Surface * s, int x, int y, const char *str, ! aedColor & fg, aedColor & bg); #ifndef _MSC_VER DLLEXPORT #endif ! /*! renderTextBlended ! Renders the specified text on str to the Surface s with soft edges, ! it clips the text in case it runs past the width of the surface ! \param s Surface where the text should be blit to ! \param x X position for the blit ! \param Y Y position for the blit ! \param str text to blit ! \param color foreground text color ! \return Returns the number of characters blit, including characters which ! were partially blit due to clipping. ! \sa aedFont::renderTextSolid,aedFont::renderTextShaded ! */ ! int renderTextBlended(SDL_Surface * s, int x, int y, const char *str, ! aedColor & color); #ifndef _MSC_VER DLLEXPORT #endif ! /*! getMaxCharLen ! returns the number of characterss from "str" that would fit in "s" at x,y ! \param s Surface where the text would be blit to ! \param x X position for the blit ! \param Y Y position for the blit ! \param str text to check for ! \return Returns the number of complete characters that fit in the Surface if one of the renderText[Solid|Blended|Shaded] member functions where called with these parameters ! \sa aedFont::renderTextSolid,aedFont::renderTextBlended,aedFont::renderTextShaded ! */ ! int getMaxCharLen(SDL_Surface * s, int x, int y, const char *str); static Uint16 getUnicode(const char *utf8, int *advance) { *************** *** 126,133 **** return ch; } ! private: ! TTF_Font * data; ! // This isn't the best design, but it does what we need: // allow only aedApp to open and close fonts --- 187,201 ---- return ch; } ! inline TTF_Font* getTTFFont(){return data;}; private: ! TTF_Font * data; ! /** ! These are going to hold out font Tables ! */ ! vector<chardata> charVector; ! void generateFontVector(); ! void destroyFontVector(); ! int charcount; /**< Number of characters available default to 224 ASCII Extended */ ! int charoffset; /**< Offset to first printable character in table, default 32 (SPACE in ASCII Extended) */ // This isn't the best design, but it does what we need: // allow only aedApp to open and close fonts |