﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-多一分钟学习，早一秒钟提高-随笔分类-Cocos2d-x</title><link>http://www.cppblog.com/xkjy3000/category/20852.html</link><description>VC++、C++、Socket、DirectUI、wxWidgets、Cocos2d-x、Android、IOS</description><language>zh-cn</language><lastBuildDate>Fri, 25 Jul 2014 16:52:47 GMT</lastBuildDate><pubDate>Fri, 25 Jul 2014 16:52:47 GMT</pubDate><ttl>60</ttl><item><title>Cocos2d-x获取系统时间</title><link>http://www.cppblog.com/xkjy3000/archive/2014/07/21/207739.html</link><dc:creator>虚空骄阳</dc:creator><author>虚空骄阳</author><pubDate>Mon, 21 Jul 2014 15:04:00 GMT</pubDate><guid>http://www.cppblog.com/xkjy3000/archive/2014/07/21/207739.html</guid><wfw:comment>http://www.cppblog.com/xkjy3000/comments/207739.html</wfw:comment><comments>http://www.cppblog.com/xkjy3000/archive/2014/07/21/207739.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/xkjy3000/comments/commentRss/207739.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/xkjy3000/services/trackbacks/207739.html</trackback:ping><description><![CDATA[<div>//得到系统时间 &nbsp;</div><div>CCString* HelloWorld::getSystemTime() &nbsp;</div><div>{ &nbsp;</div><div>&nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; struct tm *tm; &nbsp;</div><div>#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) &nbsp;</div><div>&nbsp; &nbsp; //win32平台 &nbsp;</div><div>&nbsp; &nbsp; time_t timep; &nbsp;</div><div>&nbsp; &nbsp; time(&amp;timep); &nbsp;</div><div>&nbsp; &nbsp; tm = localtime(&amp;timep); &nbsp;</div><div>#else &nbsp;</div><div>&nbsp; &nbsp; //android、ios平台 &nbsp;</div><div>&nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; struct cc_timeval now; &nbsp;</div><div>&nbsp; &nbsp; CCTime::gettimeofdayCocos2d(&amp;now, NULL); &nbsp;</div><div>&nbsp; &nbsp; tm = localtime(&amp;now.tv_sec); &nbsp;</div><div>#endif &nbsp;</div><div>&nbsp; &nbsp; int year = tm-&gt;tm_year + 1900; &nbsp;</div><div>&nbsp; &nbsp; int month = tm-&gt;tm_mon + 1; &nbsp;</div><div>&nbsp; &nbsp; int day = tm-&gt;tm_mday; &nbsp;</div><div>&nbsp; &nbsp; int hour=tm-&gt;tm_hour; &nbsp;</div><div>&nbsp; &nbsp; int min=tm-&gt;tm_min; &nbsp;</div><div>&nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; CCString *string=CCString::createWithFormat("%d-%d-%d %d:%d",year,month,day,hour,min); &nbsp;</div><div>&nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; return string; &nbsp;</div><div>&nbsp;&nbsp;</div><div>}</div><img src ="http://www.cppblog.com/xkjy3000/aggbug/207739.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/xkjy3000/" target="_blank">虚空骄阳</a> 2014-07-21 23:04 <a href="http://www.cppblog.com/xkjy3000/archive/2014/07/21/207739.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>SimpleAudioEngine 判断音效是否播放完</title><link>http://www.cppblog.com/xkjy3000/archive/2014/05/18/207004.html</link><dc:creator>虚空骄阳</dc:creator><author>虚空骄阳</author><pubDate>Sun, 18 May 2014 07:21:00 GMT</pubDate><guid>http://www.cppblog.com/xkjy3000/archive/2014/05/18/207004.html</guid><wfw:comment>http://www.cppblog.com/xkjy3000/comments/207004.html</wfw:comment><comments>http://www.cppblog.com/xkjy3000/archive/2014/05/18/207004.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/xkjy3000/comments/commentRss/207004.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/xkjy3000/services/trackbacks/207004.html</trackback:ping><description><![CDATA[<div><span style="color: #0000ff;">SimpleAudioEngine.h&nbsp;</span>文件中添加以下函数定义：</div><div><span style="color: #008000;">//判断当前音效是否已经播放完</span></div><div>bool getEffectIsPlayingFinished(unsigned int nSoundId);<br /><br /><div><span style="color: #0000ff;">SimpleAudioEngine.cpp&nbsp;</span>函数实现，比较简单：</div><div><span style="color: #008000;">//判断当前音效是否已经播放完</span></div><div>bool SimpleAudioEngine::getEffectIsPlayingFinished(unsigned int nSoundId)</div><div>{</div><div>&nbsp; &nbsp; &nbsp; &nbsp;EffectList::iterator itor = sharedList().find(nSoundId);</div><div>&nbsp; &nbsp; &nbsp; &nbsp;bool bRet = false;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;if (&nbsp;itor&nbsp;!= sharedList().end() )</div><div>&nbsp; &nbsp; &nbsp; &nbsp;{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bRet =&nbsp;itor-&gt;second-&gt;IsPlaying();</div><div>&nbsp; &nbsp; &nbsp; &nbsp;}</div><div>&nbsp; &nbsp; &nbsp; &nbsp;return bRet;</div><div>}<br /><br /><div><span style="color: red;">注：修改后将libCocosDenshion类库重新编译一下。只要通过我们的soundid参数，便可找到MciPlayer，然后就可以处理了。</span></div></div></div><img src ="http://www.cppblog.com/xkjy3000/aggbug/207004.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/xkjy3000/" target="_blank">虚空骄阳</a> 2014-05-18 15:21 <a href="http://www.cppblog.com/xkjy3000/archive/2014/05/18/207004.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Cocos2d-x 中文显示</title><link>http://www.cppblog.com/xkjy3000/archive/2014/04/13/206552.html</link><dc:creator>虚空骄阳</dc:creator><author>虚空骄阳</author><pubDate>Sun, 13 Apr 2014 05:52:00 GMT</pubDate><guid>http://www.cppblog.com/xkjy3000/archive/2014/04/13/206552.html</guid><wfw:comment>http://www.cppblog.com/xkjy3000/comments/206552.html</wfw:comment><comments>http://www.cppblog.com/xkjy3000/archive/2014/04/13/206552.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/xkjy3000/comments/commentRss/206552.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/xkjy3000/services/trackbacks/206552.html</trackback:ping><description><![CDATA[<font color="#ff0000"><span style="color: red; background-color: #ffffff;">一、使用第三方库iconv</span><span style="color: #0000ff; background-color: #ffffff;"><br /></span></font><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">bool</span>&nbsp;IConvConvert(<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>&nbsp;*from_charset,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>&nbsp;*to_charset,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>&nbsp;*inbuf,&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;inlen,&nbsp;<span style="color: #0000FF; ">char</span>&nbsp;*outbuf,&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;outlen)&nbsp;<br /><br />{<br /><br />iconv_t&nbsp;cd&nbsp;=&nbsp;iconv_open(to_charset,&nbsp;from_charset);<br /><br /><span style="color: #0000FF; ">if</span>&nbsp;(cd&nbsp;==&nbsp;0)&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;<span style="color: #0000FF; ">false</span>;<br /><br /><span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>&nbsp;**pin&nbsp;=&nbsp;&amp;inbuf;<br /><br /><span style="color: #0000FF; ">char</span>&nbsp;**pout&nbsp;=&nbsp;&amp;outbuf;<br /><br />memset(outbuf,0,outlen);<br /><br />size_t&nbsp;ret&nbsp;=&nbsp;iconv(cd,pin,(size_t&nbsp;*)&amp;inlen,pout,(size_t&nbsp;*)&amp;outlen);<br /><br />iconv_close(cd);<br /><br /><span style="color: #0000FF; ">return</span>&nbsp;ret&nbsp;==&nbsp;(size_t)(-1)&nbsp;?&nbsp;<span style="color: #0000FF; ">false</span>&nbsp;:&nbsp;<span style="color: #0000FF; ">true</span>;<br /><br />}<br /><br />std::<span style="color: #0000FF; ">string</span>&nbsp;IConvConvert_GBKToUTF8(<span style="color: #0000FF; ">const</span>&nbsp;std::<span style="color: #0000FF; ">string</span>&amp;&nbsp;str)<br /><br />{<br /><br /><span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;textIn&nbsp;=&nbsp;str.c_str();<br /><br /><span style="color: #0000FF; ">char</span>&nbsp;textOut[256];<br /><br /><span style="color: #0000FF; ">bool</span>&nbsp;ret&nbsp;=&nbsp;IConvConvert("gb2312",&nbsp;"utf-8",&nbsp;textIn,&nbsp;strlen(textIn),textOut,&nbsp;256);<br /><br /><span style="color: #0000FF; ">return</span>&nbsp;ret&nbsp;?&nbsp;<span style="color: #0000FF; ">string</span>(textOut)&nbsp;:&nbsp;<span style="color: #0000FF; ">string</span>();<br /><br />}</div><font color="#ff0000"><span style="color: #0000ff; background-color: #ffffff;">使用方法：<br /></span></font><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->std::<span style="color: #0000FF; ">string</span>&nbsp;text&nbsp;=&nbsp;IConvConvert_GBKToUTF8("我是中文字符串");<br /><br />CCLabelTTF*&nbsp;pLabel&nbsp;=&nbsp;CCLabelTTF::labelWithString(text.c_str(),&nbsp;"Arial",&nbsp;24);</div><font color="#ff0000"><span style="color: #0000ff; background-color: #ffffff;"><br /></span><span style="color: red; background-color: #ffffff;">二、使用XML文件</span><span style="color: #0000ff; background-color: #ffffff;"><br /></span></font><div><span style="color: #008000;">（通过读取xml文件显示中文，这种方法更利于软件的国际化）</span></div><div>1、先写好一个xml文件（CHN_Strings.xml）。注意记得要以UTF-8编码保存。格式很简单，一个key对应一个string的键值对。如下：</div><div><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">dict</span><span style="color: #0000FF; ">&gt;</span>&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">key</span><span style="color: #0000FF; ">&gt;</span>language<span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">key</span><span style="color: #0000FF; ">&gt;</span>&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">string</span><span style="color: #0000FF; ">&gt;</span>English<span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">string</span><span style="color: #0000FF; ">&gt;</span>&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">key</span><span style="color: #0000FF; ">&gt;</span>username<span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">key</span><span style="color: #0000FF; ">&gt;</span>&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">string</span><span style="color: #0000FF; ">&gt;</span>虚空骄阳<span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">string</span><span style="color: #0000FF; ">&gt;</span>&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">key</span><span style="color: #0000FF; ">&gt;</span>website<span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">key</span><span style="color: #0000FF; ">&gt;</span>&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">&lt;</span><span style="color: #800000; ">string</span><span style="color: #0000FF; ">&gt;</span>http://www.cppblog.com/xkjy3000/<span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">string</span><span style="color: #0000FF; ">&gt;</span>&nbsp;&nbsp;<br /><span style="color: #0000FF; ">&lt;/</span><span style="color: #800000; ">dict</span><span style="color: #0000FF; ">&gt;</span></div></div><div>2、通过CCDictionary读取xml<br /><div><span style="color: #008000;">（CCDictionary其实是利用哈希表算法来进行CCObject管理的一个类）</span></div>A、创建词典类实例<div><div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->CCDictionary&nbsp;*pchStrings&nbsp;=&nbsp;CCDictionary::createWithContentsOfFile("CHN_Strings.xml");</div></div>B、通过键（key）获取值（value）<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>&nbsp;*pUsername&nbsp;=&nbsp;((CCString*)pchStrings-&gt;objectForKey("username"))-&gt;m_sString.c_str();</div>C、使用value<br /><div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all;"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->CCLabelTTF*&nbsp;pLabel&nbsp;=&nbsp;CCLabelTTF::create(pUsername,&nbsp;"Arial",&nbsp;24); &nbsp; &nbsp; &nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">这里创建一个文本&nbsp;&nbsp;</span><span style="color: #008000; "><br /></span>pLabel-&gt;setPosition(ccp(origin.x&nbsp;+&nbsp;visibleSize.width/2,origin.y&nbsp;+&nbsp;visibleSize.height&nbsp;-&nbsp;pLabel-&gt;getContentSize().height));&nbsp;&nbsp;<br /><span style="color: #0000FF; ">this</span>-&gt;addChild(pLabel,&nbsp;1);</div><br /><span style="color: #0000ff;"><strong>以下自定义读取指定xml中指定key中文字符串的函数<br /></strong></span>函数声明<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">static</span>&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;getCHString(<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">string</span>&nbsp;filename,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">string</span>&nbsp;key);</div>函数实现<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;XXX::getCHString(<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">string</span>&nbsp;filename,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">string</span>&nbsp;key)<br />{&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">利用CCDictionary来读取xml</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;CCDictionary&nbsp;*pStrings&nbsp;=&nbsp;CCDictionary::createWithContentsOfFile(filename.c_str());<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">读取key键中的值&nbsp;objectForKey根据key，获取对应的string</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>&nbsp;*pStr&nbsp;=&nbsp;((CCString*)pStrings-&gt;objectForKey(key))-&gt;m_sString.c_str();<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;pStr;<br />}</div><br />使用方法：<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;pText&nbsp;=&nbsp;XXX::getCHString("CHN_Strings.xml",&nbsp;"username");</div></div><img src ="http://www.cppblog.com/xkjy3000/aggbug/206552.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/xkjy3000/" target="_blank">虚空骄阳</a> 2014-04-13 13:52 <a href="http://www.cppblog.com/xkjy3000/archive/2014/04/13/206552.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Cocos2d-x 编译release以及NDK相关选项</title><link>http://www.cppblog.com/xkjy3000/archive/2014/04/13/206551.html</link><dc:creator>虚空骄阳</dc:creator><author>虚空骄阳</author><pubDate>Sun, 13 Apr 2014 04:30:00 GMT</pubDate><guid>http://www.cppblog.com/xkjy3000/archive/2014/04/13/206551.html</guid><wfw:comment>http://www.cppblog.com/xkjy3000/comments/206551.html</wfw:comment><comments>http://www.cppblog.com/xkjy3000/archive/2014/04/13/206551.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/xkjy3000/comments/commentRss/206551.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/xkjy3000/services/trackbacks/206551.html</trackback:ping><description><![CDATA[<span style="font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; line-height: 28px; background-color: #ffffff;">Win下cygwin编译时：</span><br style="line-height: 28px; font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: #ffffff;" /><span style="font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; line-height: 28px; background-color: #ffffff; color: #0000ff;">方法1：</span><br style="line-height: 28px; font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: #ffffff;" /><span style="font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; line-height: 28px; background-color: #ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 命令：</span><br style="line-height: 28px; font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: #ffffff;" /><span style="font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; line-height: 28px; background-color: #ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; build_native.sh NDK_DEBUG=1 V=0</span><br style="line-height: 28px; font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: #ffffff;" /><span style="font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; line-height: 28px; background-color: #ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 其中，NDK_DEBUG为0则表示为release版，为1表示为debug版。V为0则显示简要编译信息，为1显示详细编译信息(会显示具体编译指令)。</span><br style="line-height: 28px; font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: #ffffff;" /><br style="line-height: 28px; font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: #ffffff;" /><span style="font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; line-height: 28px; background-color: #ffffff; color: #0000ff;">方法2：</span><br style="line-height: 28px; font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: #ffffff;" /><span style="font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; line-height: 28px; background-color: #ffffff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AndroidManifest.xml文件的&lt;application&gt;元素的android:debuggable="true"属性，若为true，则是debug版本，若为false，则为release版</span><br style="line-height: 28px; font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: #ffffff;" /><br style="line-height: 28px; font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: #ffffff;" /><span style="font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; line-height: 28px; background-color: #ffffff; color: #008000;">注：NDK会优先检测命令的参数，若无参数，则检测AndroidManifest.xml文件的配置。</span><br style="line-height: 28px; font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: #ffffff;" /><br style="line-height: 28px; font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: #ffffff;" /><span style="font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; line-height: 28px; background-color: #ffffff; color: #0000ff;">cocos2d-x编译选项：</span><br style="line-height: 28px; font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; background-color: #ffffff;" /><span style="font-family: 'Hiragino Sans GB W3', 'Hiragino Sans GB', Arial, Helvetica, simsun, u5b8bu4f53; font-size: 16px; line-height: 28px; background-color: #ffffff;">Android.mk 中增加-DCOCOS2D_DEBUG=0开关，其默认为1</span><img src ="http://www.cppblog.com/xkjy3000/aggbug/206551.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/xkjy3000/" target="_blank">虚空骄阳</a> 2014-04-13 12:30 <a href="http://www.cppblog.com/xkjy3000/archive/2014/04/13/206551.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Cocos2d-x 避免手动在Android.mk文件中手动添加cpp文件</title><link>http://www.cppblog.com/xkjy3000/archive/2014/04/13/206550.html</link><dc:creator>虚空骄阳</dc:creator><author>虚空骄阳</author><pubDate>Sun, 13 Apr 2014 04:25:00 GMT</pubDate><guid>http://www.cppblog.com/xkjy3000/archive/2014/04/13/206550.html</guid><wfw:comment>http://www.cppblog.com/xkjy3000/comments/206550.html</wfw:comment><comments>http://www.cppblog.com/xkjy3000/archive/2014/04/13/206550.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/xkjy3000/comments/commentRss/206550.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/xkjy3000/services/trackbacks/206550.html</trackback:ping><description><![CDATA[<span style="font-family: Arial; line-height: 26px; background-color: #ffffff;">将Android.mk的内容替换成以下内容即可：<br /></span><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->LOCAL_PATH&nbsp;:=&nbsp;$(call&nbsp;my-dir)&nbsp;<br />&nbsp;<br />include&nbsp;$(CLEAR_VARS)&nbsp;<br />&nbsp;<br />LOCAL_MODULE&nbsp;:=&nbsp;hellocpp_shared&nbsp;<br />&nbsp;<br />LOCAL_MODULE_FILENAME&nbsp;:=&nbsp;libhellocpp&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />FILE_LIST&nbsp;:=&nbsp;hellocpp/main.cpp&nbsp;<br />FILE_LIST&nbsp;+=&nbsp;$(wildcard&nbsp;$(LOCAL_PATH)/../../Classes/*.cpp)&nbsp;<br />LOCAL_SRC_FILES&nbsp;:=&nbsp;$(FILE_LIST:$(LOCAL_PATH)/%=%)&nbsp;<br />&nbsp;<br />LOCAL_C_INCLUDES&nbsp;:=&nbsp;$(LOCAL_PATH)/../../Classes&nbsp;<br /><br />LOCAL_WHOLE_STATIC_LIBRARIES&nbsp;+=&nbsp;cocos2dx_static<br />LOCAL_WHOLE_STATIC_LIBRARIES&nbsp;+=&nbsp;cocosdenshion_static<br />LOCAL_WHOLE_STATIC_LIBRARIES&nbsp;+=&nbsp;box2d_static<br />LOCAL_WHOLE_STATIC_LIBRARIES&nbsp;+=&nbsp;chipmunk_static<br />LOCAL_WHOLE_STATIC_LIBRARIES&nbsp;+=&nbsp;cocos_extension_static<br /><br />include&nbsp;$(BUILD_SHARED_LIBRARY)<br /><br />$(call&nbsp;import-module,cocos2dx)<br />$(call&nbsp;import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)<br />$(call&nbsp;import-module,CocosDenshion/android)<br />$(call&nbsp;import-module,extensions)<br />$(call&nbsp;import-module,external/Box2D)<br />$(call&nbsp;import-module,external/chipmunk)</div><img src ="http://www.cppblog.com/xkjy3000/aggbug/206550.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/xkjy3000/" target="_blank">虚空骄阳</a> 2014-04-13 12:25 <a href="http://www.cppblog.com/xkjy3000/archive/2014/04/13/206550.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>