1. 程式人生 > >如何升級Cocos2d—X的版本(三)

如何升級Cocos2d—X的版本(三)

今天看到cocos2d-x的官網更新了版本,看了下不錯,想要馬上更新,結果巨坑來了。

查看了N多大牛的文章,我的問題還是沒有解決。

方法1:

首先開啟你mac終端,然後輸入如下命令:

顯示Mac隱藏檔案的命令:defaults write com.apple.finder AppleShowAllFiles -bool true

隱藏Mac隱藏檔案的命令:defaults write com.apple.finder AppleShowAllFiles -bool false

或者

顯示Mac隱藏檔案的命令:defaults write com.apple.finder AppleShowAllFiles YES

隱藏Mac隱藏檔案的命令:defaults write com.apple.finder AppleShowAllFiles NO

輸入後回車即可,然後我們關閉終端。然後點選你mac桌面選單的“小蘋果”圖示,選擇“強制退出”選單,然後選擇“Finder”,然後點選“重新啟動”,OK。所有隱藏檔案可以看到了。那麼這裡我把刪除我電腦Xcode中的Cocos2d/Cocos2dX模版的路徑放出:

/Users/Himi/Library/Developer/Xcode/Templates




模板到底在哪裡啊?

2013年06月19日

好吧,這是我學藝不精,沒有找到資料夾,研究ccuserdefault的xml檔案的時候,卻找到了這個檔案模板。finder裡面找前往選單,選擇我的電腦,即可找到那個模板檔案。


方法2:

好了,這個是我看的最多的方法,但是折騰來折騰去,問題還在啊?有沒有簡單方法?

還是自己研究吧,照著老方法開始安裝新下載的版本:


直接在命令列格式下開啟檔案路徑,cd  檔案路徑,

然後就在命令列輸入sudo /Users/liyongjian/Documents/cocos2d-x-2.1.4/install-templates-xcode.sh 

返回錯誤資訊,是說這個檔案已經存在,請嘗試使用強制的重新安裝引數“-f”,然後我直接再次輸入安裝命令,並增加引數 -f

cocos2d-x template installer



Installing Xcode 4 cocos2d-x iOS template
----------------------------------------------------

templates already installed. To force a re-install use the '-f' parameter
limatoMacBook:cocos2d-x-2.1.4 liyongjian$ sudo /Users/liyongjian/Documents/cocos2d-x-2.1.4/install-templates-xcode.sh  -f

然後就成功了,結果如下:
cocos2d-x template installer



Installing Xcode 4 cocos2d-x iOS template
----------------------------------------------------

removing old libraries: /Users/liyongjian/Library/Developer/Xcode/Templates/cocos2d-x/
...creating destination directory: /Users/liyongjian/Library/Developer/Xcode/Templates/cocos2d-x/
...copying cocos2d files
...copying CocosDenshion files
...copying websockets files
...copying extension files
...copying template files
done!



Installing Xcode 4 Chipmunk iOS template
----------------------------------------------------

...copying Chipmunk files
done!



Installing Xcode 4 Box2d iOS template
----------------------------------------------------

...copying Box2D files
done!



Installing Xcode 4 lua iOS template
----------------------------------------------------

...copying lua files
done!



Installing Xcode 4 JS iOS template
----------------------------------------------------

...copying js files
done!
...copying spidermonkey files
done!
done!

好的,在看下xocde下的控制檯輸出的cocos2d-x的版本資訊:
2013-06-18 16:49:49.136 template[2533:12203] cocos2d: surface size: 480x320
Cocos2d: 
<dict>
	cocos2d.x.version: 2.1rc0-x-2.1.4
	cocos2d.x.compiled_with_profiler: false
	cocos2d.x.compiled_with_gl_state_cache: true
	gl.vendor: Apple Computer, Inc.
	gl.renderer: Apple Software Renderer
	gl.version: OpenGL ES 2.0 APPLE
	gl.max_texture_size: 4096
	gl.max_texture_units: 8
	gl.max_samples_allowed: 4
	gl.supports_PVRTC: true
	gl.supports_NPOT: true
	gl.supports_BGRA8888: false
	gl.supports_discard_framebuffer: true
	gl.supports_vertex_array_object: true
</dict>

我去,終於搞定了。