iphone加载一组图片的方法
//加入一组精灵图片,里面包含5附图片 CCSpriteSheet * pMainMenu = [CCSpriteSheet spriteSheetWithFile:@"MainMenu.png"]; [self addChild:pMainMenu]; //从刚才的pMainMenu 加载精灵材质 m_pPicPoint.m_pContinuePlay = [CHoudleForTouch HoudleForTouchWithRect:CGRectMake(0, 0, 165, 30) spriteManager:pMainMenu]; m_pPicPoint.m_pStartGame = [CHoudleForTouch HoudleForTouchWithRect:CGRectMake(0, 33, 165, 30) spriteManager:pMainMenu]; m_pPicPoint.m_pPointsBoard = [CHoudleForTouch HoudleForTouchWithRect:CGRectMake(0, 66, 165, 30) spriteManager:pMainMenu]; m_pPicPoint.m_pIntroductions = [CHoudleForTouch HoudleForTouchWithRect:CGRectMake(0, 99, 165, 30) spriteManager:pMainMenu]; m_pPicPoint.m_pReStart = [CHoudleForTouch HoudleForTouchWithRect:CGRectMake(0, 132, 165, 30) spriteManager:pMainMenu]; //将继续游戏加入到 2 层 标记 2 [pMainMenu addChild:m_pPicPoint.m_pContinuePlay z:2 tag:2]; //将继续游戏加入到 2 层 标记 3 [pMainMenu addChild:m_pPicPoint.m_pStartGame z:2 tag:3]; //将继续游戏加入到 2 层 标记 4 [pMainMenu addChild:m_pPicPoint.m_pPointsBoard z:2 tag:4]; //将继续游戏加入到 2 层 标记 5 [pMainMenu addChild:m_pPicPoint.m_pIntroductions z:2 tag:5]; //将继续游戏加入到 2 层 标记 6 [pMainMenu addChild:m_pPicPoint.m_pReStart z:2 tag:6]; /**节点的比例因子。 1.0是默认比例因子。它修改在同一时间X和Y的规模。 */ m_pPicPoint.m_pContinuePlay.scale = 1.1; /*定义锚层的边界矩形点,一个点在 *归层坐标 - '(0,0)'是左下角的 *的边界矩形,'(1,1)'是右上角。默认为 *'(0.5,0.5)',即矩形的边界的中心。动画。 */ m_pPicPoint.m_pContinuePlay.anchorPoint = ccp(0.5 ,0.5); m_pPicPoint.m_pContinuePlay.position = ccp(160, 250); m_pPicPoint.m_pStartGame.scale = 1.1; m_pPicPoint.m_pStartGame.anchorPoint = ccp(0.5 ,0.5); m_pPicPoint.m_pStartGame.position = ccp(160, 250); //隐藏菜单 if (m_bMainViewStratGame) { [m_pPicPoint.m_pContinuePlay setVisible:NO]; [m_pPicPoint.m_pStartGame setVisible:YES]; } else { [m_pPicPoint.m_pStartGame setVisible:NO]; [m_pPicPoint.m_pContinuePlay setVisible:YES]; } m_pPicPoint.m_pPointsBoard.scale = 1.1; m_pPicPoint.m_pPointsBoard.anchorPoint = ccp(0.5 ,0.5); m_pPicPoint.m_pPointsBoard.position = ccp(160, 210); [m_pPicPoint.m_pPointsBoard setVisible:YES]; m_pPicPoint.m_pIntroductions.scale = 1.1; m_pPicPoint.m_pIntroductions.anchorPoint = ccp(0.5 ,0.5); m_pPicPoint.m_pIntroductions.position = ccp(160, 170); [m_pPicPoint.m_pIntroductions setVisible:YES]; m_pPicPoint.m_pReStart.scale = 1.1; m_pPicPoint.m_pReStart.anchorPoint = ccp(0.5 ,0.5); m_pPicPoint.m_pReStart.position = ccp(160, 130); [m_pPicPoint.m_pReStart setVisible:YES];
终于在项目中搞定了这块。。开心。。。