💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
1.关于COCOS2d的单例和导演类 ~~~ //1.COCOS2d的常用单例 CCDirector *sharedDirector = [CCDirector sharedDirector]; CCSpriteFrameCache *SpritesharedCache = [CCSpriteFrameCache sharedSpriteFrameCache]; CCTextureCache *TextureCache = [CCTextureCache sharedTextureCache]; // CDAudioManager *sharedManager = [CDAudioManager sharedManager]; // SimpleAudioEngine *sharedEngine = [SimpleAudioEngine sharedEngine]; //2.CCDirector 导演类 //作用:访问和改变场景,访问2d的配置细节,访问视图,暂停,恢复,结束游戏,在UIKit和OPenGLEs之间转化坐标 //1.主程序启动并显示第一个场景 [[CCDirector sharedDirector]runWithScene:[HelloWorldLayer scene]]; //2 讲传入场景作为当前的场景 [[CCDirector sharedDirector]pushScene:[HelloWorldLayer scene]]; //3 运行待运行场景中的倒数第二个场景,当前场景被释放 [[CCDirector sharedDirector]popScene]; //4 直接使用新的场景更换当前的场景,当前场景被释放 [[CCDirector sharedDirector]replaceScene:[HelloWorldLayer scene]]; //5结束当前运行中的场景 [[CCDirector sharedDirector] end]; //6 暂停当前的场景 [[CCDirector sharedDirector]pause]; //7 恢复场景的运行 [[CCDirector sharedDirector]resume]; //8绘制场景 // -(void)draw; //9讲UIKit坐标系中的坐标转换为OPENGL ES 坐标系中的坐标 UITouch *myTouch = [touches angObject]; CGPoint location = [myTouch locationInView:[myTouch view]]; location = [[CCDirector sharedDirector]convertToGL:location]; ~~~