﻿<?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</title><link>http://www.cppblog.com/wc250en007/category/19588.html</link><description>前进的路上</description><language>zh-cn</language><lastBuildDate>Wed, 24 Oct 2012 03:55:01 GMT</lastBuildDate><pubDate>Wed, 24 Oct 2012 03:55:01 GMT</pubDate><ttl>60</ttl><item><title>在linux系统下用eclipse集成环境开发cocos2d-x android项目，集成java和c++环境(转)</title><link>http://www.cppblog.com/wc250en007/archive/2012/10/24/193757.html</link><dc:creator>Let me see see</dc:creator><author>Let me see see</author><pubDate>Wed, 24 Oct 2012 01:29:00 GMT</pubDate><guid>http://www.cppblog.com/wc250en007/archive/2012/10/24/193757.html</guid><wfw:comment>http://www.cppblog.com/wc250en007/comments/193757.html</wfw:comment><comments>http://www.cppblog.com/wc250en007/archive/2012/10/24/193757.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wc250en007/comments/commentRss/193757.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wc250en007/services/trackbacks/193757.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 原文地址：子龙山人教程&nbsp;http://www.cnblogs.com/zilongshanren/archive/2012/04/28/2473282.html原文链接地址：http://www.raywenderlich.com/11283/cocos2d-x-for-ios-and-android-getting-started教程截图：&nbsp; &nbsp; Cocos2D是一...&nbsp;&nbsp;<a href='http://www.cppblog.com/wc250en007/archive/2012/10/24/193757.html'>阅读全文</a><img src ="http://www.cppblog.com/wc250en007/aggbug/193757.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wc250en007/" target="_blank">Let me see see</a> 2012-10-24 09:29 <a href="http://www.cppblog.com/wc250en007/archive/2012/10/24/193757.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cocos2d-x android游戏使用自己的字体</title><link>http://www.cppblog.com/wc250en007/archive/2012/10/15/193320.html</link><dc:creator>Let me see see</dc:creator><author>Let me see see</author><pubDate>Mon, 15 Oct 2012 08:58:00 GMT</pubDate><guid>http://www.cppblog.com/wc250en007/archive/2012/10/15/193320.html</guid><wfw:comment>http://www.cppblog.com/wc250en007/comments/193320.html</wfw:comment><comments>http://www.cppblog.com/wc250en007/archive/2012/10/15/193320.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/wc250en007/comments/commentRss/193320.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wc250en007/services/trackbacks/193320.html</trackback:ping><description><![CDATA[在使用cocos2d-x发布Android平台游戏时，游戏中可能需要显示中文字体， 或者想显示漂亮的自定义字体,这怎么办呢？<br />cocos2d-x中字体标签提供了CCLabelAtlas, CCLabelBMFont CCLabelTTF<br /><br />1.CCLabelAtlas速度快，支持简单有限的几个字符或数字集合<br /><br />2.CCLabelBMFont&nbsp;<br />我们可以用CCLabelBMFont来加载字体编辑器生成的.plist文件，但是当显示的文字很多时，这种做法就有点费时费力了<br />如：我们想显示游戏中剧情介绍<br /><br />3.CCLabelTTF<br />支持选择一种字体来显示文字，但是只支持系统中默认字体<br /><div style="padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; width: 1307.3519287109375px; word-break: break-all; ">CCLabelTTF*&nbsp;pLabel&nbsp;=&nbsp;CCLabelTTF::create("Hello&nbsp;World",&nbsp;"Arial",&nbsp;24);</div><div></div><br /><strong>问题：我们在Android游戏中想显示游戏剧情，想用自己指定的一种字体gril.ttf(非系统默认字体),怎么办</strong><br /><br />其实cocos2d-x已经提供了帮我们实现了<br />构造CCLabelTTF中指定的字体名传给了<span style="font-size: 13.333333969116211px; background-color: #eeeeee; ">CCTexture2D&nbsp;</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; ">void</span>&nbsp;CCLabelTTF::updateTexture()<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;CCTexture2D&nbsp;*tex;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(m_tDimensions.width&nbsp;==&nbsp;0&nbsp;||&nbsp;m_tDimensions.height&nbsp;==&nbsp;0)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tex&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;CCTexture2D();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tex-&gt;initWithString(m_string.c_str(),&nbsp;<strong>m_pFontName</strong>-&gt;c_str(),&nbsp;m_fFontSize&nbsp;*&nbsp;CC_CONTENT_SCALE_FACTOR())&nbsp;;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">else</span><br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tex&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;CCTexture2D();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tex-&gt;initWithString(m_string.c_str(),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CC_SIZE_POINTS_TO_PIXELS(m_tDimensions),&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_hAlignment,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_vAlignment,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_pFontName-&gt;c_str(),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_fFontSize&nbsp;*&nbsp;CC_CONTENT_SCALE_FACTOR());<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;<img src="http://www.cppblog.com/Images/dot.gif" alt="" />.<br />}</div>CCTexture2D又将字体名传给了CCImage<br />(PS:这里调用的是android平台下的CCImage类(./platform/android/CCImage.h)<br />而不是win32平台下的CCImage类(./platform/win32/CCImage.h) )<br /><br />android平台下的CCImage<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 />--><span style="color: #0000FF; ">bool</span>&nbsp;CCImage::initWithString(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;pText,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nWidth<span style="color: #008000; ">/*</span><span style="color: #008000; ">&nbsp;=&nbsp;0</span><span style="color: #008000; ">*/</span>,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nHeight<span style="color: #008000; ">/*</span><span style="color: #008000; ">&nbsp;=&nbsp;0</span><span style="color: #008000; ">*/</span>,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ETextAlign&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eAlignMask<span style="color: #008000; ">/*</span><span style="color: #008000; ">&nbsp;=&nbsp;kAlignCenter</span><span style="color: #008000; ">*/</span>,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;pFontName<span style="color: #008000; ">/*</span><span style="color: #008000; ">&nbsp;=&nbsp;nil</span><span style="color: #008000; ">*/</span>,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nSize<span style="color: #008000; ">/*</span><span style="color: #008000; ">&nbsp;=&nbsp;0</span><span style="color: #008000; ">*/</span>)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">bool</span>&nbsp;bRet&nbsp;=&nbsp;<span style="color: #0000FF; ">false</span>;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">do</span>&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CC_BREAK_IF(!&nbsp;pText);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>BitmapDC&nbsp;</strong>&amp;dc&nbsp;=&nbsp;sharedBitmapDC();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CC_BREAK_IF(!&nbsp;dc.getBitmapFromJava(pText,&nbsp;nWidth,&nbsp;nHeight,&nbsp;eAlignMask,&nbsp;<strong>pFontName</strong>,&nbsp;nSize));<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;assign&nbsp;the&nbsp;dc.m_pData&nbsp;to&nbsp;m_pData&nbsp;in&nbsp;order&nbsp;to&nbsp;save&nbsp;time</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_pData&nbsp;=&nbsp;dc.m_pData;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CC_BREAK_IF(!&nbsp;m_pData);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_nWidth&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;(<span style="color: #0000FF; ">short</span>)dc.m_nWidth;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_nHeight&nbsp;&nbsp;&nbsp;=&nbsp;(<span style="color: #0000FF; ">short</span>)dc.m_nHeight;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_bHasAlpha&nbsp;=&nbsp;<span style="color: #0000FF; ">true</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_bPreMulti&nbsp;=&nbsp;<span style="color: #0000FF; ">true</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;m_nBitsPerComponent&nbsp;=&nbsp;8;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bRet&nbsp;=&nbsp;<span style="color: #0000FF; ">true</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">while</span>&nbsp;(0);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;bRet;<br />}</div><br />然后调用了android平台下的BitmapDC<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 />-->&nbsp; &nbsp;&nbsp;<span style="color: #0000FF; ">bool</span>&nbsp;getBitmapFromJava(<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>&nbsp;*text,&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;nWidth,&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;nHeight,&nbsp;CCImage::ETextAlign&nbsp;eAlignMask,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>&nbsp;*&nbsp;pFontName,&nbsp;<span style="color: #0000FF; ">float</span>&nbsp;fontSize)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JniMethodInfo&nbsp;methodInfo;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(!&nbsp;JniHelper::getStaticMethodInfo(methodInfo,&nbsp;"<strong>org/cocos2dx/lib/Cocos2dxBitmap</strong>",&nbsp;"<strong>createTextBitmap</strong>",&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"(Ljava/lang/String;Ljava/lang/String;IIII)V"))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CCLOG("%s&nbsp;%d:&nbsp;error&nbsp;to&nbsp;get&nbsp;methodInfo",&nbsp;__FILE__,&nbsp;__LINE__);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;<span style="color: #0000FF; ">false</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<img src="http://www.cppblog.com/Images/dot.gif" alt="" /><img src="http://www.cppblog.com/Images/dot.gif" alt="" /><br />}</div><br />这里显示了调用JAVA代码<strong style="font-size: 13.333333969116211px; ">Cocos2dxBitmap.java</strong>下的<strong style="font-size: 13.333333969116211px; ">createTextBitmap</strong>函数<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 />-->&nbsp; &nbsp;&nbsp;<span style="color: #008000; ">/*</span><span style="color: #008000; "><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@width:&nbsp;the&nbsp;width&nbsp;to&nbsp;draw,&nbsp;it&nbsp;can&nbsp;be&nbsp;0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@height:&nbsp;the&nbsp;height&nbsp;to&nbsp;draw,&nbsp;it&nbsp;can&nbsp;be&nbsp;0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; ">*/</span><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;<span style="color: #0000FF; ">static</span>&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;createTextBitmap(String&nbsp;content,&nbsp;String&nbsp;fontName,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;fontSize,&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;alignment,&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;width,&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;height){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;content&nbsp;=&nbsp;refactorString(content);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Paint&nbsp;paint&nbsp;=&nbsp;<strong>newPaint</strong>(<strong>fontName</strong>,&nbsp;fontSize,&nbsp;alignment);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TextProperty&nbsp;textProperty&nbsp;=&nbsp;computeTextProperty(content,&nbsp;paint,&nbsp;width,&nbsp;height);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;bitmapTotalHeight&nbsp;=&nbsp;(height&nbsp;==&nbsp;0&nbsp;?&nbsp;textProperty.totalHeight:height);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;Draw&nbsp;text&nbsp;to&nbsp;bitmap</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Bitmap&nbsp;bitmap&nbsp;=&nbsp;Bitmap.createBitmap(textProperty.maxWidth,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bitmapTotalHeight,&nbsp;Bitmap.Config.ARGB_8888);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Canvas&nbsp;canvas&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;Canvas(bitmap);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;Draw&nbsp;string</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FontMetricsInt&nbsp;fm&nbsp;=&nbsp;paint.getFontMetricsInt();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;x&nbsp;=&nbsp;0;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;y&nbsp;=&nbsp;computeY(fm,&nbsp;height,&nbsp;textProperty.totalHeight,&nbsp;alignment);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String[]&nbsp;lines&nbsp;=&nbsp;textProperty.lines;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">for</span>&nbsp;(String&nbsp;line&nbsp;:&nbsp;lines){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x&nbsp;=&nbsp;computeX(paint,&nbsp;line,&nbsp;textProperty.maxWidth,&nbsp;alignment);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;canvas.drawText(line,&nbsp;x,&nbsp;y,&nbsp;paint);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y&nbsp;+=&nbsp;textProperty.heightPerLine;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;initNativeObject(bitmap);<br />&nbsp;&nbsp;&nbsp;&nbsp;}</div><br />在<strong style="font-size: 13.333333969116211px; ">newPaint</strong>函数中调用了字体加载<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; ">private</span>&nbsp;<span style="color: #0000FF; ">static</span>&nbsp;Paint&nbsp;newPaint(String&nbsp;fontName,&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;fontSize,&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;alignment){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Paint&nbsp;paint&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;Paint();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;paint.setColor(Color.WHITE);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;paint.setTextSize(fontSize);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;paint.setAntiAlias(<span style="color: #0000FF; ">true</span>);&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">/*</span><span style="color: #008000; "><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Set&nbsp;type&nbsp;face&nbsp;for&nbsp;paint,&nbsp;now&nbsp;it&nbsp;support&nbsp;.ttf&nbsp;file.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; ">*/</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(fontName.endsWith(<span style="color: red; ">".ttf"</span>)){ &nbsp; &nbsp; <span style="color: red; ">&nbsp;//</span><span style="font-size: 14.44444465637207px; color: red; ">字体需要.ttf结束</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000FF; ">try</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">Typeface&nbsp;typeFace&nbsp;=&nbsp;Typeface.createFromAsset(context.getAssets(),&nbsp;fontName);</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>Typeface&nbsp;typeFace&nbsp;=&nbsp;Cocos2dxTypefaces.<span style="color: #0000FF; ">get</span>(context,&nbsp;fontName);</strong><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>paint.setTypeface(typeFace);</strong><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;<span style="color: #0000FF; ">catch</span>&nbsp;(Exception&nbsp;e){<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Log.e("Cocos2dxBitmap",&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"error&nbsp;to&nbsp;create&nbsp;ttf&nbsp;type&nbsp;face:&nbsp;"&nbsp;+&nbsp;fontName);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">/*</span><span style="color: #008000; "><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;The&nbsp;file&nbsp;may&nbsp;not&nbsp;find,&nbsp;use&nbsp;system&nbsp;font<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; ">*/</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;paint.setTypeface(Typeface.create(fontName,&nbsp;Typeface.NORMAL));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">else</span>&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;paint.setTypeface(Typeface.create(fontName,&nbsp;Typeface.NORMAL));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; .......<br />&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;paint;<br />&nbsp;&nbsp;&nbsp;&nbsp;}</div><div>（PS:Typeface类定义字体和字体内在的类型。这个类被用在画笔Paint设置的时候，比如用textSize,textSkewX和textScale设置来指定text在画的时候如何来显示和测量。</div>android中用Typeface来指定字体）<br /><br />另一点需要注意的是：字体需要.ttf结束<br /><br /><strong>使用方法</strong>：<br />1.在proj.android\assets文件夹中添加<span style="color: red; ">girl.ttf</span><br />2.程序中调用对应的字体就可以了<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 />-->&nbsp; &nbsp; CCSize&nbsp;size&nbsp;=&nbsp;CCDirector::sharedDirector()-&gt;getWinSize();<br />&nbsp;&nbsp;&nbsp;&nbsp;CCLabelTTF*&nbsp;label&nbsp;=&nbsp;CCLabelTTF::create("少女HelloWorld",&nbsp;"<span style="color: red; ">girl.ttf</span>",&nbsp;24);<br />&nbsp;&nbsp;&nbsp;&nbsp;label-&gt;setPosition(ccp(size.width/2,&nbsp;size.height/2));<br />&nbsp;&nbsp;&nbsp;&nbsp;addChild(label);</div>3.如果你需要显示汉字，则需要将包含有字符串的文件(如.cpp)转换为UTF-8格式编码，否则会显示乱码<br /><br />IOS和win32平台没有测试，相信的差不多<br /><br />附上测试图片：<br /><img src="http://www.cppblog.com/images/cppblog_com/wc250en007/cocos2d-x/Screenshot_2012-10-15-16-55-33.png" alt="" /><br /><br /><br /><br />哈哈 可以在游戏中打包自己想要的字体啦<br /><br /><br /><br /><br /><br /><br /><img src ="http://www.cppblog.com/wc250en007/aggbug/193320.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wc250en007/" target="_blank">Let me see see</a> 2012-10-15 16:58 <a href="http://www.cppblog.com/wc250en007/archive/2012/10/15/193320.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cocos2d-x UI之技能冷却按钮</title><link>http://www.cppblog.com/wc250en007/archive/2012/08/28/188511.html</link><dc:creator>Let me see see</dc:creator><author>Let me see see</author><pubDate>Tue, 28 Aug 2012 03:33:00 GMT</pubDate><guid>http://www.cppblog.com/wc250en007/archive/2012/08/28/188511.html</guid><wfw:comment>http://www.cppblog.com/wc250en007/comments/188511.html</wfw:comment><comments>http://www.cppblog.com/wc250en007/archive/2012/08/28/188511.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wc250en007/comments/commentRss/188511.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wc250en007/services/trackbacks/188511.html</trackback:ping><description><![CDATA[<div><div>技能冷却的效果跟魔兽世界中的技能冷却类似，功能如下:</div><div></div><div>技能图标点击时会有按下效果，抬起后开始冷却计时，冷却计时技术后该图标才可以再次进行点击。</div><br />对应的图片资源：</div><div><span style="color: red; ">&nbsp; &nbsp; <strong>注意</strong>:添加child时要注意上下层</span></div><div><span style="color: red; ">&nbsp; &nbsp; 最下方是CCMenuItemImage 按钮图片</span></div><div><span style="color: red; ">&nbsp; &nbsp; 其次是模版图片 半透明模版图片</span></div><div><span style="color: red; ">&nbsp; &nbsp; 最上方是CCProgressTimer 图片是最下图中较大的那个盾牌图片</span></div><div>这是使用的图片资源</div><div>&nbsp;&nbsp;<img src="http://www.cppblog.com/images/cppblog_com/wc250en007/cocos2d-x/normal.png" border="0" alt="" width="64" height="64" />&nbsp;<img src="http://www.cppblog.com/images/cppblog_com/wc250en007/cocos2d-x/click.png" border="0" alt="" width="64" height="64" />&nbsp;<img src="http://www.cppblog.com/images/cppblog_com/wc250en007/cocos2d-x/stencil.png" border="0" alt="" width="64" height="64" /></div><div></div><div><strong>动画原理</strong>：</div><div>非冷却状态时只显示CCMenuItemImage，当冷却开始计时时，将按钮设为不可点击状态，同将半透明模板和进度条精灵设置为可见状态，并且进度条精灵开始进行旋转动作，旋转结束后在回调函数中将半透明模板和进度条精灵设为不可见，按钮重新设置为可点击状态。<br /><br /><strong>使用方法</strong>：<br /><div>创建一个SkillButton指针，修改冷却时间，动画表现(如蒙板从旋转改为竖直方向)，并将SkillButton添加到layer上即可。<br /><br />传个效果图<br /><img src="http://www.cppblog.com/images/cppblog_com/wc250en007/cocos2d-x/SkillButton.png" border="0" alt="" width="636" height="238" /><br /><br /><br /><div>SkillButton.h</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: #008000; ">/*</span><span style="color: #008000; ">*&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;实现技能冷却效果&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;Notice:添加child时要注意上下层关系<br />&nbsp;&nbsp;&nbsp;&nbsp;最下方是按钮&nbsp;其次是半透明的模版图片&nbsp;最上方是CCProgressTimer进度条精灵<br /></span><span style="color: #008000; ">*/</span><br />#ifndef&nbsp;_SKILLBUTTON_H_<br /><span style="color: #0000FF; ">#define</span>&nbsp;_SKILLBUTTON_H_<br />#include&nbsp;&lt;cocos2d.h&gt;<br /><br /><span style="color: #0000FF; ">class</span>&nbsp;SkillButton&nbsp;:&nbsp;<span style="color: #0000FF; ">public</span>&nbsp;cocos2d::CCNode<br />{<br /><span style="color: #0000FF; ">public</span>:<br />&nbsp;&nbsp;&nbsp;&nbsp;SkillButton();<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">virtual</span>&nbsp;~SkillButton();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">/*</span><span style="color: #008000; ">*&nbsp;创建一个SkillButton对象<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; ">*/</span><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">static</span>&nbsp;SkillButton*&nbsp;createSkillButton(<span style="color: #0000FF; ">float</span>&nbsp;cdTime,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;stencil_file_name,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;button_normal_name,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;button_click_name);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">/*</span><span style="color: #008000; ">*&nbsp;CD时间设置<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; ">*/</span><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;&nbsp;&nbsp;&nbsp;setCDTime(<span style="color: #0000FF; ">float</span>&nbsp;time)&nbsp;{&nbsp;mCDTime&nbsp;=&nbsp;time;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">float</span>&nbsp;&nbsp;&nbsp;getCDTime()&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;{&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;mCDTime;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">/*</span><span style="color: #008000; ">*&nbsp;技能按钮点击回调&nbsp;</span><span style="color: #008000; ">*/</span><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;&nbsp;&nbsp;&nbsp;skillClickCallBack(cocos2d::CCObject*&nbsp;obj);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">/*</span><span style="color: #008000; ">*&nbsp;技能冷却完毕回调</span><span style="color: #008000; ">*/</span><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">void</span>&nbsp;&nbsp;&nbsp;&nbsp;skillCoolDownCallBack(cocos2d::CCNode*&nbsp;node);<br /><br /><span style="color: #0000FF; ">private</span>:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">/*</span><span style="color: #008000; ">*&nbsp;初始化&nbsp;</span><span style="color: #008000; ">*/</span><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">bool</span>&nbsp;&nbsp;&nbsp;&nbsp;init(<span style="color: #0000FF; ">float</span>&nbsp;cdTime,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;stencil_file_name,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;button_normal_name,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;button_click_name);<br /><br /><span style="color: #0000FF; ">private</span>:<br />&nbsp;&nbsp;&nbsp;&nbsp;cocos2d::CCMenuItemImage*&nbsp;&nbsp;&nbsp;mItemSkill;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;技能按钮</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;cocos2d::CCMenu*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mMenuSkill;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;技能按钮所在menu</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;cocos2d::CCSprite*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mStencil;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;蒙板精灵,黑色半透明(这个是为了显示一个冷却计时效果)</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;cocos2d::CCProgressTimer*&nbsp;&nbsp;&nbsp;mProgressTimer;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;时间进度条精灵(360度旋转)</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">float</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mCDTime;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;CD时间</span><span style="color: #008000; "><br /></span>};<br /><br /><br /><span style="color: #0000FF; ">#endif</span></div><br /><br />SkillButton.cpp<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 />-->#include&nbsp;"SkillButton.h"<br /><br /><br />USING_NS_CC;<br /><br />SkillButton::SkillButton():<br />&nbsp;&nbsp;&nbsp;&nbsp;mItemSkill(NULL),<br />&nbsp;&nbsp;&nbsp;&nbsp;mMenuSkill(NULL),<br />&nbsp;&nbsp;&nbsp;&nbsp;mStencil(NULL),<br />&nbsp;&nbsp;&nbsp;&nbsp;mProgressTimer(NULL),<br />&nbsp;&nbsp;&nbsp;&nbsp;mCDTime(1.f)<br />{<br /><br />}<br /><br />SkillButton::~SkillButton()<br />{<br /><br />}<br /><br />SkillButton*&nbsp;SkillButton::createSkillButton(<span style="color: #0000FF; ">float</span>&nbsp;cdTime,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;stencil_file_name,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;button_normal_name,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;button_click_name)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;SkillButton*&nbsp;skillButton&nbsp;=&nbsp;<span style="color: #0000FF; ">new</span>&nbsp;SkillButton();<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(skillButton&nbsp;&amp;&amp;&nbsp;skillButton-&gt;init(cdTime,&nbsp;stencil_file_name,&nbsp;button_normal_name,&nbsp;button_click_name))<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;skillButton-&gt;autorelease();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;skillButton;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">else</span><br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delete&nbsp;skillButton;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;skillButton&nbsp;=&nbsp;NULL;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;NULL;<br />}<br /><br /><span style="color: #0000FF; ">bool</span>&nbsp;SkillButton::init(<span style="color: #0000FF; ">float</span>&nbsp;cdTime,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;stencil_file_name,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;button_normal_name,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">char</span>*&nbsp;button_click_name)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;CCAssert(stencil_file_name,&nbsp;"SkillButton::init&nbsp;stencil_file_name&nbsp;!=&nbsp;NULL");<br />&nbsp;&nbsp;&nbsp;&nbsp;CCAssert(button_normal_name,&nbsp;"SkillButton::init&nbsp;button_normal_name&nbsp;!=&nbsp;NULL");<br />&nbsp;&nbsp;&nbsp;&nbsp;CCAssert(button_click_name,&nbsp;"SkillButton::init&nbsp;button_click_name&nbsp;!=&nbsp;NULL");<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;Notice:添加child时要注意上下层<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;最下方是CCMenuItemImage&nbsp;其次是模版图片&nbsp;最上方是CCProgressTimer<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;添加技能按钮</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;mItemSkill&nbsp;=&nbsp;CCMenuItemImage::create(button_normal_name,&nbsp;button_click_name,&nbsp;<span style="color: #0000FF; ">this</span>,&nbsp;menu_selector(SkillButton::skillClickCallBack));<br />&nbsp;&nbsp;&nbsp;&nbsp;mItemSkill-&gt;setPosition(CCPointZero);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;mMenuSkill&nbsp;=&nbsp;CCMenu::create(mItemSkill,&nbsp;NULL);<br />&nbsp;&nbsp;&nbsp;&nbsp;mMenuSkill-&gt;setPosition(CCPointZero);<br />&nbsp;&nbsp;&nbsp;&nbsp;addChild(mMenuSkill,&nbsp;-100);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;添加阴影模版</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;mStencil&nbsp;=&nbsp;CCSprite::create(stencil_file_name);<br />&nbsp;&nbsp;&nbsp;&nbsp;mStencil-&gt;setPosition(CCPointZero);<br />&nbsp;&nbsp;&nbsp;&nbsp;mStencil-&gt;setVisible(<span style="color: #0000FF; ">false</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;addChild(mStencil);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;添加旋转进度条精灵</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;CCSprite*&nbsp;progressSprite&nbsp;=&nbsp;CCSprite::create(button_normal_name);<br />&nbsp;&nbsp;&nbsp;&nbsp;mProgressTimer&nbsp;=&nbsp;CCProgressTimer::create(progressSprite);<br />&nbsp;&nbsp;&nbsp;&nbsp;mProgressTimer-&gt;setPosition(CCPointZero);<br />&nbsp;&nbsp;&nbsp;&nbsp;mProgressTimer-&gt;setVisible(<span style="color: #0000FF; ">false</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;addChild(mProgressTimer,&nbsp;100);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;mCDTime&nbsp;=&nbsp;cdTime;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;<span style="color: #0000FF; ">true</span>;<br />}<br /><br /><span style="color: #008000; ">/*</span><span style="color: #008000; ">*&nbsp;技能按钮点击回调&nbsp;</span><span style="color: #008000; ">*/</span><br /><span style="color: #0000FF; ">void</span>&nbsp;SkillButton::skillClickCallBack(cocos2d::CCObject*&nbsp;obj)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;冷却计时，即时状态技能按钮不可点击</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;mItemSkill-&gt;setEnabled(<span style="color: #0000FF; ">false</span>);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;模版可见</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;mStencil-&gt;setVisible(<span style="color: #0000FF; ">true</span>);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;设置精灵进度条为顺时针</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;mProgressTimer-&gt;setVisible(<span style="color: #0000FF; ">true</span>);<br />&nbsp;&nbsp;&nbsp;&nbsp;mProgressTimer-&gt;setType(kCCProgressTimerTypeRadial);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">准备一个5秒旋转360度的动画(逐渐覆盖半透模板形成冷却效果;这里进行计时冷却动画的实现和时间控制)</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;CCActionInterval*&nbsp;action_progress_to&nbsp;=&nbsp;CCProgressTo::create(mCDTime,&nbsp;100);<br />&nbsp;&nbsp;&nbsp;&nbsp;CCCallFunc*&nbsp;action_callback&nbsp;=&nbsp;CCCallFuncN::create(<span style="color: #0000FF; ">this</span>,&nbsp;callfuncN_selector(SkillButton::skillCoolDownCallBack));<br />&nbsp;&nbsp;&nbsp;&nbsp;mProgressTimer-&gt;runAction(CCSequence::create(action_progress_to,&nbsp;action_callback,&nbsp;NULL));<br />}<br /><br /><span style="color: #008000; ">/*</span><span style="color: #008000; ">*&nbsp;技能冷却完成回调&nbsp;</span><span style="color: #008000; ">*/</span><br /><span style="color: #0000FF; ">void</span>&nbsp;SkillButton::skillCoolDownCallBack(CCNode*&nbsp;node)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;设置蒙板不可见</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;mStencil-&gt;setVisible(<span style="color: #0000FF; ">false</span>);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;进度条技能不可见</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;mProgressTimer-&gt;setVisible(<span style="color: #0000FF; ">false</span>);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;按钮置为可用</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;mItemSkill-&gt;setEnabled(<span style="color: #0000FF; ">true</span>);<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 />-->&nbsp; &nbsp; mSkillButton&nbsp;=&nbsp;SkillButton::createSkillButton(2.f,&nbsp;"stencil.png",&nbsp;"normal.png",&nbsp;"click.png");<br />&nbsp;&nbsp;&nbsp;&nbsp;mSkillButton-&gt;setPosition(ccp(s.width/2,&nbsp;s.height/2));<br />&nbsp;&nbsp;&nbsp;&nbsp;addChild(mSkillButton);</div><br /><a title="代码下载" href="/Files/wc250en007/cocos2d-x/SkillButton.rar">代码下载</a><br /><br />参考地址：<br /><a href="http://blog.sina.com.cn/s/blog_732784f70100umuj.html">http://blog.sina.com.cn/s/blog_732784f70100umuj.html</a>&nbsp;<br /><a href="http://www.cocos2dev.com/?p=64">http://www.cocos2dev.com/?p=64</a>&nbsp;<br /><br /></div></div><img src ="http://www.cppblog.com/wc250en007/aggbug/188511.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wc250en007/" target="_blank">Let me see see</a> 2012-08-28 11:33 <a href="http://www.cppblog.com/wc250en007/archive/2012/08/28/188511.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cocos2d-x 给Sprite添加Mask（遮罩)</title><link>http://www.cppblog.com/wc250en007/archive/2012/08/26/188362.html</link><dc:creator>Let me see see</dc:creator><author>Let me see see</author><pubDate>Sun, 26 Aug 2012 15:06:00 GMT</pubDate><guid>http://www.cppblog.com/wc250en007/archive/2012/08/26/188362.html</guid><wfw:comment>http://www.cppblog.com/wc250en007/comments/188362.html</wfw:comment><comments>http://www.cppblog.com/wc250en007/archive/2012/08/26/188362.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wc250en007/comments/commentRss/188362.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wc250en007/services/trackbacks/188362.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 教程截图：　　有时候，你在做游戏时，可能需要一种方式来显示精灵的某一部分（就是添加遮罩啦）。　　一种方式就是使用另外一张图片，叫做mask。你把mask图片中间设置成白色，白色区域是被mask图片的可见区域。之后这个白色区域会透明的。　　然后，你可以使用本教程提供的方法来把mask图和原图结合起来，然后创建如上图所示的效果。　　你会发现本教程提供的方法非常方便，用它可以完成许多...&nbsp;&nbsp;<a href='http://www.cppblog.com/wc250en007/archive/2012/08/26/188362.html'>阅读全文</a><img src ="http://www.cppblog.com/wc250en007/aggbug/188362.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wc250en007/" target="_blank">Let me see see</a> 2012-08-26 23:06 <a href="http://www.cppblog.com/wc250en007/archive/2012/08/26/188362.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cocos2d-x 贝塞尔曲线之游戏应用</title><link>http://www.cppblog.com/wc250en007/archive/2012/08/24/188048.html</link><dc:creator>Let me see see</dc:creator><author>Let me see see</author><pubDate>Fri, 24 Aug 2012 10:04:00 GMT</pubDate><guid>http://www.cppblog.com/wc250en007/archive/2012/08/24/188048.html</guid><wfw:comment>http://www.cppblog.com/wc250en007/comments/188048.html</wfw:comment><comments>http://www.cppblog.com/wc250en007/archive/2012/08/24/188048.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/wc250en007/comments/commentRss/188048.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wc250en007/services/trackbacks/188048.html</trackback:ping><description><![CDATA[一.贝赛尔曲线简介<br /><span style="font-family: arial, 宋体, sans-serif; font-size: 13.63636302947998px; line-height: 24px; background-color: #ffffff; ">贝塞尔曲线是应用于二维图形应用程序的数学曲线。曲线的定义有四个点：起始点、终止点（也称锚点）以及两个相互分离的中间点。滑动两个中间点，贝塞尔曲线的形状会发生变化</span>&nbsp;<br /><img src="http://www.cppblog.com/images/cppblog_com/wc250en007/cocos2d-x/300px-Bezier_curve.svg.png" width="300" height="188" alt="" /><br />p0起点，p3是终点，p1,p2是控制点<br /><a href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve">http://en.wikipedia.org/wiki/B%C3%A9zier_curve</a>&nbsp;<br /><br />二.游戏应用<br /><br />我们可能需要在游戏中模拟导弹或箭的移动轨迹，用才cocos2d-x下的bezier可以轻松的模拟出来<br />cocos2d-x下为我们提供了两个action&nbsp;CCBezierBy和CCBezierTo，使用也很简单，只需要填充结构体：<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 />-->&nbsp; &nbsp; &nbsp; &nbsp; ccBezierConfig&nbsp;tr0;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tr0.endPosition=ccp(280,&nbsp;240);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tr0.controlPoint_1=ccp(40,&nbsp;400);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tr0.controlPoint_2=ccp(280,&nbsp;80);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CCActionInterval*&nbsp;bezierForward&nbsp;=&nbsp;CCBezierBy::create(1.f,&nbsp;tr0);</div>我们只需要提供两个控制点和一个终点位置就可以了，这里要注意的是<br /><font size="2"><span style="color: red; ">CCBezier这个action是以当前位置为起始点的，两个控制点和终点都是相对于起始点的偏移值</span></font><br /><span style="color: red; ">如：tr0.endPosition = ccp(280,240); 是相对于起始点的偏移</span><br /><br />三. 游戏实例<br />我们来模拟一个射箭游戏，<span><strong>屏幕中心点是一个人，点击屏幕任何位置，会朝这个点击位置射一支箭，箭到达指定点后抖动一会(播放一个抖动动画),然后消失<br /></strong></span><br /><img src="http://www.cppblog.com/images/cppblog_com/wc250en007/cocos2d-x/ArrowDirection2.png" border="0" alt="" width="815" height="520" /><br />p0是箭的发射位置，p3是箭的目标点，p1,p2是控制飞行轨迹的控制点，p1p0p3组成了箭的角度，假设我们有十六个方向的箭，即360.f/16= 22.5度一个方向<br /><br /><img src="http://www.cppblog.com/images/cppblog_com/wc250en007/cocos2d-x/arrow.png" border="0" alt="" width="219" height="503" /><br /><br /><br />第一步：存贮箭的飞行动画和抖动动画到CCAnimationCatch中，后面播放动画时通过名字来获得动画<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 />-->&nbsp; &nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;存贮箭的飞行动画,箭有多少个方向，就存贮多少个动画</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">for</span>&nbsp;(<span style="color: #0000FF; ">int</span>&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;mDirections;&nbsp;++i)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;箭飞行动画&nbsp;</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CCArray*&nbsp;spriteFramesArray&nbsp;=&nbsp;CCArray::create(flyFrames);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;从图片中每一帧的位置来生成CCSpriteFrame</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">for</span>&nbsp;(&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;j&nbsp;=&nbsp;0;&nbsp;j&nbsp;&lt;&nbsp;flyFrames;&nbsp;++j&nbsp;)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CCSpriteFrame*&nbsp;frame&nbsp;=&nbsp;CCSpriteFrame::create(pTexture,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CCRectMake(j&nbsp;*&nbsp;frame_width,&nbsp;i&nbsp;*&nbsp;frame_height,&nbsp;frame_width,&nbsp;frame_height));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spriteFramesArray-&gt;addObject(frame);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">以键值形式存贮动画到CCAnimationCatch中</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">float</span>&nbsp;frameTime&nbsp;=&nbsp;1.f&nbsp;/&nbsp;(mSpeed&nbsp;*&nbsp;flyFrames);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CCAnimation*&nbsp;animation&nbsp;=&nbsp;CCAnimation::create(spriteFramesArray,&nbsp;frameTime);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;name&nbsp;=&nbsp;getArrowAnimateName(i);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CCAnimationCache::sharedAnimationCache()-&gt;addAnimation(animation,&nbsp;name.c_str());<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spriteFramesArray-&gt;removeAllObjects();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spriteFramesArray-&gt;release();<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;同理存贮箭的抖动动画</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://www.cppblog.com/Images/dot.gif" alt="" />.</div><br /><br /><br />第二步：获得射箭目标点，用贝塞尔曲线模拟箭的飞行轨迹<br />&nbsp; &nbsp; &nbsp; 首先，要求出箭的射击方向，从CCAnimationCatche中取出对应的飞行动画，我们有16个方向的动画，下面是写的一个简单的求射箭角度和方向的函数：<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"><span style="color: #0000ff; ">#define</span>&nbsp;EPSION&nbsp;0.0001f&nbsp;<br /><span style="color: #0000FF; ">#define</span>&nbsp;IS_EQUAL(val1,&nbsp;val2)&nbsp;&nbsp;(fabs((val1)&nbsp;-&nbsp;(val2))&nbsp;&lt;=&nbsp;EPSION)<br /><span style="color: #0000FF; ">const</span>&nbsp;<span style="color: #0000FF; ">int</span>&nbsp;mDirections&nbsp;=&nbsp;16;<br /><br /><span style="color: #008000; ">/*</span><span style="color: #008000; ">*&nbsp;更新方向,传入起始点和终止点，利用actan来获得射箭的弧度，然后转换为角度<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000; ">*/</span><br /><span style="color: #0000FF; ">int</span>&nbsp;ArrowDirection::updateDirection(<span style="color: #0000FF; ">const</span>&nbsp;cocos2d::CCPoint&amp;&nbsp;ptRole,&nbsp;<span style="color: #0000FF; ">const</span>&nbsp;cocos2d::CCPoint&amp;&nbsp;ptTarget)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;CCPoint&nbsp;sub&nbsp;=&nbsp;ccpSub(ptTarget,&nbsp;ptRole);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(IS_EQUAL(sub.x,&nbsp;0.f)&nbsp;&amp;&amp;&nbsp;IS_EQUAL(sub.y,&nbsp;0.f))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;-1;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(IS_EQUAL(sub.y,&nbsp;0.f)&nbsp;&amp;&amp;&nbsp;sub.x&nbsp;&gt;&nbsp;0)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mDegree&nbsp;=&nbsp;90.f;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">else</span>&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(IS_EQUAL(sub.y,&nbsp;0.f)&nbsp;&amp;&amp;&nbsp;sub.x&nbsp;&lt;&nbsp;0)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mDegree&nbsp;=&nbsp;180.f;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">else</span><br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;弧度转角度</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">float</span>&nbsp;radians&nbsp;=&nbsp;atanf(sub.x/sub.y);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mDegree&nbsp;=&nbsp;CC_RADIANS_TO_DEGREES(radians);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(sub.x&nbsp;&gt;=&nbsp;0&nbsp;&amp;&amp;&nbsp;sub.y&nbsp;&gt;=&nbsp;0&nbsp;)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;第一象限</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">else</span>&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(sub.x&nbsp;&gt;=&nbsp;0&nbsp;&amp;&amp;&nbsp;sub.y&nbsp;&lt;=&nbsp;0)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;第二象限</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mDegree&nbsp;+=&nbsp;180.f;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">else</span>&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(sub.x&nbsp;&lt;=&nbsp;0&nbsp;&amp;&amp;&nbsp;sub.y&nbsp;&lt;=&nbsp;0)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;第三象限</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mDegree&nbsp;+=&nbsp;180.f;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">else</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;第四象限</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mDegree&nbsp;+=&nbsp;360.f;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(mDegree&nbsp;&lt;&nbsp;0.f)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mDegree&nbsp;=&nbsp;0.f;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(mDegree&nbsp;&gt;&nbsp;360.f)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mDegree&nbsp;=&nbsp;0.f;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">float</span>&nbsp;single&nbsp;=&nbsp;(<span style="color: #0000FF; ">float</span>)360&nbsp;/&nbsp;16;<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">for</span>&nbsp;(<span style="color: #0000FF; ">int</span>&nbsp;i&nbsp;=&nbsp;0;&nbsp;i&nbsp;&lt;&nbsp;mDirections;&nbsp;++i)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(mDegree&nbsp;&gt;=&nbsp;i&nbsp;*&nbsp;single&nbsp;&amp;&amp;&nbsp;mDegree&nbsp;&lt;=&nbsp;(i+1)&nbsp;*&nbsp;single)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;mDirections;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">return</span>&nbsp;mDirections&nbsp;-&nbsp;1;<br />}</div><br /><br />&nbsp; &nbsp; &nbsp; 有了角度和动画就好办了，我们已经知道了目标点，哈哈，可以让箭一边播放飞行动画一边沿着贝塞尔曲线移动就OK了<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 />-->&nbsp; &nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;播放箭飞行动作</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;String&nbsp;name&nbsp;=&nbsp;getArrowAnimateName(<strong>dir</strong>);<br />&nbsp;&nbsp;&nbsp;&nbsp;cocos2d::CCAnimation*&nbsp;animation&nbsp;=&nbsp;<strong>CCAnimationCache</strong>::sharedAnimationCache()-&gt;animationByName(name.c_str());<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;CCAnimate*&nbsp;animate&nbsp;=&nbsp;CCAnimate::actionWithAnimation(animation);<br />&nbsp;&nbsp;&nbsp;&nbsp;mSprite-&gt;runAction(animate);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;填充bezier</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;ccBezierConfig&nbsp;cfg;<br />&nbsp;&nbsp;&nbsp;&nbsp;cfg.controlPoint_1&nbsp;=&nbsp;ccp(0,&nbsp;control_height);<br />&nbsp;&nbsp;&nbsp;&nbsp;cfg.controlPoint_2&nbsp;=&nbsp;ccp(ptRelativeTarget.x,&nbsp;ptRelativeTarget.y&nbsp;+&nbsp;control_height);<br />&nbsp;&nbsp;&nbsp;&nbsp;cfg.endPosition&nbsp;=&nbsp;ptRelativeTarget;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;沿着贝塞尔曲线移动</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;CCActionInterval*&nbsp;bezierForward&nbsp;=&nbsp;CCBezierBy::create(2.f,&nbsp;cfg);<br />&nbsp;&nbsp;&nbsp;&nbsp;CCActionInterval*&nbsp;seq&nbsp;=&nbsp;(CCActionInterval*)CCSequence::create(bezierForward,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CCCallFuncND::create(<span style="color: #0000FF; ">this</span>,&nbsp;callfuncND_selector(<strong>ArrowDirection::arrowFlyOverCallBack</strong>),&nbsp;<span style="color: #0000FF; ">this</span>),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;mSprite-&gt;runAction(seq);</div>我们为action序列添加了回调函数<strong style="font-size: 13px; ">ArrowDirection::arrowFlyOverCallBack</strong>&nbsp;箭飞行完毕后进入下一阶段<br />&nbsp;<br /><br />第三步：箭到达目标点，播放抖动动画<br /><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 />-->sprite-&gt;stopAllActions();</div><br />然后播放抖动动画，抖动动画再加一个回调函数<br /><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 />-->CCAnimate*&nbsp;animate&nbsp;=&nbsp;CCAnimate::actionWithAnimation(animation);<br />sprite-&gt;runAction(CCRepeatForever::create(animate));<br /><br />CCActionInterval*&nbsp;delay&nbsp;=&nbsp;CCDelayTime::create(pArrowDir-&gt;getArrowShakeTime());<br />CCActionInterval*&nbsp;seq&nbsp;=&nbsp;(CCActionInterval*)CCSequence::create(delay,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CCCallFuncND::create(pArrowDir,&nbsp;callfuncND_selector(<strong>ArrowDirection::arrowDisappearedCallBack</strong>),&nbsp;pArrowDir),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL);<br /><br />sprite-&gt;runAction(seq);</div><br />第四步：播放完毕，清除箭<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 />-->removeFromParentAndCleanup(<span style="color: #0000FF; ">true</span>);</div><br />-------------------------------------------------------------------------------<br /><strong>调试帮助</strong>：<br />1.光看是不够的，要看箭的飞行轨迹，还是要画出来，在CCNode的派生类中重载draw()函数，在里面画贝塞尔曲线<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; ">void</span>&nbsp;ArrowDirection::draw()<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #0000FF; ">if</span>&nbsp;(mDrawBezier)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CCPoint&nbsp;control1&nbsp;=&nbsp;ccpAdd(mBezierStartPoint,&nbsp;mBezierConfig.controlPoint_1);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CCPoint&nbsp;control2&nbsp;=&nbsp;ccpAdd(mBezierStartPoint,&nbsp;mBezierConfig.controlPoint_2);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CCPoint&nbsp;end&nbsp;=&nbsp;ccpAdd(mBezierStartPoint,&nbsp;mBezierConfig.endPosition);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;画控制点</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ccDrawLine(mBezierStartPoint,&nbsp;control1);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ccDrawLine(control2,&nbsp;end);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">&nbsp;画贝塞尔曲线</span><span style="color: #008000; "><br /></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ccDrawCubicBezier(mBezierStartPoint,&nbsp;mBezierConfig.controlPoint_1,&nbsp;mBezierConfig.controlPoint_2,&nbsp;mBezierConfig.endPosition,&nbsp;100);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}</div>更多画法参考cocos2d-x粒子DrawPrimitivesTest<br /><img src ="http://www.cppblog.com/wc250en007/aggbug/188048.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wc250en007/" target="_blank">Let me see see</a> 2012-08-24 18:04 <a href="http://www.cppblog.com/wc250en007/archive/2012/08/24/188048.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cocos2d-x 随机数</title><link>http://www.cppblog.com/wc250en007/archive/2012/08/24/188128.html</link><dc:creator>Let me see see</dc:creator><author>Let me see see</author><pubDate>Fri, 24 Aug 2012 06:14:00 GMT</pubDate><guid>http://www.cppblog.com/wc250en007/archive/2012/08/24/188128.html</guid><wfw:comment>http://www.cppblog.com/wc250en007/comments/188128.html</wfw:comment><comments>http://www.cppblog.com/wc250en007/archive/2012/08/24/188128.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wc250en007/comments/commentRss/188128.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wc250en007/services/trackbacks/188128.html</trackback:ping><description><![CDATA[&nbsp;cocos2d-x中提供了CCRANDOM_0_1()宏<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: #008000; ">/*</span><span style="color: #008000; ">*&nbsp;@def&nbsp;CCRANDOM_0_1<br />&nbsp;returns&nbsp;a&nbsp;random&nbsp;float&nbsp;between&nbsp;0&nbsp;and&nbsp;1<br />&nbsp;</span><span style="color: #008000; ">*/</span><br /><span style="color: #0000FF; ">#define</span>&nbsp;CCRANDOM_0_1()&nbsp;((float)rand()/RAND_MAX)</div>生成float范围是[0.f,1.f]，包括0和1<br />哈哈 如果我们需要[0,100]的随机数<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; ">float</span>&nbsp;random&nbsp;=&nbsp;CCRANDOM_0_1()&nbsp;*&nbsp;100;&nbsp;<span style="color: #008000; ">//</span><span style="color: #008000; ">[0,100]&nbsp;&nbsp;&nbsp;CCRANDOM_0_1()&nbsp;取值范围是[0,1]</span></div><img src ="http://www.cppblog.com/wc250en007/aggbug/188128.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wc250en007/" target="_blank">Let me see see</a> 2012-08-24 14:14 <a href="http://www.cppblog.com/wc250en007/archive/2012/08/24/188128.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>发布release版本的apk软件</title><link>http://www.cppblog.com/wc250en007/archive/2012/08/15/187250.html</link><dc:creator>Let me see see</dc:creator><author>Let me see see</author><pubDate>Wed, 15 Aug 2012 02:11:00 GMT</pubDate><guid>http://www.cppblog.com/wc250en007/archive/2012/08/15/187250.html</guid><wfw:comment>http://www.cppblog.com/wc250en007/comments/187250.html</wfw:comment><comments>http://www.cppblog.com/wc250en007/archive/2012/08/15/187250.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wc250en007/comments/commentRss/187250.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wc250en007/services/trackbacks/187250.html</trackback:ping><description><![CDATA[<h2>Signing in Release Mode</h2><hr style="height: 1px; margin: 5px 0px 20px; border: 0px; background-color: #cccccc; color: #222222; font-family: Roboto, sans-serif; line-height: 19px; " /><p style="margin: 0px 0px 15px; color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; ">When your application is ready for release to other users, you must:</p><ol style="margin: 0px 0px 15px 18px; padding: 0px; color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; "><li style="margin: 0px 0px 4px; "><a href="http://developer.android.com/tools/publishing/app-signing.html#cert" style="color: #258aaf; text-decoration: none; ">Obtain a suitable private key</a></li><li style="margin: 0px 0px 4px; "><a href="http://developer.android.com/tools/publishing/app-signing.html#releasecompile" style="color: #258aaf; text-decoration: none; ">Compile the application in release mode</a></li><li style="margin: 0px 0px 4px; "><a href="http://developer.android.com/tools/publishing/app-signing.html#signapp" style="color: #258aaf; text-decoration: none; ">Sign your application with your private key</a></li><li style="margin: 0px 0px 4px; "><a href="http://developer.android.com/tools/publishing/app-signing.html#align" style="color: #258aaf; text-decoration: none; ">Align the final APK package</a></li></ol><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">发布release版本要有4步<br />官方说明：&nbsp;</span>&nbsp;<a href="http://developer.android.com/tools/publishing/app-signing.html#releasecompile">http://developer.android.com/tools/publishing/app-signing.html#releasecompile</a>&nbsp;<br /><br /><br /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">平时通过Eclipse生成在bin目录下的apk文件，都是debug版的，如何创建release版的软件呢？&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">其实还是挺简单的。&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">1. 通过java自带的keytool工具，创建release版的keystore&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><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 />-->keytool&nbsp;-genkey&nbsp;-v&nbsp;-keystore&nbsp;keystore_name.keystore&nbsp;-alias&nbsp;alias_name&nbsp;-keyalg&nbsp;RSA&nbsp;-validity&nbsp;10000&nbsp;</div><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">keystore_name.keystore：要创建的release版keystore的文件名&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">alias_name：别名？取个好记点的名字吧，后面还要用到的 （填写配置文件)</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">-keyalg RSA：通过RSA算法生成&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">-validity 10000：有效期，单位是天&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">如果java环境配置正常，输入命令后会出现下列信息&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">Enter keystore password:（keystore的密码）&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">Re-enter new password:（确认keystore的密码）&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">What is your first and last name?&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">&nbsp;&nbsp;[Unknown]:&nbsp;&nbsp;（姓名，用自己喜欢的名字吧，不知道会显示在哪里）&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">What is the name of your organizational unit?&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">&nbsp;&nbsp;[Unknown]:&nbsp;&nbsp;（组织单位）&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">What is the name of your organization?&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">&nbsp;&nbsp;[Unknown]:&nbsp;&nbsp;（组织，不知道和上面那个有什么区别）&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">What is the name of your City or Locality?&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">&nbsp;&nbsp;[Unknown]:&nbsp;&nbsp;（城市）&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">What is the name of your State or Province?&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">&nbsp;&nbsp;[Unknown]:&nbsp;&nbsp;（州，省，县）&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">What is the two-letter country code for this unit?&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">&nbsp;&nbsp;[Unknown]:&nbsp;&nbsp;CN&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">Is CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=CN correct?&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">&nbsp;&nbsp;[no]:&nbsp;&nbsp;yes （确认输入的信息）&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">Generating 1,024 bit RSA key pair and self-signed certificate (SHA1withRSA) with&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">a validity of 10,000 days&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;for: CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=CN&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">Enter key password for &lt;alias_name&gt;&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;(RETURN if same as keystore password):（alias的密码，如果和keytore密码一致，直接回车）&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">Re-enter new password:（确认alias的密码）&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">[Storing my-release-key.keystore]&nbsp;<br /></span><br /><br /><span style="background-color: #f9f9f9; color: #333333; font-family: Roboto, sans-serif; font-size: 20px; line-height: 32px; ">2.发布Release版本<br />Signing in Release Mode</span><br /><hr style="height: 1px; margin: 5px 0px 20px; border: 0px; background-color: #cccccc; color: #222222; font-family: Roboto, sans-serif; line-height: 19px; " /><p style="margin: 0px 0px 15px; color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; ">When your application is ready for release to other users, you must:</p><ol style="margin: 0px 0px 15px 18px; padding: 0px; color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; "><li style="margin: 0px 0px 4px; "><a href="http://developer.android.com/tools/publishing/app-signing.html#cert" style="color: #258aaf; text-decoration: none; ">Obtain a suitable private key</a></li><li style="margin: 0px 0px 4px; "><a href="http://developer.android.com/tools/publishing/app-signing.html#releasecompile" style="color: #258aaf; text-decoration: none; ">Compile the application in release mode</a></li><li style="margin: 0px 0px 4px; "><a href="http://developer.android.com/tools/publishing/app-signing.html#signapp" style="color: #258aaf; text-decoration: none; ">Sign your application with your private key</a></li><li style="margin: 0px 0px 4px; "><a href="http://developer.android.com/tools/publishing/app-signing.html#align" style="color: #258aaf; text-decoration: none; ">Align the final APK package</a></li></ol>官方的步骤有4步，编译release版本的应用程序<br /><br /><strong>2.1&nbsp;<span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.366666793823242px; background-color: #ffffff; ">Eclipse导出</span></strong><br /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">在Eclipse中，右键要发布的项目，依次选择Android Tool -&gt; Export Signed Application Package...&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">然后就是step-by-step了，选择刚才生成的release版keystore，输入密码，选择alias，输入alias密码，生成release版的apk。&nbsp;<br /><br /></span><strong>2.2 采用ANT命令行形式</strong><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><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 />-->$&nbsp;ant&nbsp;release</div><br /><span style="color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; ">By default, the build script compiles the application APK without signing it. The output file in your project&nbsp;</span><code style="color: #006600; font-weight: bold; line-height: 1.5; font-family: 'courier new', courier, monospace; background-color: #f9f9f9; ">bin/</code><span style="color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; ">&nbsp;will be&nbsp;</span><code style="color: #006600; font-weight: bold; line-height: 1.5; font-family: 'courier new', courier, monospace; background-color: #f9f9f9; "><em>&lt;your_project_name&gt;</em>-unsigned.apk</code><span style="color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; ">. Because the application APK is still unsigned, you must manually sign it with your private key and then align it using&nbsp;</span><code style="color: #006600; font-weight: bold; line-height: 1.5; font-family: 'courier new', courier, monospace; background-color: #f9f9f9; ">zipalign</code><span style="color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; ">.</span>&nbsp;<br /><br />默认编译出来的版本是没有证书的<em style="color: #006600; font-family: 'courier new', courier, monospace; font-weight: bold; ">&lt;your_project_name&gt;</em><span style="color: #006600; font-family: 'courier new', courier, monospace; font-weight: bold; background-color: #f9f9f9; ">-unsigned.apk</span>&nbsp;，需要手动添加证书和对齐<br /><br /><span style="color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; ">To specify your keystore and alias, open the project&nbsp;</span><code style="color: #006600; font-weight: bold; line-height: 1.5; font-family: 'courier new', courier, monospace; background-color: #f9f9f9; ">ant.properties</code><span style="color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; ">&nbsp;file (found in the root of the project directory) and add entries for&nbsp;</span><code style="color: #006600; font-weight: bold; line-height: 1.5; font-family: 'courier new', courier, monospace; background-color: #f9f9f9; ">key.store</code><span style="color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; ">&nbsp;and&nbsp;</span><code style="color: #006600; font-weight: bold; line-height: 1.5; font-family: 'courier new', courier, monospace; background-color: #f9f9f9; ">key.alias</code><span style="color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; ">. For example:</span>&nbsp;<br /><br />我们可以在<strong>ant.properties</strong>文件中指定证书位置和对齐<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 />-->#&nbsp;This&nbsp;file&nbsp;<span style="color: #0000FF; ">is</span>&nbsp;used&nbsp;to&nbsp;<span style="color: #0000FF; ">override</span>&nbsp;<span style="color: #0000FF; ">default</span>&nbsp;values&nbsp;used&nbsp;by&nbsp;the&nbsp;Ant&nbsp;build&nbsp;system.<br />#<br />#&nbsp;This&nbsp;file&nbsp;must&nbsp;be&nbsp;<span style="color: #0000FF; ">checked</span>&nbsp;into&nbsp;Version&nbsp;Control&nbsp;Systems,&nbsp;<span style="color: #0000FF; ">as</span>&nbsp;it&nbsp;<span style="color: #0000FF; ">is</span><br />#&nbsp;integral&nbsp;to&nbsp;the&nbsp;build&nbsp;system&nbsp;of&nbsp;your&nbsp;project.<br /><br />#&nbsp;This&nbsp;file&nbsp;<span style="color: #0000FF; ">is</span>&nbsp;only&nbsp;used&nbsp;by&nbsp;the&nbsp;Ant&nbsp;script.<br /><br />#&nbsp;You&nbsp;can&nbsp;use&nbsp;<span style="color: #0000FF; ">this</span>&nbsp;to&nbsp;<span style="color: #0000FF; ">override</span>&nbsp;<span style="color: #0000FF; ">default</span>&nbsp;values&nbsp;such&nbsp;<span style="color: #0000FF; ">as</span><br />#&nbsp;&nbsp;'source.dir'&nbsp;<span style="color: #0000FF; ">for</span>&nbsp;the&nbsp;location&nbsp;of&nbsp;your&nbsp;java&nbsp;source&nbsp;folder&nbsp;and<br />#&nbsp;&nbsp;'out.dir'&nbsp;<span style="color: #0000FF; ">for</span>&nbsp;the&nbsp;location&nbsp;of&nbsp;your&nbsp;output&nbsp;folder.<br /><br />#&nbsp;You&nbsp;can&nbsp;also&nbsp;use&nbsp;it&nbsp;define&nbsp;how&nbsp;the&nbsp;release&nbsp;builds&nbsp;are&nbsp;signed&nbsp;by&nbsp;declaring<br />#&nbsp;the&nbsp;following&nbsp;properties:<br />#&nbsp;&nbsp;'key.store'&nbsp;<span style="color: #0000FF; ">for</span>&nbsp;the&nbsp;location&nbsp;of&nbsp;your&nbsp;keystore&nbsp;and<br />#&nbsp;&nbsp;'key.alias'&nbsp;<span style="color: #0000FF; ">for</span>&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;key&nbsp;to&nbsp;use.<br />#&nbsp;The&nbsp;password&nbsp;will&nbsp;be&nbsp;asked&nbsp;during&nbsp;the&nbsp;build&nbsp;when&nbsp;you&nbsp;use&nbsp;the&nbsp;'release'&nbsp;target.<br /><br />#我的证书在上一级目录下<br />#alias是创建证书时填写的alias_name<br /><br />key.store=../keystore_name.keystore&nbsp;<br />key.alias=alias_name</div><br />接下来的步骤很easy了<br /><br /><p style="margin: 0px 0px 15px; color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; ">Save your changes. Now you can build a&nbsp;<em>signed</em>&nbsp;.apk in release mode:</p><ol style="margin: 0px 0px 15px 18px; padding: 0px; color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; "><li style="margin: 0px 0px 4px; ">Open a command-line and navigate to the root of your project directory.</li><li style="margin: 0px 0px 4px; ">Use Ant to compile your project in release mode:<pre style="color: #006600; line-height: 1.5; font-family: 'courier new', courier, monospace; padding: 1em; overflow: auto; border: 1px solid #dddddd; background-color: #f7f7f7; "><span style="color: #000000; ">ant release</span></pre></li><li style="margin: 0px 0px 4px; ">When prompted, enter you keystore and alias passwords.<p style="margin: 10px 0px 0px; padding: 0px 0px 0px 10px; border-left-width: 4px; border-left-style: solid; border-color: #ff8800; "><strong>Caution:</strong>&nbsp;As described above, your password will be visible on the screen.</p></li></ol><p style="margin: 0px 0px 15px; color: #222222; font-family: Roboto, sans-serif; line-height: 19px; background-color: #f9f9f9; ">This creates your Android application .apk file inside the project&nbsp;<code style="color: #006600; font-weight: bold; line-height: 1.5; font-family: 'courier new', courier, monospace; ">bin/</code>&nbsp;directory, named<code style="color: #006600; font-weight: bold; line-height: 1.5; font-family: 'courier new', courier, monospace; "><em>&lt;your_project_name&gt;</em>-release.apk</code>. This .apk file has been signed with the private key specified in<code style="color: #006600; font-weight: bold; line-height: 1.5; font-family: 'courier new', courier, monospace; ">ant.properties</code>&nbsp;and aligned with&nbsp;<code style="color: #006600; font-weight: bold; line-height: 1.5; font-family: 'courier new', courier, monospace; ">zipalign</code>. It's ready for installation and distribution.</p>ant release后会生成一个<em style="color: #006600; font-family: 'courier new', courier, monospace; font-weight: bold; background-color: #f9f9f9; ">&lt;your_project_name&gt;</em><span style="color: #006600; font-family: 'courier new', courier, monospace; font-weight: bold; background-color: #f9f9f9; ">-release.apk</span>的版本<br /><br /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">啊，世界清静了~~~&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">最后就是安装了。&nbsp;</span><br style="word-wrap: break-word; line-height: normal; font-family: Helvetica, Arial, sans-serif; background-color: #ffffff; " /><span style="font-family: Helvetica, Arial, sans-serif; line-height: 22.383333206176758px; background-color: #ffffff; ">由于使用了新的签名，必须先卸载原来安装的程序才可以安装。</span>&nbsp;<br /><br /><br />/////////////////////////////////////////////////////////////////////////////////////////////////////////////<br /><br />常见问题：<br />生成的debug和release有什么区别 大小差不多<br /><br /><a href="http://developer.android.com/sdk/tools-notes.html" rel="nofollow" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; background-color: #eeeeee; color: #4a6b82; text-decoration: none; cursor: pointer; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px; ">Support for a true debug build</a><span style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; line-height: 18px; background-color: #eeeeee; ">. Developers no longer need to add the android:debuggable attribute to the tag in the manifest &#8212; the build tools add the attribute automatically. In Eclipse/ADT, all incremental builds are assumed to be debug builds, so the tools insert <strong>android:debuggable="true"</strong>. When exporting a signed release build, the tools do not add the attribute. In Ant, a ant debug command automatically inserts the android:debuggable="true" attribute, while ant release does not. If android:debuggable="true" is manually set, then ant release will actually do a debug build, rather than a release build.</span>&nbsp;<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><img src ="http://www.cppblog.com/wc250en007/aggbug/187250.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wc250en007/" target="_blank">Let me see see</a> 2012-08-15 10:11 <a href="http://www.cppblog.com/wc250en007/archive/2012/08/15/187250.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android Push Notification实现信息推送使用</title><link>http://www.cppblog.com/wc250en007/archive/2012/08/08/186668.html</link><dc:creator>Let me see see</dc:creator><author>Let me see see</author><pubDate>Wed, 08 Aug 2012 10:38:00 GMT</pubDate><guid>http://www.cppblog.com/wc250en007/archive/2012/08/08/186668.html</guid><wfw:comment>http://www.cppblog.com/wc250en007/comments/186668.html</wfw:comment><comments>http://www.cppblog.com/wc250en007/archive/2012/08/08/186668.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wc250en007/comments/commentRss/186668.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wc250en007/services/trackbacks/186668.html</trackback:ping><description><![CDATA[<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><strong style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; vertical-align: baseline; font-weight: bold; padding-top: 0px">本文介绍AndroidPn项目实现推送的使用过程。</strong></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">上个博文中提到在Android中实现信息推送，其中一个比较成熟的解决方案便是使用XMPP协议实现。而AndroidPn项目就是使用XMPP协议实现信息推送的一个开源项目。在这里给大家介绍其使用过程。<span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; vertical-align: baseline; padding-top: 0px" id="more-558"></span></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><strong style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; vertical-align: baseline; font-weight: bold; padding-top: 0px">Apndroid Push Notification的特点：&nbsp;</strong></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">快速集成:提供一种比C2DM更加快捷的使用方式,避免各种限制.</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">无需架设服务器:通过使用"云服务",减少额外服务器负担.</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">可以同时推送消息到网站页面,android 手机</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">耗电少,占用流量少.</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><strong style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; vertical-align: baseline; font-weight: bold; padding-top: 0px">具体配置过程：&nbsp;</strong></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">首先， 我们需要下载androidpn-client-0.5.0.zip和androidpn-server-0.5.0-bin.zip。</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">下载地址：<a style="border-bottom: rgb(104,153,23) 1px dotted; padding-bottom: 1px; border-right-width: 0px; padding-left: 2px; padding-right: 2px; border-top-width: 0px; color: rgb(103,166,17); border-left-width: 0px; text-decoration: none; padding-top: 1px; -webkit-transition: color 0.3s linear" href="http://sourceforge.net/projects/androidpn/">http://sourceforge.net/projects/androidpn/</a></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">解压两个包，Eclipse导入client，配置好目标平台，打开raw/androidpn.properties文件，配置客户端程序。</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">1.&nbsp;如果是模拟器来运行客户端程序,把xmppHost配置成10.0.2.2[模拟器把10.0.2.2认为是所在主机的地址，127.0.0.1是模拟器本身的回环地址，10.0.2.1表示网关地址，10.0.2.3表示DNS地址，10.0.2.15表示目标设备的网络地址]，关于模拟器的详细信息，大家可参阅相关资料，这里不再详述.</p>
<div style="padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); vertical-align: baseline; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">xmppPort=5222 是服务器的xmpp服务监听端口</div>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<div style="padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); vertical-align: baseline; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">运行androidpn-server-0.5.0\bin\run.bat启动服务器，从浏览器访问http://127.0.0.1:7070/index.do (androidPN Server有个轻量级的web服务器，在7070端口监听请求，接受用户输入的文本消息)</div>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<div style="padding-bottom: 0px; widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); vertical-align: baseline; word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">运行客户端，客户端会向服务器发起连接请求，注册成功后，服务器能识别客户端，并维护和客户端的IP长连接。</div>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><strong style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; vertical-align: baseline; font-weight: bold; padding-top: 0px">2.&nbsp;如果是在同一个局域网内的其他机器的模拟器测试(或者使用同一无线路由器wifi上网的真机) ，则需要把这个值设置为服务器机器的局域网ip.&nbsp; &nbsp;</strong></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><strong style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; vertical-align: baseline; font-weight: bold; padding-top: 0px">例如 你的电脑和android手机 都通过同一个无线路由器wifi上网, 电脑的ip地址为 192.168.1.2 而 手机的ip地址为 192.168.1.3, 这个时候 需要把这个值修改为 xmppHost=192.168.1.1 或是电脑的IP地址，就可以在手机上使用了.&nbsp;</strong></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">3. 如果是不在同一个局域网的真机测试，我们需要将这个值设置为服务器的IP地址。</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><strong style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; vertical-align: baseline; font-weight: bold; padding-top: 0px">具体配置如下图所示：</strong></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><img style="border-bottom: 0px; border-left: 0px; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline-block; max-width: 610px; height: auto; vertical-align: text-bottom; border-top: 0px; border-right: 0px; padding-top: 0px" border="0" alt="" src="http://images.cnblogs.com/cnblogs_com/hanyonglu/2012-03-16_081017.png" /></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><strong style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; vertical-align: baseline; font-weight: bold; padding-top: 0px">我的电脑IP是：192.168.8.107&nbsp;</strong></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">服务器运行主界面：</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><img style="border-bottom: 0px; border-left: 0px; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline-block; max-width: 610px; height: auto; vertical-align: text-bottom; border-top: 0px; border-right: 0px; padding-top: 0px" border="0" alt="" src="http://images.cnblogs.com/cnblogs_com/hanyonglu/2012-03-16_074350.png" /></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><img style="border-bottom: 0px; border-left: 0px; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline-block; max-width: 610px; height: auto; vertical-align: text-bottom; border-top: 0px; border-right: 0px; padding-top: 0px" border="0" alt="" src="http://images.cnblogs.com/cnblogs_com/hanyonglu/2012-03-16_074433.png" width="797" height="310" /></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><img style="border-bottom: 0px; border-left: 0px; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline-block; max-width: 610px; height: auto; vertical-align: text-bottom; border-top: 0px; border-right: 0px; padding-top: 0px" border="0" alt="" src="http://images.cnblogs.com/cnblogs_com/hanyonglu/2012-03-16_074420.png" width="797" height="306" /></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">推送信息：</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><img style="border-bottom: 0px; border-left: 0px; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline-block; max-width: 610px; height: auto; vertical-align: text-bottom; border-top: 0px; border-right: 0px; padding-top: 0px" border="0" alt="" src="http://images.cnblogs.com/cnblogs_com/hanyonglu/2012-03-16_074154.png" width="798" height="481" /></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">测试结果如下图：</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><img style="border-bottom: 0px; border-left: 0px; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline-block; max-width: 610px; height: auto; vertical-align: text-bottom; border-top: 0px; border-right: 0px; padding-top: 0px" border="0" alt="" src="http://images.cnblogs.com/cnblogs_com/hanyonglu/SC20120316-074221.png" width="480" height="800" /></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><img style="border-bottom: 0px; border-left: 0px; padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline-block; max-width: 610px; height: auto; vertical-align: text-bottom; border-top: 0px; border-right: 0px; padding-top: 0px" border="0" alt="" src="http://images.cnblogs.com/cnblogs_com/hanyonglu/SC20120316-074227.png" /></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">模拟器和真机测试通过。</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><strong style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; vertical-align: baseline; font-weight: bold; padding-top: 0px">其他使用过程介绍：</strong></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">当然了，以上是在自己的服务器上配置并实现信息推送，如果大家想省事的话，在这里给大家推荐个网址，&nbsp;可以更轻松地实现推送，缺点是需要通过别人的服务器，关于这点，你懂的。</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">网址：&nbsp;<a style="border-bottom: rgb(104,153,23) 1px dotted; padding-bottom: 1px; border-right-width: 0px; padding-left: 2px; padding-right: 2px; border-top-width: 0px; color: rgb(103,166,17); border-left-width: 0px; text-decoration: none; padding-top: 1px; -webkit-transition: color 0.3s linear" href="http://www.push-notification.org/">http://www.push-notification.org/</a></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">只需申请个API即可使用。</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">&nbsp;</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">至于其他的推送方案会在以后的博文中介绍。</p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">完毕。<br />原文地址：<a href="http://www.cnblogs.com/hanyonglu/archive/2012/03/16/2399655.html">http://www.cnblogs.com/hanyonglu/archive/2012/03/16/2399655.html</a><br />////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br /><span style="color: red">新手常见问题：</span><br />解压两个包，Eclipse导入client，配置好目标平台编译，出现问题</p>
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" /><span style="color: #000000">E</span><span style="color: #000000">/</span><span style="color: #000000">AndroidRuntime(</span><span style="color: #000000">13171</span><span style="color: #000000">):&nbsp;FATAL&nbsp;EXCEPTION:&nbsp;main<br /><img align="top" src="http://www.cppblog.com/images/OutliningIndicators/None.gif"  alt="" />E</span><span style="color: #000000">/</span><span style="color: #000000">AndroidRuntime(</span><span style="color: #000000">13678</span><span style="color: #000000">):&nbsp;java.lang.NoClassDefFoundError:<br />&nbsp; ....</span></div>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px">出现上述调试信息，并且真机上出现错误，在虚拟机上也出现错误<br />原因：代码依赖于其他库<br />解决办法：要在具体project上右键属性，在java build path里的order and export里把要编译的包文件前打勾。然后再clean该工程，刷新再运行就可以了。<br /></p>
<p style="widows: 2; text-transform: none; background-color: rgb(240,240,240); text-indent: 0px; margin: 10px 0px; font: 300 13px/26px 'Century Gothic', 'Microsoft YaHei', 'Trebuchet MS', Arial, Verdana, Tahoma, 'DejaVu Sans', 'Liberation sans', 'Bitstream Vera Sans', sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(34,34,34); word-spacing: 0px; -webkit-text-size-adjust: none; -webkit-text-stroke-width: 0px"><br />&nbsp;</p><img src ="http://www.cppblog.com/wc250en007/aggbug/186668.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wc250en007/" target="_blank">Let me see see</a> 2012-08-08 18:38 <a href="http://www.cppblog.com/wc250en007/archive/2012/08/08/186668.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>45度斜角地图菱形坐标转换</title><link>http://www.cppblog.com/wc250en007/archive/2012/07/20/184285.html</link><dc:creator>Let me see see</dc:creator><author>Let me see see</author><pubDate>Fri, 20 Jul 2012 00:12:00 GMT</pubDate><guid>http://www.cppblog.com/wc250en007/archive/2012/07/20/184285.html</guid><wfw:comment>http://www.cppblog.com/wc250en007/comments/184285.html</wfw:comment><comments>http://www.cppblog.com/wc250en007/archive/2012/07/20/184285.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wc250en007/comments/commentRss/184285.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wc250en007/services/trackbacks/184285.html</trackback:ping><description><![CDATA[<span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">我们要做一个45度游戏地图中，那么如何判断鼠标点中了哪一个碎片呢？？如图：</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><ignore_js_op style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span class="Apple-converted-space">&nbsp;<img style="width: 189px; height: 117px" border="0" alt="" src="http://www.cppblog.com/images/cppblog_com/wc250en007/D3D/1.jpg" width="189" height="117" /></span></ignore_js_op><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">也许你想到通过解两个直线方程（点斜式）：<br /></span><img border="0" alt="" src="http://www.cppblog.com/images/cppblog_com/wc250en007/D3D/2.jpg" /><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><ignore_js_op style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span class="Apple-converted-space">&nbsp;</span></ignore_js_op><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">不过这是个笨办法，那么有更简单的办法吗？</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">开门见山：</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">***********************************</span><font style="widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; font-family: Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); font-weight: normal; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" size="3"><br style="word-wrap: break-word" />N=int(x/TileW - y/TileH)<br style="word-wrap: break-word" />M=int(x/TileW + y/TileH)</font><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">***********************************</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">N,M是碎片的索引，从0开始。</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">TileW,TileH是碎片的长宽。</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">x,y是鼠标坐标，但是注意坐标系原点。</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">以上过程如下图演示：</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><ignore_js_op style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span class="Apple-converted-space">&nbsp;<img border="0" alt="" src="http://www.cppblog.com/images/cppblog_com/wc250en007/D3D/3.jpg" width="347" height="302" /></span></ignore_js_op><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">那么，是什么原理呢？</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">我们建立一个新的坐标系。以花体字的u,v为新的基向量。<br /><img border="0" alt="" src="http://www.cppblog.com/images/cppblog_com/wc250en007/D3D/4.jpg" width="499" height="347" /></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><ignore_js_op style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span class="Apple-converted-space">&nbsp;</span></ignore_js_op><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">然后把鼠标坐标（注意原点！）(x,y)转换成基于新的基集t={u,v}的展开式：</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><ignore_js_op style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span class="Apple-converted-space">&nbsp;</span></ignore_js_op><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><img border="0" alt="" src="http://www.cppblog.com/images/cppblog_com/wc250en007/D3D/5.jpg" width="499" height="347" /><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">使用的时候很简单</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">公式是</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(68,68,68); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" />
<div style="background-image: url(http://www.webgamei.com/club/static/image/common/codebg.gif); border-bottom: rgb(204,204,204) 1px solid; border-left: rgb(204,204,204) 1px solid; padding-bottom: 5px; widows: 2; text-transform: none; background-color: rgb(247,247,247); text-indent: 0px; margin: 10px 0px; padding-left: 10px; padding-right: 0px; zoom: 1; font: 14px/21px Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; white-space: normal; background-position: 0px 0px; orphans: 2; letter-spacing: normal; color: rgb(102,102,102); overflow: hidden; border-top: rgb(204,204,204) 1px solid; border-right: rgb(204,204,204) 1px solid; word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="blockcode">
<div style="word-wrap: break-word" id="code_OMZ">
<ol style="padding-bottom: 0px !important; margin: 0px 0px 0px 10px; padding-left: 0px !important; padding-right: 0px !important; word-wrap: break-word; padding-top: 0px !important"><li style="padding-bottom: 0px; line-height: 1.8em; list-style-type: decimal-leading-zero; margin: 0px 0px 0px 2em; padding-left: 10px; padding-right: 0px; font-family: Monaco, Consolas, ''Lucida Console'', ''Courier New'', serif; word-wrap: break-word; font-size: 12px; padding-top: 0px">N=int(x/TileW - y/TileH)<br style="word-wrap: break-word" /></li><li style="padding-bottom: 0px; line-height: 1.8em; list-style-type: decimal-leading-zero; margin: 0px 0px 0px 2em; padding-left: 10px; padding-right: 0px; font-family: Monaco, Consolas, ''Lucida Console'', ''Courier New'', serif; word-wrap: break-word; font-size: 12px; padding-top: 0px">M=int(x/TileW + y/TileH)</li></ol></div></div><br /><br />------------------------------------------------------------------------------------------------------------<br />下面说的是45度地图，地图坐标系在顶端的格子计算方法<br />
<p>关于45度角地图中像素坐标和地图坐标之间的转换，网上有各种方法，其实坐标转换就是计算tite宽和tile高在像素坐标中的偏移值，本方法是针对 tite块原点坐标在菱形的顶点的位置的坐标转换，在45度角地图中，方块形状为菱形，你可以用flash cs工具或其他绘图工具很快的创建出这种菱形方块，按以下3个步骤就可以了：<br />1、 绘制一个任意大小的正方形；<br />2、 把这个正方形旋转45度；<br />3、 把旋转的正方形的高度缩放为原来的50%。<br />还有一点就是方块尺寸的问题，菱形方块的宽度是高度的2倍，其次方块尺寸比例应该是2：1。例如64像素X 32像素或100像素 X 50像素等，这样的尺寸刚好能使方块在地图铺设的时候很好地排列在屏幕上。<br />至于坐标间的转换其实大家看图就好理解了：</p>
<p><img border="0" alt="" src="http://www.cppblog.com/images/cppblog_com/wc250en007/D3D/6.jpg" width="401" height="221" /><br />图中是一个以红色(0,0)位置为原点，红点每向地图坐标系M轴上移动一个单位，原点相对像素坐标系X中的偏移值为:方块宽度/2<br />菱形方块宽 var tileW :Number;<br />菱形方块高 var tileH :Number;<br />地图的行数 var row :int;<br />地图的列数 var col :int;<br />红色原点坐标(像素坐标系) var originP : Point;<br />那么红色的原点坐标在地图坐标系中的位置为：<br />originP.x = row * tileW /2;<br />originP.y = 0;<br />原点坐标出来了，那么其它点的坐标呢？<br />思路是先求出在地图坐标系下(M方向或N方向)每移动一个单位的像素坐标系X轴和像素坐标系Y轴的像素偏移值。<br />如红色原点移动到黑色点的位置：<br />M在像素坐标系X轴的偏移像素 = tileW /2;（向右偏移）<br />M在像素坐标系Y轴的偏移像素 = tileH /2; （向下偏移）<br />N在像素坐标系X轴的偏移像素 = - tileW /2;（向左偏移）<br />N在像素坐标系Y轴的偏移像素 = tileH /2; （向下偏移）<br />假如有个地图坐标点（M，N），那么它对应的像素坐标系的点为var p:Point<br />p.x = 原点坐标X + M在像素坐标系X轴的偏移像素 &#215; M + N在像素坐标系X轴的偏移像素 &#215; N = originP.x + tileW /2 &#215; M + （-tileW/2） &#215; N = originP.x + (M &#8211; N) &#215; tileW/2；<br />p.y = 原点坐标Y + M在像素坐标系Y轴的偏移像素 &#215; M + N在像素坐标系Y轴的偏移像素 &#215; N = originP.y + tileH/2 &#215; M + tileH/2 &#215; N = originP.y + (M + N) &#215; tileH/2;<br /><br />原文地址：<a href="http://blog.sina.com.cn/s/blog_6807f539010103ce.html">http://blog.sina.com.cn/s/blog_6807f539010103ce.html</a></p><img src ="http://www.cppblog.com/wc250en007/aggbug/184285.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wc250en007/" target="_blank">Let me see see</a> 2012-07-20 08:12 <a href="http://www.cppblog.com/wc250en007/archive/2012/07/20/184285.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cocos2d-x学习资料汇总</title><link>http://www.cppblog.com/wc250en007/archive/2012/07/12/183002.html</link><dc:creator>Let me see see</dc:creator><author>Let me see see</author><pubDate>Thu, 12 Jul 2012 07:35:00 GMT</pubDate><guid>http://www.cppblog.com/wc250en007/archive/2012/07/12/183002.html</guid><wfw:comment>http://www.cppblog.com/wc250en007/comments/183002.html</wfw:comment><comments>http://www.cppblog.com/wc250en007/archive/2012/07/12/183002.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wc250en007/comments/commentRss/183002.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wc250en007/services/trackbacks/183002.html</trackback:ping><description><![CDATA[<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px" data-scaytid="1" data-scayt_word="我之前一直学习c＋＋的，第一次接触cocos2d是oc版的，虽然很好用，但是，我还是对c＋＋情有独钟，再加之cocos2d-x由自己人主导，更应该拥抱她，热爱她，把她发扬光大。之后，我将会全面投入cocos2d-x的怀抱，欢迎大家和我交流，一起学习。">我之前一直学习c＋＋的，第一次接触cocos2d是oc版的，虽然很好用，但是，我还是对c＋＋情有独钟，再加之cocos2d-x由自己人主导，更应该拥抱她，热爱她，把她发扬光大。之后，我将会全面投入cocos2d-x的怀抱，欢迎大家和我交流，一起学习。</span></p>
<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px" data-scaytid="2" data-scayt_word="补充一点：我选择cocos2d-x决不是简单地支持国产这么简单，cocos2d-x真的很强大。关于游戏引擎如何选择的问题，请大家看这个帖子。">补充一点：我选择cocos2d-x决不是简单地支持国产这么简单，cocos2d-x真的很强大。关于游戏引擎如何选择的问题，请大家看<a style="padding-bottom: 0px; font-style: normal; margin: 0px; padding-left: 0px; padding-right: 0px; letter-spacing: normal; color: rgb(41,113,167); font-size: 14px; cursor: pointer; text-decoration: none; padding-top: 0px" href="http://www.cocoachina.com/bbs/read.php?tid=93334" target="_blank">这个帖子</a>。</span></p>
<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px" data-scaytid="3" data-scayt_word="下面列出的链接排名不分先后，呵呵，不一定要按顺序读。具体如何读，以后摸熟悉了再跟大家分享。">下面列出的链接排名不分先后，呵呵，不一定要按顺序读。具体如何读，以后摸熟悉了再跟大家分享。</span></p>
<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px" data-scaytid="4" data-scayt_word="ps：这些链接的来源是google＋四个群里面的开发者贡献，由我整理而成，如果有遗漏的地方，欢迎大家补充啊。">ps：这些链接的来源是google＋四个群里面的开发者贡献，由我整理而成，如果有遗漏的地方，欢迎大家补充啊。</span></p>
<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px" data-scaytid="5" data-scayt_word="还有，希望有学习或者正在使用cocos2d-x的朋友，如果你们有博客，也请在评论里面留下你们的脚印，相互学习，共同进步，谢啦。">还有，希望有学习或者正在使用cocos2d-x的朋友，如果你们有博客，也请在评论里面留下你们的脚印，相互学习，共同进步，谢啦。</span></p>
<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">0.<a style="padding-bottom: 0px; font-style: normal; margin: 0px; padding-left: 0px; padding-right: 0px; letter-spacing: normal; color: rgb(41,113,167); font-size: 14px; cursor: pointer; text-decoration: none; padding-top: 0px" href="http://www.supersuraccoon-cocos2d.com/zh/2012/02/11/sticky-ios-cocos2d-develop-recommended-blog-list-keep-updating/" target="_blank">http://www.supersuraccoon-cocos2d.com/<span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px" data-scaytid="6" data-scayt_word="zh">zh</span>/2012/02/11/<span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px" data-scaytid="7" data-scayt_word="sticky-ios-cocos2d-develop-recommended-blog-list-keep-updating">sticky-ios-cocos2d-develop-recommended-blog-list-keep-updating</span>/</a>(It's amazing!Thank you&nbsp;<a style="padding-bottom: 0px; font-style: normal; margin: 0px; padding-left: 0px; padding-right: 0px; letter-spacing: normal; color: rgb(41,113,167); font-size: 14px; cursor: pointer; text-decoration: none; padding-top: 0px" href="http://www.supersuraccoon-cocos2d.com/zh/2012/02/11/sticky-ios-cocos2d-develop-recommended-blog-list-keep-updating/" target="_blank"><span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px" data-scaytid="8" data-scayt_word="supersuraccoon">supersuraccoon</span></a>!)</p>
<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">1.<a style="padding-bottom: 0px; font-style: normal; margin: 0px; padding-left: 0px; padding-right: 0px; letter-spacing: normal; color: rgb(41,113,167); font-size: 14px; cursor: pointer; text-decoration: none; padding-top: 0px" href="http://blog.csdn.net/column/details/cocos2d-x.html" target="_blank">csdn的cocos2d-x开发专栏</a>。</p>
<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">2.<a style="padding-bottom: 0px; font-style: normal; margin: 0px; padding-left: 0px; padding-right: 0px; letter-spacing: normal; color: rgb(41,113,167); font-size: 14px; cursor: pointer; text-decoration: none; padding-top: 0px" href="http://blog.csdn.net/column/details/cocos2d-x-study.html" target="_blank">csdn的cocos2d-x入门专栏。</a></p>
<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">3.<a style="padding-bottom: 0px; font-style: normal; margin: 0px; padding-left: 0px; padding-right: 0px; letter-spacing: normal; color: rgb(41,113,167); font-size: 14px; cursor: pointer; text-decoration: none; padding-top: 0px" href="http://blog.csdn.net/xiaominghimi/article/category/921752" target="_blank">himi的cocos2d-x游戏开发</a><span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px" data-scaytid="9" data-scayt_word="（这个链接是csdn的，大家可以去关注himi的新个人主页）">（这个链接是csdn的，大家可以去关注himi的新个人主页）</span></p>
<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">4.<a style="padding-bottom: 0px; font-style: normal; margin: 0px; padding-left: 0px; padding-right: 0px; letter-spacing: normal; color: rgb(41,113,167); font-size: 14px; cursor: pointer; text-decoration: none; padding-top: 0px" href="http://4137613.blog.51cto.com/" target="_blank">老G的blog</a></p>
<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">5.<a style="padding-bottom: 0px; font-style: normal; margin: 0px; padding-left: 0px; padding-right: 0px; letter-spacing: normal; color: rgb(41,113,167); font-size: 14px; cursor: pointer; text-decoration: none; padding-top: 0px" href="http://www.cocoachina.com/special/cocos2d-x/" target="_blank">cocoaChina上面的汇总帖</a>（这个汇总帖涵盖了api、wiki、相关文档和一些开发者博客。值得收藏）</p>
<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">6.<a style="padding-bottom: 0px; font-style: normal; margin: 0px; padding-left: 0px; padding-right: 0px; letter-spacing: normal; color: rgb(41,113,167); font-size: 14px; cursor: pointer; text-decoration: none; padding-top: 0px" href="http://blog.csdn.net/maojudong/article/details/7261986" target="_blank">搭建cocos2d-x-android环境 Windows<span class="Apple-converted-space">&nbsp;</span><span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px" data-scaytid="10" data-scayt_word="XP3">XP3</span><span class="Apple-converted-space">&nbsp;</span>+ Eclipse +<span class="Apple-converted-space">&nbsp;</span><span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px" data-scaytid="11" data-scayt_word="NDKR7">NDKR7</span>+<span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px" data-scaytid="12" data-scayt_word="COCOS2DX">COCOS2DX</span>(<span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px" data-scaytid="13" data-scayt_word="没有用到cygwin和minigw">没有用到cygwin和minigw</span>)</a></p>
<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">7.<a style="padding-bottom: 0px; font-style: normal; margin: 0px; padding-left: 0px; padding-right: 0px; letter-spacing: normal; color: rgb(41,113,167); font-size: 14px; cursor: pointer; text-decoration: none; padding-top: 0px" href="http://blog.csdn.net/yuanhong2910/article/details/7030289" target="_blank">cocos2d-x 编译 Anroid版本遇到的问题以及解决办法</a></p>
<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">8.<span style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">&nbsp;</span><a style="padding-bottom: 0px; font-style: normal; margin: 0px; padding-left: 0px; padding-right: 0px; letter-spacing: normal; color: rgb(41,113,167); font-size: 14px; cursor: pointer; text-decoration: none; padding-top: 0px" href="http://blog.csdn.net/dragoncheng/article/details/7070291" target="_blank">cocos2d-x添加广告条（BADA版本）</a>（上面写了很多关于lua的文章）</p>
<p style="padding-bottom: 10px; widows: 2; text-transform: none; background-color: rgb(249,249,249); text-indent: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; font: 14px/25px Simsun; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(51,51,51); word-spacing: 0px; padding-top: 10px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">9.<a style="padding-bottom: 0px; font-style: normal; margin: 0px; padding-left: 0px; padding-right: 0px; letter-spacing: normal; color: rgb(41,113,167); font-size: 14px; cursor: pointer; text-decoration: none; padding-top: 0px" href="http://blog.plicatibu.com/category/cocos2d/" target="_blank">http://blog.plicatibu.com/category/cocos2d/</a></p><img src ="http://www.cppblog.com/wc250en007/aggbug/183002.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wc250en007/" target="_blank">Let me see see</a> 2012-07-12 15:35 <a href="http://www.cppblog.com/wc250en007/archive/2012/07/12/183002.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cocos2d box2d 基础 知识 创建人物、金币、碰撞 检测</title><link>http://www.cppblog.com/wc250en007/archive/2012/07/12/183001.html</link><dc:creator>Let me see see</dc:creator><author>Let me see see</author><pubDate>Thu, 12 Jul 2012 07:33:00 GMT</pubDate><guid>http://www.cppblog.com/wc250en007/archive/2012/07/12/183001.html</guid><wfw:comment>http://www.cppblog.com/wc250en007/comments/183001.html</wfw:comment><comments>http://www.cppblog.com/wc250en007/archive/2012/07/12/183001.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wc250en007/comments/commentRss/183001.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wc250en007/services/trackbacks/183001.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 原文地址：http://blog.csdn.net/a8467562/article/details/75804431 ： 首先 是 构建 世界 ，即b2World 你也可能用到 debug 调试：GLESDebugDraw&nbsp;b2Vec2&nbsp;gravity;gravity.Set(0.0f, -9.8f);_world&nbsp;=&nbsp;new&nbsp...&nbsp;&nbsp;<a href='http://www.cppblog.com/wc250en007/archive/2012/07/12/183001.html'>阅读全文</a><img src ="http://www.cppblog.com/wc250en007/aggbug/183001.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wc250en007/" target="_blank">Let me see see</a> 2012-07-12 15:33 <a href="http://www.cppblog.com/wc250en007/archive/2012/07/12/183001.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cocos2d-x工具集合</title><link>http://www.cppblog.com/wc250en007/archive/2012/07/12/182996.html</link><dc:creator>Let me see see</dc:creator><author>Let me see see</author><pubDate>Thu, 12 Jul 2012 06:56:00 GMT</pubDate><guid>http://www.cppblog.com/wc250en007/archive/2012/07/12/182996.html</guid><wfw:comment>http://www.cppblog.com/wc250en007/comments/182996.html</wfw:comment><comments>http://www.cppblog.com/wc250en007/archive/2012/07/12/182996.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wc250en007/comments/commentRss/182996.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wc250en007/services/trackbacks/182996.html</trackback:ping><description><![CDATA[<h1 style="padding-bottom: 1px; line-height: normal; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 6px 0px 10px; padding-left: 0px; padding-right: 10px; font-family: Verdana, Arial, 'Times New Roman', serif; white-space: normal; orphans: 2; border-bottom-width: 0px; letter-spacing: -1px; color: rgb(96,96,96); font-size: 20px; word-spacing: 0px; padding-top: 2px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Editors for cocos2d-x Texture,Tilemap,Particle,Action,Level etc</h1>
<p><a style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(42,86,133); word-spacing: 0px; text-decoration: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" name="Action-Editor"></a></p>
<p>推荐地址：<a href="http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Editors_for_cocos2d-x_TextureTilemapParticleActionLevel_etc">http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Editors_for_cocos2d-x_TextureTilemapParticleActionLevel_etc</a></p><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></span>
<h2 style="padding-bottom: 1px; line-height: normal; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 6px 0px 10px; padding-left: 0px; padding-right: 10px; font-family: Verdana, Arial, 'Times New Roman', serif; white-space: normal; orphans: 2; border-bottom-width: 0px; letter-spacing: -1px; color: rgb(96,96,96); font-size: 16px; word-spacing: 0px; padding-top: 2px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Action Editor</h2>
<ul style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><li>SpriteHelper &amp; LevelHelper 
<ul><li><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://spritehelper.wordpress.com/">Author's blog</a></li><li>Download from Mac Store 
<ul><li><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://itunes.apple.com/sg/app/spritehelperfree/id421369850?mt=12">SpriteHelperFree</a></li><li><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://itunes.apple.com/us/app/spritehelper/id416068717?mt=12">SpriteHelper</a></li><li><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://itunes.apple.com/us/app/levelhelper/id421740820?mt=12">LevelHelper</a></li></ul></li><li>"Video" 
<ul><li>Youtube:<span class="Apple-converted-space">&nbsp;</span><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://www.youtube.com/watch?v=YoVMSuwsATk">http://www.youtube.com/watch?v=YoVMSuwsATk</a></li><li>Youku:<span class="Apple-converted-space">&nbsp;</span><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://v.youku.com/v_show/id_XMjU2NjU1OTIw.html">http://v.youku.com/v_show/id_XMjU2NjU1OTIw.html</a></li></ul></li><li>News on cocos2d-x:<span class="Apple-converted-space">&nbsp;</span><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://www.cocos2d-x.org/news/14">http://www.cocos2d-x.org/news/14</a></li></ul></li></ul>
<ul style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><li>CocosBuilder:<span class="Apple-converted-space">&nbsp;</span><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://cocosbuilder.com/">http://cocosbuilder.com/</a><span class="Apple-converted-space">&nbsp;</span>(can only be used in ios games)</li><li>CocoShop:<span class="Apple-converted-space">&nbsp;</span><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://www.cocos2d-iphone.org/forum/topic/15668">http://www.cocos2d-iphone.org/forum/topic/15668</a><span class="Apple-converted-space">&nbsp;</span>(can only be used in ios games)</li></ul><a style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(42,86,133); word-spacing: 0px; text-decoration: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" name="Map-Editor"></a><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></span>
<h2 style="padding-bottom: 1px; line-height: normal; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 6px 0px 10px; padding-left: 0px; padding-right: 10px; font-family: Verdana, Arial, 'Times New Roman', serif; white-space: normal; orphans: 2; border-bottom-width: 0px; letter-spacing: -1px; color: rgb(96,96,96); font-size: 16px; word-spacing: 0px; padding-top: 2px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Map Editor</h2>
<ul style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><li><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://www.mapeditor.org/">Tiled Map Editor</a><span class="Apple-converted-space">&nbsp;</span>, free, cross platform, based on QT or Java, output TMX file</li></ul>
<ul style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><li>"iTileMaps" 
<ul><li>iTunes link:<span class="Apple-converted-space">&nbsp;</span><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://itunes.apple.com/us/app/itilemaps/id432784227?mt=8">http://itunes.apple.com/us/app/itilemaps/id432784227?mt=8</a></li><li>more info at:<span class="Apple-converted-space">&nbsp;</span><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://www.klemix.com/">http://www.klemix.com/</a></li></ul></li></ul>
<ul style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><li>CHN Tutorials 
<ul><li><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://unclemao.orzstudio.com/programming/iphone/topic-375.html">译 - 在Tiled Map中使用碰撞检测(一) 创建基于Tiled Map的游戏</a></li><li><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://unclemao.orzstudio.com/programming/iphone/topic-403.html">译 - 在Tiled Map中使用碰撞检测(二) TMX地图中的碰撞检测</a></li></ul></li></ul><a style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(42,86,133); word-spacing: 0px; text-decoration: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" name="SpriteSheet-Editor"></a><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></span>
<h2 style="padding-bottom: 1px; line-height: normal; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 6px 0px 10px; padding-left: 0px; padding-right: 10px; font-family: Verdana, Arial, 'Times New Roman', serif; white-space: normal; orphans: 2; border-bottom-width: 0px; letter-spacing: -1px; color: rgb(96,96,96); font-size: 16px; word-spacing: 0px; padding-top: 2px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">SpriteSheet Editor</h2>
<ul style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><li><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://www.zwoptexapp.com/">Zwoptex v1.0</a><span class="Apple-converted-space">&nbsp;</span>, free, OSX only, output .png &amp; .plist file</li></ul><a style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(42,86,133); word-spacing: 0px; text-decoration: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" name="Particle-Editor"></a><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></span>
<h2 style="padding-bottom: 1px; line-height: normal; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 6px 0px 10px; padding-left: 0px; padding-right: 10px; font-family: Verdana, Arial, 'Times New Roman', serif; white-space: normal; orphans: 2; border-bottom-width: 0px; letter-spacing: -1px; color: rgb(96,96,96); font-size: 16px; word-spacing: 0px; padding-top: 2px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Particle Editor</h2>
<ul style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><li>Particle editor:<span class="Apple-converted-space">&nbsp;</span><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://particledesigner.71squared.com/">Particle Designer</a><span class="Apple-converted-space">&nbsp;</span>, OSX only, $8 for license, output .png &amp; ,plist file</li><li>Particle editor:<span class="Apple-converted-space">&nbsp;</span><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://code.google.com/p/cocos2d-windows-particle-editor/">cocos2d-windows-particle-editor</a><span class="Apple-converted-space">&nbsp;</span>, win only, free, output .png &amp; ,plist file</li></ul><a style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(42,86,133); word-spacing: 0px; text-decoration: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" name="Font-editor"></a><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></span>
<h2 style="padding-bottom: 1px; line-height: normal; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 6px 0px 10px; padding-left: 0px; padding-right: 10px; font-family: Verdana, Arial, 'Times New Roman', serif; white-space: normal; orphans: 2; border-bottom-width: 0px; letter-spacing: -1px; color: rgb(96,96,96); font-size: 16px; word-spacing: 0px; padding-top: 2px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Font editor:</h2>
<ul style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><li>Hiero (cross-platform):<span class="Apple-converted-space">&nbsp;</span><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://slick.cokeandcode.com/demos/hiero.jnlp">http://slick.cokeandcode.com/demos/hiero.jnlp</a><span class="Apple-converted-space">&nbsp;</span>(free)</li></ul><a style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(42,86,133); word-spacing: 0px; text-decoration: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" name="Texture-atlas-editor"></a><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></span>
<h2 style="padding-bottom: 1px; line-height: normal; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 6px 0px 10px; padding-left: 0px; padding-right: 10px; font-family: Verdana, Arial, 'Times New Roman', serif; white-space: normal; orphans: 2; border-bottom-width: 0px; letter-spacing: -1px; color: rgb(96,96,96); font-size: 16px; word-spacing: 0px; padding-top: 2px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Texture atlas editor:</h2>
<ul style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><li>TexturePacker (Windows, MacOSX):<span class="Apple-converted-space">&nbsp;</span><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://www.texturepacker.com/">http://www.texturepacker.com/</a><span class="Apple-converted-space">&nbsp;</span>(basic version is free, full version is $19.95)</li></ul><a style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(42,86,133); word-spacing: 0px; text-decoration: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" name="Physics-object-editor"></a><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></span>
<h2 style="padding-bottom: 1px; line-height: normal; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 6px 0px 10px; padding-left: 0px; padding-right: 10px; font-family: Verdana, Arial, 'Times New Roman', serif; white-space: normal; orphans: 2; border-bottom-width: 0px; letter-spacing: -1px; color: rgb(96,96,96); font-size: 16px; word-spacing: 0px; padding-top: 2px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Physics object editor:</h2>
<ul style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><li>PhysicsEditor (Windows, MacOSX):<span class="Apple-converted-space">&nbsp;</span><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://www.physicseditor.de/">http://www.physicseditor.de/</a><span class="Apple-converted-space">&nbsp;</span>(basic version is free, full version is $19.95)</li></ul><a style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(42,86,133); word-spacing: 0px; text-decoration: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" name="Font-editor"></a><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; display: inline !important; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; float: none; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></span>
<h2 style="padding-bottom: 1px; line-height: normal; widows: 2; text-transform: none; background-color: rgb(255,255,255); font-variant: normal; font-style: normal; text-indent: 0px; margin: 6px 0px 10px; padding-left: 0px; padding-right: 10px; font-family: Verdana, Arial, 'Times New Roman', serif; white-space: normal; orphans: 2; border-bottom-width: 0px; letter-spacing: -1px; color: rgb(96,96,96); font-size: 16px; word-spacing: 0px; padding-top: 2px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Font editor:</h2>
<ul style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; font: 12px Verdana, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(72,72,72); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"><li>Bitmap Font Generator:<span class="Apple-converted-space">&nbsp;</span><a style="background-image: url(http://files.cocos2d-x.org/images/external.png); padding-left: 12px; background-position: 0% 60%; color: rgb(42,86,133); text-decoration: none" class="external" href="http://www.angelcode.com/products/bmfont/">http://www.angelcode.com/products/bmfont/</a><span class="Apple-converted-space">&nbsp;</span>(free)</li></ul><img src ="http://www.cppblog.com/wc250en007/aggbug/182996.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wc250en007/" target="_blank">Let me see see</a> 2012-07-12 14:56 <a href="http://www.cppblog.com/wc250en007/archive/2012/07/12/182996.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> cocos2d-x 使用box2d来做碰撞检测（且仅用来做碰撞检测）(一)</title><link>http://www.cppblog.com/wc250en007/archive/2012/07/11/182858.html</link><dc:creator>Let me see see</dc:creator><author>Let me see see</author><pubDate>Wed, 11 Jul 2012 09:10:00 GMT</pubDate><guid>http://www.cppblog.com/wc250en007/archive/2012/07/11/182858.html</guid><wfw:comment>http://www.cppblog.com/wc250en007/comments/182858.html</wfw:comment><comments>http://www.cppblog.com/wc250en007/archive/2012/07/11/182858.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wc250en007/comments/commentRss/182858.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wc250en007/services/trackbacks/182858.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 本教程基于子龙山人翻译的cocos2d的IPHONE教程，用cocos2d-x for XNA引擎重写，加上我一些加工制作。教程中大多数文字图片都是原作者和翻译作者子龙山人，还有不少是我自己的理解和加工。感谢原作者的教程和子龙山人的翻译。本教程仅供学习交流之用，切勿进行商业传播。子龙山人翻译的Iphone教程地址：http://www.cnblogs.com/zilongshanren/a...&nbsp;&nbsp;<a href='http://www.cppblog.com/wc250en007/archive/2012/07/11/182858.html'>阅读全文</a><img src ="http://www.cppblog.com/wc250en007/aggbug/182858.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wc250en007/" target="_blank">Let me see see</a> 2012-07-11 17:10 <a href="http://www.cppblog.com/wc250en007/archive/2012/07/11/182858.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cocos2d-x环境配置</title><link>http://www.cppblog.com/wc250en007/archive/2012/07/06/181613.html</link><dc:creator>Let me see see</dc:creator><author>Let me see see</author><pubDate>Fri, 06 Jul 2012 02:21:00 GMT</pubDate><guid>http://www.cppblog.com/wc250en007/archive/2012/07/06/181613.html</guid><wfw:comment>http://www.cppblog.com/wc250en007/comments/181613.html</wfw:comment><comments>http://www.cppblog.com/wc250en007/archive/2012/07/06/181613.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/wc250en007/comments/commentRss/181613.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/wc250en007/services/trackbacks/181613.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: cocos2d-x是一个跨多个手机平台的开源游戏引擎（android ,iphone，wophone)，其官方网站：http://www.cocos2d-x.org/，其上都是用E文书写，可能有些人看得就云里雾里的，现就就在上面的环境搭建经验分享给大家，希望对大家有帮助（其实官网的wiki比较权威，而且全面，有疑惑也可以上去嚼E文，个人感觉还是挺易懂的^_^）。　&nbsp;一、引擎代码的...&nbsp;&nbsp;<a href='http://www.cppblog.com/wc250en007/archive/2012/07/06/181613.html'>阅读全文</a><img src ="http://www.cppblog.com/wc250en007/aggbug/181613.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/wc250en007/" target="_blank">Let me see see</a> 2012-07-06 10:21 <a href="http://www.cppblog.com/wc250en007/archive/2012/07/06/181613.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>