**在原來程式中加這串****//亂碼問題處理
//利用ccdictionary來讀取xml
ccdictionary *strings = ccdictionary::createwithcontentsoffile("luanma.xml");
//讀取hello鍵中的值 objectforkey根據key,獲取對應的string
const char *xzl = ((ccstring*)strings->objectforkey("xzl"))->getcstring();
//讀取info鍵中的值
const char *myxz = ((ccstring*)strings->objectforkey("myxz"))->getcstring();
auto labelhello = labelttf::create(xzl, "arial", 24);
labelhello->setposition(ccp(visiblesize.width -
100, visiblesize.height -
50));
this->addchild(labelhello, 1);
if (iconone.iscontant(rect))
else
//xml檔案,utf-8儲存
xzl<
string
>相撞了!>
myxz
<
string
>沒有相撞!>
----------
cocos2d使用問題
最近在使用3.6版本的richtext遇到getcontentsize的時候會是 var richtext new ccui.richtext richtext.ignorecontentadaptwithsize false richtext.setcontentsize cc.size 500,...
cocos2d實現語音 Cocos2d 聲音API
param url 聲音路徑 cc.audioengine.playmusic url loop 停止背景 param releasedata 是否釋放聲音資料,預設為false cc.audioengine.stopmusic releasedata 暫停背景 cc.audioengine.pau...
cocos2d滑動碰撞檢測的實現
最近在做乙個類似切水果的小遊戲,需要檢測手在螢幕上是否劃到了園形的精靈。對於圓形的碰撞檢測還是很容易的 當觸點到圓心的距離小於等於圓的半徑時,結果為真。void mgame cctouchmoved cctouch ptouch,ccevent pevent 當觸點到圓心的距離小於等於圓的半徑時,結...