Skip to content

Commit c46b3ca

Browse files
s1ddoks1ddok
authored andcommitted
Simply move CCLabelBMF private header into the bottom of main one
1 parent 2df6e96 commit c46b3ca

File tree

4 files changed

+126
-167
lines changed

4 files changed

+126
-167
lines changed

cocos2d.xcodeproj/project.pbxproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@
161161
08F4AB301C6E98A1004DAAF7 /* CCLabelBMFont.h in Headers */ = {isa = PBXBuildFile; fileRef = E01E6D8A121F130E001A484F /* CCLabelBMFont.h */; };
162162
08F4AB311C6E98A1004DAAF7 /* CCDirectorIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = E0EAD0EA121F4B4600B0C81C /* CCDirectorIOS.h */; };
163163
08F4AB321C6E98A1004DAAF7 /* CCGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = E0EAD0F3121F4B4600B0C81C /* CCGLView.h */; };
164-
08F4AB331C6E98A1004DAAF7 /* CCLabelBMFont_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = B798D142181F469100E7BFCD /* CCLabelBMFont_Private.h */; };
165164
08F4AB341C6E98A1004DAAF7 /* CCGL.h in Headers */ = {isa = PBXBuildFile; fileRef = E0EAD19C121F4D7300B0C81C /* CCGL.h */; };
166165
08F4AB351C6E98A1004DAAF7 /* CCConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = E0EAD1F0121F522A00B0C81C /* CCConfiguration.h */; };
167166
08F4AB361C6E98A1004DAAF7 /* CCTexturePVR.h in Headers */ = {isa = PBXBuildFile; fileRef = E0F9246F1224140400EF2362 /* CCTexturePVR.h */; };
@@ -280,7 +279,6 @@
280279
7A59467719E372EF00F65F90 /* CCDrawNode.h in Headers */ = {isa = PBXBuildFile; fileRef = A0DA0BC115BCDCA200E80A92 /* CCDrawNode.h */; };
281280
7A59467919E372EF00F65F90 /* CCLabelBMFont.h in Headers */ = {isa = PBXBuildFile; fileRef = E01E6D8A121F130E001A484F /* CCLabelBMFont.h */; };
282281
7A59467B19E372EF00F65F90 /* CCLabelTTF.h in Headers */ = {isa = PBXBuildFile; fileRef = 5018F25C0DFDEAFF00C013A5 /* CCLabelTTF.h */; };
283-
7A59467D19E372EF00F65F90 /* CCLabelBMFont_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = B798D142181F469100E7BFCD /* CCLabelBMFont_Private.h */; };
284282
7A59467E19E372EF00F65F90 /* CCAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = E02BB702126CADEA006E46A2 /* CCAnimation.h */; };
285283
7A59468019E372EF00F65F90 /* CCAnimationCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E02BB6D4126CA93A006E46A2 /* CCAnimationCache.h */; };
286284
7A59468219E372EF00F65F90 /* CCSprite.h in Headers */ = {isa = PBXBuildFile; fileRef = 509A79950F6188420032F449 /* CCSprite.h */; };
@@ -464,7 +462,6 @@
464462
B78AE46917E7AF1C0028BE0B /* CCScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = B78AE46117E7AF1C0028BE0B /* CCScrollView.m */; };
465463
B78AE46C17E7AF6C0028BE0B /* UITouch+CC.h in Headers */ = {isa = PBXBuildFile; fileRef = B78AE46A17E7AF6C0028BE0B /* UITouch+CC.h */; };
466464
B78AE46D17E7AF6C0028BE0B /* UITouch+CC.m in Sources */ = {isa = PBXBuildFile; fileRef = B78AE46B17E7AF6C0028BE0B /* UITouch+CC.m */; };
467-
B798D143181F469100E7BFCD /* CCLabelBMFont_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = B798D142181F469100E7BFCD /* CCLabelBMFont_Private.h */; };
468465
B79F905A17FE2A2E00908504 /* CCTableView.h in Headers */ = {isa = PBXBuildFile; fileRef = B79F905817FE2A2E00908504 /* CCTableView.h */; };
469466
B79F905B17FE2A2E00908504 /* CCTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = B79F905917FE2A2E00908504 /* CCTableView.m */; };
470467
B7E260D818171D2000A0E872 /* CCTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = B7E260D618171D2000A0E872 /* CCTextField.h */; };
@@ -677,7 +674,6 @@
677674
B78AE46117E7AF1C0028BE0B /* CCScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCScrollView.m; path = "cocos2d-ui/CCScrollView.m"; sourceTree = "<group>"; };
678675
B78AE46A17E7AF6C0028BE0B /* UITouch+CC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITouch+CC.h"; sourceTree = "<group>"; };
679676
B78AE46B17E7AF6C0028BE0B /* UITouch+CC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITouch+CC.m"; sourceTree = "<group>"; };
680-
B798D142181F469100E7BFCD /* CCLabelBMFont_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLabelBMFont_Private.h; sourceTree = "<group>"; };
681677
B79F905817FE2A2E00908504 /* CCTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CCTableView.h; path = "cocos2d-ui/CCTableView.h"; sourceTree = "<group>"; };
682678
B79F905917FE2A2E00908504 /* CCTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CCTableView.m; path = "cocos2d-ui/CCTableView.m"; sourceTree = "<group>"; };
683679
B7C6237917EA7D8600928F91 /* cocos2d-ui.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "cocos2d-ui.h"; path = "cocos2d-ui/cocos2d-ui.h"; sourceTree = "<group>"; };
@@ -1016,7 +1012,6 @@
10161012
E01E6D8B121F130E001A484F /* CCLabelBMFont.m */,
10171013
5018F25C0DFDEAFF00C013A5 /* CCLabelTTF.h */,
10181014
5018F25D0DFDEAFF00C013A5 /* CCLabelTTF.m */,
1019-
B798D142181F469100E7BFCD /* CCLabelBMFont_Private.h */,
10201015
);
10211016
name = "Label Nodes";
10221017
sourceTree = "<group>";
@@ -1357,7 +1352,6 @@
13571352
08F4AB301C6E98A1004DAAF7 /* CCLabelBMFont.h in Headers */,
13581353
08F4AB311C6E98A1004DAAF7 /* CCDirectorIOS.h in Headers */,
13591354
08F4AB321C6E98A1004DAAF7 /* CCGLView.h in Headers */,
1360-
08F4AB331C6E98A1004DAAF7 /* CCLabelBMFont_Private.h in Headers */,
13611355
08F4AB341C6E98A1004DAAF7 /* CCGL.h in Headers */,
13621356
08F4AB351C6E98A1004DAAF7 /* CCConfiguration.h in Headers */,
13631357
08F4AB361C6E98A1004DAAF7 /* CCTexturePVR.h in Headers */,
@@ -1448,7 +1442,6 @@
14481442
E01E6D8C121F130E001A484F /* CCLabelBMFont.h in Headers */,
14491443
E0EAD0FF121F4B4600B0C81C /* CCDirectorIOS.h in Headers */,
14501444
E0EAD108121F4B4600B0C81C /* CCGLView.h in Headers */,
1451-
B798D143181F469100E7BFCD /* CCLabelBMFont_Private.h in Headers */,
14521445
E0EAD19D121F4D7300B0C81C /* CCGL.h in Headers */,
14531446
E0EAD1F1121F522A00B0C81C /* CCConfiguration.h in Headers */,
14541447
E0F924711224140400EF2362 /* CCTexturePVR.h in Headers */,
@@ -1495,7 +1488,6 @@
14951488
7A59467719E372EF00F65F90 /* CCDrawNode.h in Headers */,
14961489
7A59467919E372EF00F65F90 /* CCLabelBMFont.h in Headers */,
14971490
7A59467B19E372EF00F65F90 /* CCLabelTTF.h in Headers */,
1498-
7A59467D19E372EF00F65F90 /* CCLabelBMFont_Private.h in Headers */,
14991491
7A59467E19E372EF00F65F90 /* CCAnimation.h in Headers */,
15001492
7A59468019E372EF00F65F90 /* CCAnimationCache.h in Headers */,
15011493
7A59468219E372EF00F65F90 /* CCSprite.h in Headers */,

cocos2d/CCLabelBMFont.h

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,5 +183,131 @@
183183

184184
@end
185185

186+
enum {
187+
kCCLabelAutomaticWidth = -1,
188+
};
186189

190+
// ccBMFontDef BMFont definition.
191+
typedef struct _BMFontDef {
192+
193+
// ID of the character.
194+
unichar charID;
195+
196+
// Origin and size of the font
197+
CGRect rect;
198+
199+
// The X amount the image should be offset when drawing the image (in pixels)
200+
short xOffset;
201+
202+
// The Y amount the image should be offset when drawing the image (in pixels)
203+
short yOffset;
204+
205+
// The amount to move the current position after drawing the character (in pixels)
206+
short xAdvance;
207+
208+
} ccBMFontDef;
209+
210+
// cBMFontPadding BMFont padding.
211+
typedef struct _BMFontPadding {
212+
213+
// Padding left.
214+
int left;
215+
216+
// Padding top.
217+
218+
int top;
219+
// Padding right.
220+
221+
int right;
222+
223+
// Padding bottom.
224+
int bottom;
225+
226+
} ccBMFontPadding;
227+
228+
#pragma mark - Hash Element
229+
// tCCFontDefHashElement.
230+
typedef struct _FontDefHashElement {
231+
232+
// Key. Font Unicode value.
233+
NSUInteger key;
234+
235+
// Font definition.
236+
ccBMFontDef fontDef;
237+
238+
UT_hash_handle hh;
239+
240+
} tCCFontDefHashElement;
241+
242+
// tCCKerningHashElement.
243+
typedef struct _KerningHashElement {
244+
245+
// Key for the hash. 16-bit for 1st element, 16-bit for 2nd element.
246+
int key;
247+
248+
// Kerning value.
249+
int amount;
250+
251+
// Had Handle.
252+
UT_hash_handle hh;
253+
254+
} tCCKerningHashElement;
255+
256+
// CCBMFontConfiguration stores the parsed configuration of the specified .fnt file.
257+
@interface CCBMFontConfiguration : NSObject {
258+
259+
// The character set defines the letters that actually exist in the font.
260+
NSCharacterSet *_characterSet;
261+
262+
// The atlas name.
263+
NSString *_atlasName;
264+
265+
@public
266+
267+
// BMFont definitions.
268+
tCCFontDefHashElement *_fontDefDictionary;
269+
270+
// FNTConfig: Common Height.
271+
NSInteger _commonHeight;
272+
273+
// Padding.
274+
ccBMFontPadding _padding;
275+
276+
// Values for kerning.
277+
tCCKerningHashElement *_kerningDictionary;
278+
}
279+
280+
/// -----------------------------------------------------------------------
281+
/// @name Accessing the Configuration Attributes
282+
/// -----------------------------------------------------------------------
283+
284+
// The character set defines the letters that actually exist in the font.
285+
@property (nonatomic, strong, readonly) NSCharacterSet *characterSet;
286+
287+
// The atlas name.
288+
@property (nonatomic, readwrite, strong) NSString *atlasName;
289+
290+
// Creates and returns a CCBMFontConfiguration object from a specified font file value.
291+
+(instancetype) configurationWithFNTFile:(NSString*)FNTfile;
292+
293+
294+
/// -----------------------------------------------------------------------
295+
/// @name Initializing a CCLabelBMFont Object
296+
/// -----------------------------------------------------------------------
297+
298+
// Initializes and returns a CCBMFontConfiguration object from a specified font file value.
299+
-(id) initWithFNTfile:(NSString*)FNTfile;
300+
301+
@end
302+
303+
304+
/// -----------------------------------------------------------------------
305+
/// @name Free Functions
306+
/// -----------------------------------------------------------------------
307+
308+
// Load/Cache font configuration file and return object.
309+
CCBMFontConfiguration* FNTConfigLoadFile(NSString *file);
310+
311+
// Clear font configuration cache.
312+
void FNTConfigRemoveCache(void);
187313

cocos2d/CCLabelBMFont.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#import "Support/CCFileUtils.h"
4646
#import "Support/CGPointExtension.h"
4747
#import "Support/uthash.h"
48-
#import "CCLabelBMFont_Private.h"
4948

5049
#pragma mark -
5150
#pragma mark FNTConfig Cache - free functions

cocos2d/CCLabelBMFont_Private.h

Lines changed: 0 additions & 158 deletions
This file was deleted.

0 commit comments

Comments
 (0)