cocos2d学习笔记
doxygen工具 生成cocos2d的api文档
位图字体编辑工具 Glyph Designer
http://www.71squared.com/glyphdesigner 收费的
CCLableTTF 使用系统字体
//CCLabelTTF *label = [CCLabelTTF labelWithString:@"Hello World" fontName:@"Marker Felt" fontSize:64];
特点:渲染耗内存;
CCLabelAtlas 图片集标签,需要加载额外的图片集文件。每个字符固定的宽高
+ labelWithString:charMapFile:itemWidth:itemHeight:startCharMap:
特点:比CCLableTTF快很多
CCLabelBMFont 位图字体,需要添加字体文件:包括一个图片集(.png)和 字体坐标文件(.fnt),每个字符宽度是可变的
特点:比CCLableTTF快很多
CCMenu 菜单
CCMenu *menu = [CCMenu menuWithItems:itemAchievement, itemLeaderboard, nil]; 菜单包含两个 菜单项
菜单项:
// Default font size will be 28 points. [CCMenuItemFont setFontSize:28]; // to avoid a retain-cycle with the menuitem and blocks __block id copy_self = self; // Achievement Menu Item using blocks CCMenuItem *itemAchievement = [CCMenuItemFont itemWithString:@"Achievements" block:^(id sender) { GKAchievementViewController *achivementViewController = [[GKAchievementViewController alloc] init]; achivementViewController.achievementDelegate = copy_self; AppController *app = (AppController*) [[UIApplication sharedApplication] delegate]; [[app navController] presentModalViewController:achivementViewController animated:YES]; [achivementViewController release]; }]; // Leaderboard Menu Item using blocks CCMenuItem *itemLeaderboard = [CCMenuItemFont itemWithString:@"Leaderboard" block:^(id sender) { GKLeaderboardViewController *leaderboardViewController = [[GKLeaderboardViewController alloc] init]; leaderboardViewController.leaderboardDelegate = copy_self; AppController *app = (AppController*) [[UIApplication sharedApplication] delegate]; [[app navController] presentModalViewController:leaderboardViewController animated:YES]; [leaderboardViewController release]; }];
菜单项的基本状态:正常,选中,禁止
精灵 ccsprite
纹理 cctexture 是opengl为模型贴图的图片 它的大小为2的n次幂;
纹理缓冲区 cctexturecache
精灵表---由一个png文件和一个plist文件组成
使用精灵帧缓存CCSpriteFrameCache来使用精灵表;
精灵表辅助工具:
TexturePacker
红孩儿工具箱
CCGridAction 特效类 也称为网格动作
CocosDenshion 音频处理引擎
具体使用的api是SimpleAudioEngine