cocos2d 3.0 初学

1、路径问题(参考http://blog.csdn.net/ruanyubiao/article/details/25890997)

CCFileUtils::getInstance()->addSearchPath("F:/projects/luatest2");

CCFileUtils::getInstance()->addSearchResolutionsOrder("src");  

cocos2d搜索的时候,会把文件名分拆成两部分,具体看CCFileUtils.cpp的FileUtils::getPathForFilename

file_path = "Images/"

filename ="close.png" 

搜索路径组合方式: searchPath + file_path + resourceDirectory + filename 

2、设置竖屏(参考http://my.oschina.net/minglic/blog/151914)

demo里的都是横屏,所以在RootViewController.mm文件中修改如下代码,然后在工程文件里的General的deploymentinfo里的device orientation里勾上portrait即可。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

//    return UIInterfaceOrientationIsLandscape( interfaceOrientation );

    returnUIInterfaceOrientationIsPortrait( interfaceOrientation );

}

 

// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead

- (NSUInteger) supportedInterfaceOrientations{

#ifdef __IPHONE_6_0

//    return UIInterfaceOrientationMaskAllButUpsideDown;

    returnUIInterfaceOrientationMaskPortrait;

#endif

}

 

 

 

posted @ 2014-05-31 11:32  白菜小馒头  阅读(142)  评论(0编辑  收藏  举报