00001 /* 00002 Gel2D Game Engine - Cross-platform 2D gaming middleware 00003 Copyright (C) 2010-2011 Mark D. Procarione 00004 00005 Gel2D is free software: you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation, either version 3 of the License, or 00008 (at your option) any later version. 00009 00010 Gel2D is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 */ 00015 00016 #ifndef __GELTEXT_H__ 00017 #define __GELTEXT_H__ 00018 00019 #include "gelFont.h" 00020 00021 namespace gel 00022 { 00024 00026 class GelText : public GelObject, public GelTextureObject 00027 { 00028 public: 00030 GelText(); 00031 00033 00034 GelText( GelFont *fnt ); 00035 00037 00040 GelText( GelFont *fnt, const char *st, ... ); 00041 00043 00045 GelText( GelFont *fnt, Gel2dVec obj_pos ); 00046 00048 ~GelText(); 00049 00051 00052 GelFont *getFont() const { return font; } 00053 00055 00056 void setFont( GelFont *fnt ); 00057 00059 00061 void setString( const char *st, ... ); 00062 00064 void setCharPos( Gel2dVec position ); 00065 00067 void setCharRot( float deg ); 00068 00070 void setCharScl( Gel2dVec scale ); 00071 00073 00075 void skewChar( float sk ) { skew = sk; } 00076 00078 00081 void setMaxLineLength( int len ) { maxLineLength = len; } 00082 00084 00085 float getMaxLineLength() const { return maxLineLength; } 00086 00088 00091 float getStringLength(); 00092 00094 00097 float getStringLength( const char *str ); 00098 00100 00101 void setCharSpacing( float dist ) { charSpacing = dist; } 00102 00104 00105 float getCharSpacing() const { return charSpacing; } 00106 00108 00109 void setLineSpacing( float dist ) { lineSpacing = dist; } 00110 00112 00113 float getLineSpacing() const { return lineSpacing; } 00114 00116 void setAlignment( Alignment mode ) { align = mode; } 00117 00119 Alignment getAlignment() const { return align; } 00120 00122 void setOrientation( Orientation mode ) { orient = mode; }; 00123 00125 Orientation getOrientation() const { return orient; } 00126 00128 00129 GelColor getCol() const { return col; } 00131 00132 void setCol( GelColor color ); 00134 00137 void setRGB( float r, float g, float b ) { col.setRGB(r, g, b); } 00139 00140 float getAlpha() const { return col.a; } 00142 00144 void setAlpha( float alpha ) { col.a = alpha; } 00145 00147 00148 void setTexture( GelTexture *tex ); 00149 00151 void render(); 00152 00153 private: 00154 void _init(); 00155 float _getStringLength(); 00156 00157 private: 00158 GelColor col; 00159 00160 char string[1024]; 00161 00162 GelFont *font; 00163 00164 float charSpacing; 00165 float lineSpacing; 00166 Orientation orient; 00167 Alignment align; 00168 float maxLineLength; 00169 00170 float skew; 00171 00172 public: 00173 GelFontChar fchar[256]; 00174 }; 00175 } 00176 00177 #endif // __GELTEXT_H__
API Documentation by Mark D. Procarione | Generated by |