00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #import "CCAtlasNode.h"
00036 #import "CCSpriteSheet.h"
00037 #import "Support/uthash.h"
00038
00039 struct _KerningHashElement;
00040
00044 typedef struct _bitmapFontDef {
00046 unsigned int charID;
00048 CGRect rect;
00050 int xOffset;
00052 int yOffset;
00054 int xAdvance;
00055 } ccBitmapFontDef;
00056
00061 typedef struct _bitmapFontPadding {
00063 int left;
00065 int top;
00067 int right;
00069 int bottom;
00070 } ccBitmapFontPadding;
00071
00072 enum {
00073
00074 kCCBitmapFontAtlasMaxChars = 2048,
00075 };
00076
00080 @interface CCBitmapFontConfiguration : NSObject
00081 {
00082
00083 @public
00084
00085 ccBitmapFontDef bitmapFontArray[kCCBitmapFontAtlasMaxChars];
00086
00087
00088 NSUInteger commonHeight;
00089
00090
00091 ccBitmapFontPadding padding;
00092
00093
00094 NSString *atlasName;
00095
00096
00097 struct _KerningHashElement *kerningDictionary;
00098 }
00099
00101 +(id) configurationWithFNTFile:(NSString*)FNTfile;
00103 -(id) initWithFNTfile:(NSString*)FNTfile;
00104 @end
00105
00106
00136 @interface CCBitmapFontAtlas : CCSpriteSheet <CCLabelProtocol, CCRGBAProtocol>
00137 {
00138
00139 NSString *string_;
00140
00141 CCBitmapFontConfiguration *configuration_;
00142
00143
00144 GLubyte opacity_;
00145 ccColor3B color_;
00146 BOOL opacityModifyRGB_;
00147 }
00148
00153 +(void) purgeCachedData;
00154
00156 @property (nonatomic,readwrite) GLubyte opacity;
00158 @property (nonatomic,readwrite) ccColor3B color;
00159
00160
00162 +(id) bitmapFontAtlasWithString:(NSString*)string fntFile:(NSString*)fntFile;
00163
00165 -(id) initWithString:(NSString*)string fntFile:(NSString*)fntFile;
00166
00168 -(void) createFontChars;
00169 @end
00170
00173 CCBitmapFontConfiguration * FNTConfigLoadFile( NSString *file );
00176 void FNTConfigRemoveCache( void );