??xml version="1.0" encoding="utf-8" standalone="yes"?>精品国产乱码久久久久久1区2匹,日韩国产在线,亚洲激情avhttp://www.aygfsteel.com/demibug/zh-cnTue, 17 Jun 2025 18:15:05 GMTTue, 17 Jun 2025 18:15:05 GMT60PS 如何去除光晕的黑色背?/title><link>http://www.aygfsteel.com/demibug/archive/2013/03/20/396721.html</link><dc:creator>Hiji</dc:creator><author>Hiji</author><pubDate>Wed, 20 Mar 2013 04:19:00 GMT</pubDate><guid>http://www.aygfsteel.com/demibug/archive/2013/03/20/396721.html</guid><wfw:comment>http://www.aygfsteel.com/demibug/comments/396721.html</wfw:comment><comments>http://www.aygfsteel.com/demibug/archive/2013/03/20/396721.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/demibug/comments/commentRss/396721.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/demibug/services/trackbacks/396721.html</trackback:ping><description><![CDATA[<pre id="answer-content-675599077" accuse="aContent" mb-10"="" style="margin-top: 0px; margin-bottom: 10px; padding: 0px; font-family: arial, 'courier new', courier, 宋体, monospace; white-space: pre-wrap; word-wrap: break-word; color: #333333; line-height: 24px; background-color: #ffffff;">背景色是U黑的?<br />转到通道面板Q按住Ctrl+Shift键,依次点击U绿蓝三个通道Q得到光晕的选区。选中囑ֱQ按下Ctrl+J键,得到光晕囑ֱ。隐藏背景图层。此时的光晕包含有少量透明的黑底,因ؓ背景是黑Ԍ当把透明的光晕图层放到别的图层上Ӟ؜合模式改?#8220;滤色”卛_辑ֈ屏蔽黑色背景的目的?br />或者用背景皮擦,但是效果不是很好?/pre><img src ="http://www.aygfsteel.com/demibug/aggbug/396721.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/demibug/" target="_blank">Hiji</a> 2013-03-20 12:19 <a href="http://www.aygfsteel.com/demibug/archive/2013/03/20/396721.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cocos2d-x 2.0版本 自适应屏幕分L?/title><link>http://www.aygfsteel.com/demibug/archive/2013/03/13/396355.html</link><dc:creator>Hiji</dc:creator><author>Hiji</author><pubDate>Tue, 12 Mar 2013 17:25:00 GMT</pubDate><guid>http://www.aygfsteel.com/demibug/archive/2013/03/13/396355.html</guid><wfw:comment>http://www.aygfsteel.com/demibug/comments/396355.html</wfw:comment><comments>http://www.aygfsteel.com/demibug/archive/2013/03/13/396355.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/demibug/comments/commentRss/396355.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/demibug/services/trackbacks/396355.html</trackback:ping><description><![CDATA[<p style="color: #333333; background-color: #ffffff; margin-top: 0px; margin-bottom: 0px; padding: 5px 10px; line-height: 1.8; text-indent: 28px; font-family: Tahoma, Geneva, sans-serif;">我用的版本是cocos2d-2.0-x-2.0.4Qcocos2dx-2.0版本对多分L率适配提供了很好的支持Q用v来比1.0版本要简单些Q?.0版本的适配可以参?a target="_blank" style="color: #950000; text-decoration: initial;">q篇博文</a>?br />1. ?.0版本的适配首先需要了解下面这些知识?br /><span style="color: #993300;"><strong>(1)适配{略</strong></span><br />2.0版本提供了三U适配{略Q?br /><span style="color: #993300;">kResolutionNoBorderQ?/span>出屏幕的部分会被裁剪,两侧没有黑边Q铺满屏q,按图片原始比例显C,囄不变形?br /><span style="color: #993300;">kResolutionShowAllQ?/span>整个游戏界面是可见的Q会按原始比例进行羃放,囄不变形,但两侧可能会留有黑边Q不铺满屏幕?br /><span style="color: #993300;">kResolutionExactFitQ?/span>整个游戏界面是可见的Q图片可能会q行拉或者压~处理,铺满屏幕Q图片会变Ş?br />可以Ҏ自己的要求选择?br /><strong><span style="color: #993300;">(2)VisibleSize和VisibleOrigin</span></strong><br />getVisibleSizeQ表C得视?可视区域)的大,如果DesignResolutionSize跟屏q尺怸样大Q则getVisibleSize{于getWinSize?br />getVisibleOriginQ表C可视区域的L坐标Q这在处理相对位|的时候非常有用,保节点在不同分辨率下的位置一致?br /><strong><span style="color: #993300;">(3)DesignResolutionSize</span></strong><br />DesignResolutionSize是一个比较重要的概念Q其?.0版本的适配?.0版本原理差不多,都是按比例进行羃放。这个DesignResolutionSize表示设计ҎQ就是你的游戏完支持的分L率方案,一般根据图片资源的寸来定Q自适配时会按照q个分L率计出~放因子。因此,q个g应该是动态的Q如果是横屏游戏则高度肯定是铺满屏幕的,宽度也要可能的铺满屏幕Q因此应该选择宽高比最大的作ؓ设计分L率,下面的demo会给Z用方法?br /><strong><span style="color: #993300;">(4)讄相对位置</span></strong><br />在游戏中使用相对位置讄坐标的好处是显而易见的Q这样就不需要ؓ每个分L率都定义一套坐标了。首先得定义一些参考点Q引擎的TestCpp例子中就提供了一U方法,以屏q上可视区域?个点作ؓ参考点Q相当于在该矩Ş内写一个米字,q?个点分别是:左上、左、左下、下、右下、右、右上、上、中心?/p><p style="color: #333333; background-color: #ffffff; margin-top: 0px; margin-bottom: 0px; padding: 5px 10px; line-height: 1.8; text-indent: 28px; font-family: Tahoma, Geneva, sans-serif;">2. 下面来实C个简单的demoQ首先创Z个win32工程Q这个就不详qC?br />(1)创徏一个AppMacros.h文gQ定义了一些宏Q源码如下:</p><p style="color: #333333; background-color: #ffffff; margin-top: 0px; margin-bottom: 0px; padding: 5px 10px; line-height: 1.8; text-indent: 28px; font-family: Tahoma, Geneva, sans-serif;"></p><div bg_cpp"="" style="width: 687.046875px; color: #333333; line-height: 26px;"><div><div><strong>[cpp]</strong> <a title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;">view plain</a><a title="copy" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;">copy</a><div style="position: absolute; left: 558px; top: 1113px; width: 18px; height: 18px; z-index: 99;"></div><div style="position: absolute; left: 558px; top: 1113px; width: 18px; height: 18px; z-index: 99;"><embed id="ZeroClipboardMovie_1" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="18" height="18" name="ZeroClipboardMovie_1" align="center" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=1&width=18&height=18" wmode="transparent"></div></div></div><ol start="1"><li style="line-height: 18px;">#ifndef __APPMACROS_H__  </li><li style="line-height: 18px;">#define __APPMACROS_H__  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">#include "cocos2d.h"  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">typedef struct tagResource  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">    cocos2d::CCSize size;  </li><li style="line-height: 18px;">    <span style="color: #2e8b57; font-weight: bold;">char</span> directory[100];  </li><li style="line-height: 18px;">}Resource;  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">//可用的资源尺?nbsp; </li><li style="line-height: 18px;">static Resource smallResource  =  { cocos2d::CCSizeMake(480, 320),   "iphone" };  </li><li style="line-height: 18px;">static Resource mediumResource =  { cocos2d::CCSizeMake(1024, 768),  "ipad"   };  </li><li style="line-height: 18px;">static Resource largeResource  =  { cocos2d::CCSizeMake(2048, 1536), "ipadhd" };  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">//设计Ҏ  </li><li style="line-height: 18px;">static cocos2d::CCSize smallDesignResolutionSize = cocos2d::CCSizeMake(480.0f, 320.0f);  </li><li style="line-height: 18px;">static cocos2d::CCSize mediumDesignResolutionSize = cocos2d::CCSizeMake(1024.0f, 768.0f);  </li><li style="line-height: 18px;">static cocos2d::CCSize largeDesignResolutionSize = cocos2d::CCSizeMake(2048.0f, 1536.0f);  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">//~放因子Q主要给文字标签使用  </li><li style="line-height: 18px;">#define SCALE_FACTOR  (cocos2d::CCEGLView::sharedOpenGLView()->getDesignResolutionSize().width / smallResource.size.width)  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">#endif  </li></ol></div><span style="color: #333333; background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;">(2)接下来修改AppDelegate.cpp文g的applicationDidFinishLaunching函数Q添加以下代码:</span><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><p style="color: #333333; background-color: #ffffff; margin-top: 0px; margin-bottom: 0px; padding: 5px 10px; line-height: 1.8; text-indent: 28px; font-family: Tahoma, Geneva, sans-serif;"></p><div bg_cpp"="" style="width: 687.046875px; color: #333333; line-height: 26px;"><div><div><strong>[cpp]</strong> <a title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;">view plain</a><a title="copy" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;">copy</a><div style="position: absolute; left: 558px; top: 1715px; width: 18px; height: 18px; z-index: 99;"></div><div style="position: absolute; left: 558px; top: 1715px; width: 18px; height: 18px; z-index: 99;"><embed id="ZeroClipboardMovie_2" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="18" height="18" name="ZeroClipboardMovie_2" align="center" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=2&width=18&height=18" wmode="transparent"></div></div></div><ol start="1"><li style="line-height: 18px;"><span style="color: #2e8b57; font-weight: bold;">bool</span> AppDelegate::applicationDidFinishLaunching()  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">    // initialize director  </li><li style="line-height: 18px;">    CCDirector *pDirector = CCDirector::sharedDirector();  </li><li style="line-height: 18px;">    CCEGLView *pEGLView = CCEGLView::sharedOpenGLView();  </li><li style="line-height: 18px;">    pDirector->setOpenGLView(pEGLView);  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    CCSize frameSize = pEGLView->getFrameSize();  </li><li style="line-height: 18px;">    <span style="color: #2e8b57; font-weight: bold;">float</span> ratio = frameSize.width / frameSize.height;  </li><li style="line-height: 18px;">    <span style="color: #2e8b57; font-weight: bold;">float</span> ratio1 = largeDesignResolutionSize.width / largeDesignResolutionSize.height;  </li><li style="line-height: 18px;">    <span style="color: #2e8b57; font-weight: bold;">float</span> ratio2 = mediumDesignResolutionSize.width / mediumDesignResolutionSize.height;  </li><li style="line-height: 18px;">    <span style="color: #2e8b57; font-weight: bold;">float</span> ratio3 = smallDesignResolutionSize.width / smallDesignResolutionSize.height;  </li><li style="line-height: 18px;">    <span style="color: #2e8b57; font-weight: bold;">float</span> d1 = abs(ratio - ratio1);  </li><li style="line-height: 18px;">    <span style="color: #2e8b57; font-weight: bold;">float</span> d2 = abs(ratio - ratio2);  </li><li style="line-height: 18px;">    <span style="color: #2e8b57; font-weight: bold;">float</span> d3 = abs(ratio - ratio3);  </li><li style="line-height: 18px;">    std::map<<span style="color: #2e8b57; font-weight: bold;">float</span>, CCSize> designSize;  </li><li style="line-height: 18px;">    designSize[d1] = largeDesignResolutionSize;  </li><li style="line-height: 18px;">    designSize[d2] = mediumDesignResolutionSize;  </li><li style="line-height: 18px;">    designSize[d3] = smallDesignResolutionSize;  </li><li style="line-height: 18px;">    std::map<<span style="color: #2e8b57; font-weight: bold;">float</span>, CCSize>::reverse_iterator iter = designSize.rbegin();  </li><li style="line-height: 18px;">    //得到key最大的Q因此我q里是横屏,所以以高度为基准,Z保~放后宽度能全屏Q所以选取宽高比最大的计方?nbsp; </li><li style="line-height: 18px;">    CCSize designResolutionSize = iter->second;  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    //pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);  </li><li style="line-height: 18px;">    pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionShowAll);  </li><li style="line-height: 18px;">    //pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionExactFit);  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    if (frameSize.height > mediumResource.size.height)  </li><li style="line-height: 18px;">    {   </li><li style="line-height: 18px;">        CCFileUtils::sharedFileUtils()->setResourceDirectory(largeResource.directory);  </li><li style="line-height: 18px;">        pDirector->setContentScaleFactor(largeResource.size.height/designResolutionSize.height);  </li><li style="line-height: 18px;">    }  </li><li style="line-height: 18px;">    else if (frameSize.height > smallResource.size.height)  </li><li style="line-height: 18px;">    {   </li><li style="line-height: 18px;">        CCFileUtils::sharedFileUtils()->setResourceDirectory(mediumResource.directory);  </li><li style="line-height: 18px;">        pDirector->setContentScaleFactor(mediumResource.size.height/designResolutionSize.height);  </li><li style="line-height: 18px;">    }  </li><li style="line-height: 18px;">    else  </li><li style="line-height: 18px;">    {   </li><li style="line-height: 18px;">        CCFileUtils::sharedFileUtils()->setResourceDirectory(smallResource.directory);  </li><li style="line-height: 18px;">        pDirector->setContentScaleFactor(smallResource.size.height/designResolutionSize.height);  </li><li style="line-height: 18px;">    }  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    pDirector->setDisplayStats(true);  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    pDirector->setAnimationInterval(1.0 / 60);  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    CCScene *pScene = HelloWorld::scene();  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    pDirector->runWithScene(pScene);  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    return true;  </li><li style="line-height: 18px;">}  </li></ol></div><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;">(3)创徏VisibleRect.h和VisibleRect.cpp文gQ封装了获取?个点坐标的函敎ͼ比较单。代码如下:</span><br style="color: #333333; background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;" /><span style="color: #333333; background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;">VisibleRect.h</span><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><p style="color: #333333; background-color: #ffffff; margin-top: 0px; margin-bottom: 0px; padding: 5px 10px; line-height: 1.8; text-indent: 28px; font-family: Tahoma, Geneva, sans-serif;"></p><div bg_cpp"="" style="width: 687.046875px; color: #333333; line-height: 26px;"><div><div><strong>[cpp]</strong> <a title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;">view plain</a><a title="copy" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;">copy</a><div style="position: absolute; left: 558px; top: 2980px; width: 18px; height: 18px; z-index: 99;"></div><div style="position: absolute; left: 558px; top: 2980px; width: 18px; height: 18px; z-index: 99;"><embed id="ZeroClipboardMovie_3" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="18" height="18" name="ZeroClipboardMovie_3" align="center" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=3&width=18&height=18" wmode="transparent"></div></div></div><ol start="1"><li style="line-height: 18px;">#ifndef __VISIBLERECT_H__  </li><li style="line-height: 18px;">#define __VISIBLERECT_H__  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">#include "cocos2d.h"  </li><li style="line-height: 18px;">USING_NS_CC;  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">class VisibleRect  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">public:  </li><li style="line-height: 18px;">    static CCRect getVisibleRect();  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    static CCPoint left();  </li><li style="line-height: 18px;">    static CCPoint right();  </li><li style="line-height: 18px;">    static CCPoint top();  </li><li style="line-height: 18px;">    static CCPoint bottom();  </li><li style="line-height: 18px;">    static CCPoint center();  </li><li style="line-height: 18px;">    static CCPoint leftTop();  </li><li style="line-height: 18px;">    static CCPoint rightTop();  </li><li style="line-height: 18px;">    static CCPoint leftBottom();  </li><li style="line-height: 18px;">    static CCPoint rightBottom();  </li><li style="line-height: 18px;">private:  </li><li style="line-height: 18px;">    static void lazyInit();  </li><li style="line-height: 18px;">    static CCRect s_visibleRect;  </li><li style="line-height: 18px;">};  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">#endif  </li></ol></div><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;">VisibleRect.cpp</span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><div bg_cpp"="" style="width: 687.046875px; color: #333333; line-height: 26px;"><div><div><strong>[cpp]</strong> <a title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;">view plain</a><a title="copy" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;">copy</a><div style="position: absolute; left: 558px; top: 3542px; width: 18px; height: 18px; z-index: 99;"></div><div style="position: absolute; left: 558px; top: 3542px; width: 18px; height: 18px; z-index: 99;"><embed id="ZeroClipboardMovie_4" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="18" height="18" name="ZeroClipboardMovie_4" align="center" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=4&width=18&height=18" wmode="transparent"></div></div></div><ol start="1"><li style="line-height: 18px;">#include "VisibleRect.h"  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">CCRect VisibleRect::s_visibleRect;  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">void VisibleRect::lazyInit()  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">    if (s_visibleRect.size.width == 0.0f && s_visibleRect.size.height == 0.0f)  </li><li style="line-height: 18px;">    {  </li><li style="line-height: 18px;">        CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();  </li><li style="line-height: 18px;">        s_visibleRect.origin = pEGLView->getVisibleOrigin();  </li><li style="line-height: 18px;">        s_visibleRect.size = pEGLView->getVisibleSize();  </li><li style="line-height: 18px;">    }  </li><li style="line-height: 18px;">}  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">CCRect VisibleRect::getVisibleRect()  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">    lazyInit();  </li><li style="line-height: 18px;">    return CCRectMake(s_visibleRect.origin.x, s_visibleRect.origin.y, s_visibleRect.size.width, s_visibleRect.size.height);  </li><li style="line-height: 18px;">}  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">CCPoint VisibleRect::left()  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">    lazyInit();  </li><li style="line-height: 18px;">    return ccp(s_visibleRect.origin.x, s_visibleRect.origin.y + s_visibleRect.size.height/2);  </li><li style="line-height: 18px;">}  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">CCPoint VisibleRect::right()  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">    lazyInit();  </li><li style="line-height: 18px;">    return ccp(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y + s_visibleRect.size.height/2);  </li><li style="line-height: 18px;">}  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">CCPoint VisibleRect::top()  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">    lazyInit();  </li><li style="line-height: 18px;">    return ccp(s_visibleRect.origin.x + s_visibleRect.size.width/2, s_visibleRect.origin.y + s_visibleRect.size.height);  </li><li style="line-height: 18px;">}  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">CCPoint VisibleRect::bottom()  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">    lazyInit();  </li><li style="line-height: 18px;">    return ccp(s_visibleRect.origin.x + s_visibleRect.size.width/2, s_visibleRect.origin.y);  </li><li style="line-height: 18px;">}  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">CCPoint VisibleRect::center()  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">    lazyInit();  </li><li style="line-height: 18px;">    return ccp(s_visibleRect.origin.x + s_visibleRect.size.width/2, s_visibleRect.origin.y + s_visibleRect.size.height/2);  </li><li style="line-height: 18px;">}  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">CCPoint VisibleRect::leftTop()  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">    lazyInit();  </li><li style="line-height: 18px;">    return ccp(s_visibleRect.origin.x, s_visibleRect.origin.y + s_visibleRect.size.height);  </li><li style="line-height: 18px;">}  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">CCPoint VisibleRect::rightTop()  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">    lazyInit();  </li><li style="line-height: 18px;">    return ccp(s_visibleRect.origin.x + s_visibleRect.size.width, s_visibleRect.origin.y + s_visibleRect.size.height);  </li><li style="line-height: 18px;">}  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">CCPoint VisibleRect::leftBottom()  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">    lazyInit();  </li><li style="line-height: 18px;">    return s_visibleRect.origin;  </li><li style="line-height: 18px;">}  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">CCPoint VisibleRect::rightBottom()  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">    lazyInit();  </li><li style="line-height: 18px;">    return ccp(s_visibleRect.origin.x + s_visibleRect.size.width, s_visibleRect.origin.y);  </li><li style="line-height: 18px;">}  </li></ol></div><span style="color: #333333; background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;">(4)修改HelloWorldScene.cpp的init函数Q用相对位|设|坐标?/span><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><div bg_cpp"="" style="width: 687.046875px; color: #333333; line-height: 26px;"><div><div><strong>[cpp]</strong> <a title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;">view plain</a><a title="copy" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;">copy</a><div style="position: absolute; left: 558px; top: 4966px; width: 18px; height: 18px; z-index: 99;"></div><div style="position: absolute; left: 558px; top: 4966px; width: 18px; height: 18px; z-index: 99;"><embed id="ZeroClipboardMovie_5" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="18" height="18" name="ZeroClipboardMovie_5" align="center" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=5&width=18&height=18" wmode="transparent"></div></div></div><ol start="1"><li style="line-height: 18px;"><span style="color: #2e8b57; font-weight: bold;">bool</span> HelloWorld::init()  </li><li style="line-height: 18px;">{  </li><li style="line-height: 18px;">    if ( !CCLayer::init() )  </li><li style="line-height: 18px;">    {  </li><li style="line-height: 18px;">        return false;  </li><li style="line-height: 18px;">    }  </li><li style="line-height: 18px;">    CCMenuItemImage *pCloseItem = CCMenuItemImage::create(  </li><li style="line-height: 18px;">                                        "CloseNormal.png",  </li><li style="line-height: 18px;">                                        "CloseSelected.png",  </li><li style="line-height: 18px;">                                        this,  </li><li style="line-height: 18px;">                                        menu_selector(HelloWorld::menuCloseCallback));  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    pCloseItem->setPosition(ccpAdd(VisibleRect::rightBottom(),   </li><li style="line-height: 18px;">                                ccp(-pCloseItem->getContentSize().width/2, pCloseItem->getContentSize().height/2)));  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);  </li><li style="line-height: 18px;">    pMenu->setPosition(CCPointZero);  </li><li style="line-height: 18px;">    this->addChild(pMenu, 1);  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", SCALE_FACTOR * 24);  </li><li style="line-height: 18px;">    pLabel->setPosition(ccpAdd(VisibleRect::top(),  </li><li style="line-height: 18px;">                            ccp(0, -pLabel->getContentSize().height)));  </li><li style="line-height: 18px;">    this->addChild(pLabel, 1);  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    CCSprite* pSprite = CCSprite::create("HelloWorld.png");  </li><li style="line-height: 18px;">    pSprite->setPosition(VisibleRect::center());  </li><li style="line-height: 18px;">    this->addChild(pSprite, 0);  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    CCSprite *pLogoSprite = CCSprite::create("icon.png");  </li><li style="line-height: 18px;">    pLogoSprite->setAnchorPoint( ccp(0, 0.5) );  </li><li style="line-height: 18px;">    pLogoSprite->setPosition(ccpAdd(VisibleRect::left(), ccp(50, 0)));  </li><li style="line-height: 18px;">    this->addChild(pLogoSprite, 0);  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;">    return true;  </li><li style="line-height: 18px;">}  </li></ol></div><br style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;" /><span style="color: #333333; background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;">(5)创徏H口Qmain.cpp的主要内容:</span><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><div bg_cpp"="" style="width: 687.046875px; color: #333333; line-height: 26px;"><div><div><strong>[cpp]</strong> <a title="view plain" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_plain.gif); padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;">view plain</a><a title="copy" style="background-image: url(http://static.blog.csdn.net/scripts/SyntaxHighlighter/styles/images/default/ico_copy.gif); padding: 1px; display: inline-block; width: 16px; height: 16px; text-indent: -2000px; background-position: 0% 0%; background-repeat: no-repeat no-repeat;">copy</a><div style="position: absolute; left: 558px; top: 5734px; width: 18px; height: 18px; z-index: 99;"></div><div style="position: absolute; left: 558px; top: 5734px; width: 18px; height: 18px; z-index: 99;"><embed id="ZeroClipboardMovie_6" src="http://static.blog.csdn.net/scripts/ZeroClipboard/ZeroClipboard.swf" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="18" height="18" name="ZeroClipboardMovie_6" align="center" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="id=6&width=18&height=18" wmode="transparent"></div></div></div><ol start="1"><li style="line-height: 18px;">AppDelegate app;  </li><li style="line-height: 18px;">CCEGLView* eglView = CCEGLView::sharedOpenGLView();  </li><li style="line-height: 18px;">    //eglView->setFrameSize(2048, 1536);  </li><li style="line-height: 18px;">    //eglView->setFrameSize(480, 320);  </li><li style="line-height: 18px;">    //eglView->setFrameSize(800, 480);  </li><li style="line-height: 18px;">    //eglView->setFrameSize(1024, 768);  </li><li style="line-height: 18px;">    //eglView->setFrameSize(1280, 800);  </li><li style="line-height: 18px;">    eglView->setFrameSize(1280, 768);  </li><li style="line-height: 18px;">    //eglView->setFrameSize(960, 640);  </li><li style="line-height: 18px;">    eglView->setFrameZoomFactor(0.5f);  </li><li style="line-height: 18px;">   </li><li style="line-height: 18px;"><span style="color: #2e8b57; font-weight: bold;">int</span> ret = CCApplication::sharedApplication()->run();  </li></ol></div><span style="color: #333333; background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;">OKQ到此ؓ止,代码部分已经完成了,下面看看在各U分辨率和不同策略下的效果图Q?/span><br style="color: #333333; background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;" /><span style="color: #333333; background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;">1. kResolutionShowAll{略</span><span style="color: #333333; background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;">Q?/span><br style="color: #333333; background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;" /><span style="color: #333333; background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;">(1)</span><span style="background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px; color: #993300;">2048×1536</span><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;"><span style="color: #993300;"><img src="http://codingnow.cn/wp-content/uploads/2012/12/20121204221330.png" alt="" style="border: none;" /><br /></span><br />(2)<span style="color: #993300;">1024×768</span><br /></span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;"><span style="color: #993300;"><img src="http://codingnow.cn/wp-content/uploads/2012/12/20121204221415.png" alt="" style="border: none;" /><br /></span></span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;"><span style="color: #993300;">(3)480×320<br /></span></span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;"><span style="color: #993300;"><img src="http://codingnow.cn/wp-content/uploads/2012/12/20121204221454.png" alt="" style="border: none;" /><br /></span></span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;"></span></p><span style="color: #333333; background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;">2. kResolutionExactFit{略</span><br style="color: #333333; background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;" /><span style="background-color: #ffffff; font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px; color: #993300;">1280×768分L?/span><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;"><span style="color: #993300;"><img src="http://codingnow.cn/wp-content/uploads/2012/12/20121204224333.png" alt="" style="border: none;" /><br /></span></span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;"><span style="color: #993300;">3. kResolutionNoBorder{略<br />1280×768分L?br /></span></span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="font-family: Tahoma, Geneva, sans-serif; line-height: 25px; text-indent: 28px;"><span style="color: #993300;"><img src="http://codingnow.cn/wp-content/uploads/2012/12/20121204224410.png" alt="" style="border: none;" /></span></span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="font-family: Tahoma, Geneva, sans-serif; line-height: 1.8; text-indent: 28px; color: #993300;">demo源码Qhttp://download.csdn.net/detail/zhoujianghai/4847206</span></p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"><span style="font-family: Tahoma, Geneva, sans-serif; line-height: 1.8; text-indent: 28px; color: #993300;">本文链接Qhttp://codingnow.cn/cocos2d-x/975.html</span></p><img src ="http://www.aygfsteel.com/demibug/aggbug/396355.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/demibug/" target="_blank">Hiji</a> 2013-03-13 01:25 <a href="http://www.aygfsteel.com/demibug/archive/2013/03/13/396355.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>深入了解CCSpritehttp://www.aygfsteel.com/demibug/archive/2013/03/11/396277.htmlHijiHijiMon, 11 Mar 2013 03:05:00 GMThttp://www.aygfsteel.com/demibug/archive/2013/03/11/396277.htmlhttp://www.aygfsteel.com/demibug/comments/396277.htmlhttp://www.aygfsteel.com/demibug/archive/2013/03/11/396277.html#Feedback0http://www.aygfsteel.com/demibug/comments/commentRss/396277.htmlhttp://www.aygfsteel.com/demibug/services/trackbacks/396277.html阅读全文

Hiji 2013-03-11 11:05 发表评论
]]>
CCsprite学习W记http://www.aygfsteel.com/demibug/archive/2013/03/11/396276.htmlHijiHijiMon, 11 Mar 2013 03:04:00 GMThttp://www.aygfsteel.com/demibug/archive/2013/03/11/396276.htmlhttp://www.aygfsteel.com/demibug/comments/396276.htmlhttp://www.aygfsteel.com/demibug/archive/2013/03/11/396276.html#Feedback0http://www.aygfsteel.com/demibug/comments/commentRss/396276.htmlhttp://www.aygfsteel.com/demibug/services/trackbacks/396276.html_是游戏中十分重要的组成部分,随处可见Q如Q游戏背景、NPC、h物、道L。在cocos2d-x引擎中,只要是用囄展示的,基本上需要用精늱?br />1. 首先来了解一下跟_相关的几个类Q?/strong>
(1) CCTexture2D
可以把它看成一个纹理,它是cocos2d-x渲染囑Ş的重要参敎ͼ用来贴图Q因为cocos2d-x使用opengl esl制2d囑Ş的,它的寸?的nơ方。一般通过以下方式获得Q?/p>
1
CCTexture2D* cache = CCTextureCache::sharedTextureCache()->addImage("hero.png");

(2) CCSprite
q个是_c,是CCNode的子c,它的内部装了CCTexture2D(U理)Q可以通过下面几种方式初始化精灵对象?/p>

1
2
3
4
5
6
7
8
9
10
11
12
//CCTexture2D表示_包含的图片,范围是整张图?/code>
static CCSprite* spriteWithTexture(CCTexture2D *pTexture);
//CCRect表示囄的指定范_即从囄的指定矩形区域裁?/code>
static CCSprite* spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect);
//CCSpriteFrame表示_的某一帧,大多数情况下_本n的图片有多。它内部装了CCTexture2D和CCRectQ可以从一个大囄取出一部分作ؓ一帧?/code>
static CCSprite* spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
//pszSpriteFrameName表示帧的名字Q根据名从内存中取出CCSpriteFrame
static


Hiji 2013-03-11 11:04 发表评论
]]>
关于C++cL员函数的重蝲、覆盖、隐藏与virtual关键?/title><link>http://www.aygfsteel.com/demibug/archive/2013/03/10/396260.html</link><dc:creator>Hiji</dc:creator><author>Hiji</author><pubDate>Sun, 10 Mar 2013 12:06:00 GMT</pubDate><guid>http://www.aygfsteel.com/demibug/archive/2013/03/10/396260.html</guid><wfw:comment>http://www.aygfsteel.com/demibug/comments/396260.html</wfw:comment><comments>http://www.aygfsteel.com/demibug/archive/2013/03/10/396260.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/demibug/comments/commentRss/396260.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/demibug/services/trackbacks/396260.html</trackback:ping><description><![CDATA[<span style="font-family: Arial; background-color: #ffffff;">最q看<<高质量C++>>时读到的关于成员函数的重?覆盖/隐藏,把我的一点理解写出来,希望大家批评与指?</span><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff;">1. <span style="font-family: 宋体;">重蝲、覆盖与隐藏</span></p><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;">1)<span style="font-family: 宋体;">Q重载:成员函数h以下的特征时发生“重蝲”</span></p><p style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;">A<span style="font-family: 宋体;">Q相同的范围Q同一个类中)</span></p><p style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;">B<span style="font-family: 宋体;">Q函数的名字相同</span></p><p style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;">C<span style="font-family: 宋体;">Q参数类型不同(不能q行隐式cd转换Q?/span></p><p style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;">D<span style="font-family: 宋体;">Q?/span>Virtual<span style="font-family: 宋体;">关键字可有可?/span></p><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;">2)<span style="font-family: 宋体;">Q覆盖(也叫“l承”Q:指派生类函数覆盖基类函数Q特征是Q?/span></p><p style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;">A<span style="font-family: 宋体;">Q不同的范围Q分别位于基cMzcMQ?/span></p><p style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;">B<span style="font-family: 宋体;">Q函数名字相?/span></p><p style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;">C<span style="font-family: 宋体;">Q参数相?/span></p><p style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;">D<span style="font-family: 宋体;">Q基cd数必L</span>virtual<span style="font-family: 宋体;">关键?/span></p><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;">3)<span style="font-family: 宋体;">Q隐藏:是指zcȝ函数屏蔽了与其同名的基类函数Q规则如下:</span></p><p style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;">A<span style="font-family: 宋体;">Q如果派生类的函C基类的函数同名,但是参数不同Q此时不论有?/span>virtual<span style="font-family: 宋体;">关键字,基类的函数都被隐藏Q注意别与重载؜淆)</span></p><p style="margin: 0cm 0cm 0.0001pt 21pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;">B<span style="font-family: 宋体;">Q如果派生类的函C基类的函数同名,q且参数也相同,但是基类函数没有</span>virtual<span style="font-family: 宋体;">关键字,此时基类的函数被隐藏Q注意别与覆盖؜淆)</span></p><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff;"> </p><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff;">2<span style="font-family: 宋体;">Q看下面q个例子代码Q?/span></p><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff;"></p><div style="font-family: Arial; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 995.671875px;"><span style="color: #008080;"> 1</span> #include <iostream><br /><span style="color: #008080;"> 2</span> <span style="color: #0000ff;">using</span> std::cout;<br /><span style="color: #008080;"> 3</span> <span style="color: #0000ff;">using</span> std::endl;<br /><span style="color: #008080;"> 4</span> <br /><span style="color: #008080;"> 5</span> <span style="color: #0000ff;">class</span> Base<br /><span style="color: #008080;"> 6</span> {<br /><span style="color: #008080;"> 7</span> <span style="color: #0000ff;">public</span>:<br /><span style="color: #008080;"> 8</span>     <span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> f(<span style="color: #0000ff;">float</span> x){ cout << "Base::f(float) " << x << endl;}<br /><span style="color: #008080;"> 9</span>     <span style="color: #0000ff;">void</span> g(<span style="color: #0000ff;">float</span> x){ std::cout << "Base::g(float) " << x << std::endl;}<br /><span style="color: #008080;">10</span>     <span style="color: #0000ff;">void</span> h(<span style="color: #0000ff;">float</span> x){ std::cout << "Base::h(float) " << x <<std::endl;}<br /><span style="color: #008080;">11</span> };<br /><span style="color: #008080;">12</span> <br /><span style="color: #008080;">13</span> <span style="color: #0000ff;">class</span> Derived : <span style="color: #0000ff;">public</span> Base<br /><span style="color: #008080;">14</span> {<br /><span style="color: #008080;">15</span> <span style="color: #0000ff;">public</span>:<br /><span style="color: #008080;">16</span>     <span style="color: #0000ff;">virtual</span> <span style="color: #0000ff;">void</span> f(<span style="color: #0000ff;">float</span> x){ std::cout << "Derived::f(float) " << x << std::endl;}<br /><span style="color: #008080;">17</span>     <span style="color: #0000ff;">void</span> g(<span style="color: #0000ff;">int</span> x){ std::cout << "Derived::g(int) " << x << std::endl;}<br /><span style="color: #008080;">18</span>     <span style="color: #0000ff;">void</span> h(<span style="color: #0000ff;">float</span> x){ std::cout << "Derived::h(float) " << x << std::endl;}<br /><span style="color: #008080;">19</span> };<br /><span style="color: #008080;">20</span> <br /><span style="color: #008080;">21</span> <span style="color: #0000ff;">void</span> main(<span style="color: #0000ff;">void</span>)<br /><span style="color: #008080;">22</span> {<br /><span style="color: #008080;">23</span>     Derived d;<br /><span style="color: #008080;">24</span>     Base *pb = &d;<br /><span style="color: #008080;">25</span>     Derived *pd = &d;<br /><span style="color: #008080;">26</span> <br /><span style="color: #008080;">27</span>     pb->f(3.14f);<span style="color: #008000;">//</span><span style="color: #008000;">Derived::f(float) 3.14</span><span style="color: #008000;"><br /></span><span style="color: #008080;">28</span>     pd->f(3.14f);<span style="color: #008000;">//</span><span style="color: #008000;">Derived::f(float) 3.14</span><span style="color: #008000;"><br /></span><span style="color: #008080;">29</span> <br /><span style="color: #008080;">30</span>     pb->g(3.14f);<span style="color: #008000;">//</span><span style="color: #008000;">Base::g(float) 3.14</span><span style="color: #008000;"><br /></span><span style="color: #008080;">31</span>     pd->g(3.14f);<span style="color: #008000;">//</span><span style="color: #008000;">Derived::g(int) 3</span><span style="color: #008000;"><br /></span><span style="color: #008080;">32</span> <br /><span style="color: #008080;">33</span>     pb->h(3.14f);<span style="color: #008000;">//</span><span style="color: #008000;">Base:h(float) 3.14</span><span style="color: #008000;"><br /></span><span style="color: #008080;">34</span>     pd->h(3.14f);<span style="color: #008000;">//</span><span style="color: #008000;">Derived::h(float) 3.14</span><span style="color: #008000;"><br /></span><span style="color: #008080;">35</span> }<span style="color: #008080;"><br /></span></div><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff;"> </p><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff;">3. <span style="font-family: 宋体;">解释</span></p><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;"><span style="font-family: 宋体;">?/span>27<span style="font-family: 宋体;">?/span>28<span style="font-family: 宋体;">行,zcȝ</span>Derived::f(float x)<span style="font-family: 宋体;">通过</span>virtual<span style="font-family: 宋体;">关键字承(覆盖Q了基类?/span>Base::f(float x)<span style="font-family: 宋体;">ҎQ所以这里无论采有基cL针还是派生类指针Q最后调用的其实都是</span>Derived::f(float x)<span style="font-family: 宋体;">Ҏ。这正是一般情冉|们所期望的?/span></p><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;"><span style="font-family: 宋体;">?/span>30<span style="font-family: 宋体;">行,׃基类?/span>Base::g()<span style="font-family: 宋体;">没有?/span>virtual<span style="font-family: 宋体;">关键字声明,所以这里它不会被派生类?/span>Derived::g()<span style="font-family: 宋体;">Ҏ覆盖。所以通过基类指针讉K时只能访问到</span>Base::g(float x)<span style="font-family: 宋体;">Q而在</span>31<span style="font-family: 宋体;">行通过zcL针时可以讉K的方法有</span>Base::g(float x)<span style="font-family: 宋体;">?/span>Derived::g(int x)<span style="font-family: 宋体;">Q这两个Ҏ虽然Ҏ名相同而且参数不同Q似乎)W合重蝲的标准,但是它们却分属于不同?#8220;?#8221;因此重蝲不会发生Q这?/span>Derived::g(int x)<span style="font-family: 宋体;">只能把</span>Base::g(float x)<span style="font-family: 宋体;">“隐藏”掉?/span></p><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;"><span style="font-family: 宋体;">同上Q在W?/span>33<span style="font-family: 宋体;">行通过基类指针能访问的Ҏ只有</span>Base::h(float x)<span style="font-family: 宋体;">Q由于该Ҏ没有?/span>virtual<span style="font-family: 宋体;">关键字声明,所以不会被zcL?/span>Derived::h(float x)<span style="font-family: 宋体;">“替换”Q因此调用的?/span>Base::h(float x)<span style="font-family: 宋体;">。而在W?/span>34<span style="font-family: 宋体;">行通过zcL针可以访问的Ҏ同时?/span>Base::h(float x)<span style="font-family: 宋体;">?/span>Derived::h(float x)<span style="font-family: 宋体;">Q这g又冲H,而这?/span>C++<span style="font-family: 宋体;">?#8220;隐藏”规则发生作用Q所以派生类Ҏ</span>Derived::h(float x)<span style="font-family: 宋体;">把基cL?/span>Base::h(float x)<span style="font-family: 宋体;">“隐藏”Q于?/span>Derived::h(float x)<span style="font-family: 宋体;">被调用?/span></p><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff; text-indent: 21pt;"> </p><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff;">4<span style="font-family: 宋体;">Qȝ</span></p><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff;">       C++<span style="font-family: 宋体;">?#8220;重蝲”?#8220;l承”?#8220;隐藏”机制比一般想象中的要复杂Q而这q显了</span>virtual<span style="font-family: 宋体;">关键字的重要性。所以在zcd在的前提下一Q一定要把基cM可能在派生类中也实现的方法用</span>virtual<span style="font-family: 宋体;">关键字声明。除非在Ҏ情况下,比如需要检查指针类型的时候?/span></p><p style="margin: 0cm 0cm 0.0001pt; text-align: justify; font-family: 'Times New Roman'; background-color: #ffffff;"><br /></p><div style="font-family: Arial; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 995.671875px;"><span style="color: #008080;"> 1</span> #include <iostream><br /><span style="color: #008080;"> 2</span> <span style="color: #0000ff;">using</span> std::cout;<br /><span style="color: #008080;"> 3</span> <span style="color: #0000ff;">using</span> std::endl;<br /><span style="color: #008080;"> 4</span> <br /><span style="color: #008080;"> 5</span> <span style="color: #0000ff;">class</span> Base<br /><span style="color: #008080;"> 6</span> {<br /><span style="color: #008080;"> 7</span> <span style="color: #0000ff;">public</span>:<br /><span style="color: #008080;"> 8</span>     <span style="color: #0000ff;">void</span> CheckType(<span style="color: #0000ff;">void</span>){ cout << "This's Base Ptr" << endl;}<br /><span style="color: #008080;"> 9</span> };<br /><span style="color: #008080;">10</span> <br /><span style="color: #008080;">11</span> <span style="color: #0000ff;">class</span> Derived : <span style="color: #0000ff;">public</span> Base<br /><span style="color: #008080;">12</span> {<br /><span style="color: #008080;">13</span> <span style="color: #0000ff;">public</span>:<br /><span style="color: #008080;">14</span>     <span style="color: #0000ff;">void</span> CheckType(<span style="color: #0000ff;">void</span>){ cout << "This;s Derived Ptr" << endl;}<br /><span style="color: #008080;">15</span> };<br /><span style="color: #008080;">16</span> <br /><span style="color: #008080;">17</span> <span style="color: #0000ff;">void</span> main(<span style="color: #0000ff;">void</span>)<br /><span style="color: #008080;">18</span> {<br /><span style="color: #008080;">19</span>     Derived d;<br /><span style="color: #008080;">20</span>     Base *pb = &d;<br /><span style="color: #008080;">21</span>     Derived *pd = &d;<br /><span style="color: #008080;">22</span> <br /><span style="color: #008080;">23</span>     pb->CheckType();<span style="color: #008000;">//</span><span style="color: #008000;">This's Base Ptr</span><span style="color: #008000;"><br /></span><span style="color: #008080;">24</span>     pd->CheckType();<span style="color: #008000;">//</span><span style="color: #008000;">This's Derived Ptr</span><span style="color: #008000;"><br /></span><span style="color: #008080;">25</span> }<br /><span style="color: #008080;">26</span> </div><img src ="http://www.aygfsteel.com/demibug/aggbug/396260.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/demibug/" target="_blank">Hiji</a> 2013-03-10 20:06 <a href="http://www.aygfsteel.com/demibug/archive/2013/03/10/396260.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Cocos2dx使用 TexturePacker导出?plisthttp://www.aygfsteel.com/demibug/archive/2013/03/10/396256.htmlHijiHijiSun, 10 Mar 2013 08:38:00 GMThttp://www.aygfsteel.com/demibug/archive/2013/03/10/396256.htmlhttp://www.aygfsteel.com/demibug/comments/396256.htmlhttp://www.aygfsteel.com/demibug/archive/2013/03/10/396256.html#Feedback0http://www.aygfsteel.com/demibug/comments/commentRss/396256.htmlhttp://www.aygfsteel.com/demibug/services/trackbacks/396256.html
  • CCSpriteFrameCache* cache = CCSpriteFrameCache::sharedSpriteFrameCache();  
  •     cache->addSpriteFramesWithFile("test.plist""test.png");  
  •       
  •     /* 创徏Sprite */  
  •     CCSprite* s1 = CCSprite::createWithSpriteFrame(cache->spriteFrameByName("g_good.png"));  
  •       
  •     s1->setPosition(ccp(100, 100));  
  •     addChild(s1);  
  •       
  •     CCSprite* s2 = CCSprite::createWithSpriteFrame(cache->spriteFrameByName("musicBtn.png"));  
  •       
  •     s2->setPosition(ccp(300, 300));  
  •     addChild(s2); 


  • Hiji 2013-03-10 16:38 发表评论
    ]]>
    cocos2d中CCCallFunc、CCCallFuncN和CCCallFuncND的区?/title><link>http://www.aygfsteel.com/demibug/archive/2013/02/26/395756.html</link><dc:creator>Hiji</dc:creator><author>Hiji</author><pubDate>Tue, 26 Feb 2013 07:36:00 GMT</pubDate><guid>http://www.aygfsteel.com/demibug/archive/2013/02/26/395756.html</guid><wfw:comment>http://www.aygfsteel.com/demibug/comments/395756.html</wfw:comment><comments>http://www.aygfsteel.com/demibug/archive/2013/02/26/395756.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/demibug/comments/commentRss/395756.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/demibug/services/trackbacks/395756.html</trackback:ping><description><![CDATA[<p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;">cocos2d中有3U回调方式:CCCallFunc、CCCallFuncN和CCCallFuncND</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;">其中Q他们有什么区别呢Q?/p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;"> </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;">q里我稍微ȝ下,不对的欢q讨论和拍砖Q?/p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;"> </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;">看源代码的excuteҎQ我ȝ下面3点:</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;">1. CCCallFunc</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;"> </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;"></p><div class="wmqeeuq" id="" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; background-color: #ffffff; width: 679px; margin-left: 9px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; word-break: break-all; word-wrap: break-word; line-height: 25.1875px;"><div><div style="padding-right: 3px; padding-bottom: 3px; padding-left: 3px; margin: 0px; font-weight: bold;">C代码 <embed wmode="transparent" src="http://wsqwsq000.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=-(void)%20execute%0A%7B%0A%09%5BtargetCallback%20performSelector%3Aselector%5D%3B%0A%7D" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> <a href="" title="收藏q段代码" style="color: #108ac6;"><img src="http://wsqwsq000.iteye.com/images/icon_star.png" alt="收藏代码" style="border: 0px;" /></a></div></div><ol start="1" style="font-size: 1em; line-height: 1.4em; margin-left: 0px; padding-top: 2px; padding-bottom: 2px; border: 1px solid #d1d7dc; color: #2b91af;"><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;">-(<span style="color: #7f0055;">void</span>) execute  </li><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;">{  </li><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;">    [targetCallback performSelector:selector];  </li><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;">}  </li></ol></div><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;">CCCallFunc是执行对应的回调ҎQ其中回调方法不可带参数?/p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;"> </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;">2. CCCallFuncN</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;"> </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;"></p><div class="wmqeeuq" id="" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; background-color: #ffffff; width: 679px; margin-left: 9px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; word-break: break-all; word-wrap: break-word; line-height: 25.1875px;"><div><div style="padding-right: 3px; padding-bottom: 3px; padding-left: 3px; margin: 0px; font-weight: bold;">C代码 <embed wmode="transparent" src="http://wsqwsq000.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=-(void)%20execute%0A%7B%0A%09%5BtargetCallback%20performSelector%3Aselector%20withObject%3Atarget%5D%3B%0A%7D" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> <a href="" title="收藏q段代码" style="color: #108ac6;"><img src="http://wsqwsq000.iteye.com/images/icon_star.png" alt="收藏代码" style="border: 0px;" /></a></div></div><ol start="1" style="font-size: 1em; line-height: 1.4em; margin-left: 0px; padding-top: 2px; padding-bottom: 2px; border: 1px solid #d1d7dc; color: #2b91af;"><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;">-(<span style="color: #7f0055;">void</span>) execute  </li><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;">{  </li><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;">    [targetCallback performSelector:selector withObject:target];  </li><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;">}  </li></ol></div><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;"> CCCallFuncN多带一个参敎ͼ而参数本w是动作Aciton本n。就像UIButton那样Q我们可以@selector(btnUpInside:)Q带的参数就是UIButton本n?/p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;"> </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;">3. CCCallFuncND</p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;"> </p><p style="margin: 0px; padding: 0px; font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;"></p><div class="wmqeeuq" id="" style="font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; background-color: #ffffff; width: 679px; margin-left: 9px; padding-right: 1px; padding-bottom: 1px; padding-left: 1px; word-break: break-all; word-wrap: break-word; line-height: 25.1875px;"><div><div style="padding-right: 3px; padding-bottom: 3px; padding-left: 3px; margin: 0px; font-weight: bold;">C代码 <embed wmode="transparent" src="http://wsqwsq000.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf" width="14" height="15" flashvars="clipboard=-(void)%20execute%0A%7B%0A%09%5Binvocation_%20setArgument%3A%26target%20atIndex%3A2%5D%3B%0A%09%5Binvocation_%20setArgument%3A%26data%20atIndex%3A3%5D%3B%0A%09%5Binvocation_%20invoke%5D%3B%0A%7D" quality="high" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> <a href="" title="收藏q段代码" style="color: #108ac6;"><img src="http://wsqwsq000.iteye.com/images/icon_star.png" alt="收藏代码" style="border: 0px;" /></a></div></div><ol start="1" style="font-size: 1em; line-height: 1.4em; margin-left: 0px; padding-top: 2px; padding-bottom: 2px; border: 1px solid #d1d7dc; color: #2b91af;"><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;">-(<span style="color: #7f0055;">void</span>) execute  </li><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;">{  </li><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;">    [invocation_ setArgument:&target atIndex:2];  </li><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;">    [invocation_ setArgument:&data atIndex:3];  </li><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;">    [invocation_ invoke];  </li><li style="font-size: 1em; margin-left: 38px; padding-right: 0px; border-left-width: 1px; border-left-color: #d1d7dc; background-color: #fafafa; line-height: 18px;">}  </li></ol></div><span style="font-family: Helvetica, Tahoma, Arial, sans-serif; line-height: 25.1875px; background-color: #ffffff;">CCCallFuncND?个参敎ͼ一个是动作Action本nQ一个是你自己定义的回调函数的参数?/span><img src ="http://www.aygfsteel.com/demibug/aggbug/395756.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/demibug/" target="_blank">Hiji</a> 2013-02-26 15:36 <a href="http://www.aygfsteel.com/demibug/archive/2013/02/26/395756.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Cocos2dx 中文支持http://www.aygfsteel.com/demibug/archive/2013/01/15/394268.htmlHijiHijiTue, 15 Jan 2013 11:26:00 GMThttp://www.aygfsteel.com/demibug/archive/2013/01/15/394268.htmlhttp://www.aygfsteel.com/demibug/comments/394268.htmlhttp://www.aygfsteel.com/demibug/archive/2013/01/15/394268.html#Feedback1http://www.aygfsteel.com/demibug/comments/commentRss/394268.htmlhttp://www.aygfsteel.com/demibug/services/trackbacks/394268.html

    需要的字符串保存于 strings.xml文g中:

    <?xml version="1.0" encoding="UTF-8"?>  
    <!DOCTYPE plist PUBLIC "-
    //Apple//DTD PLIST 1.0//EN""http://www.apple.com/DTDs/PropertyList-1.0.dtd"
    >  
    <plist version="1.0">  
    <dict>  
        
    <key>title</key>  
        
    <string>是男人就坚持20U?/span></string>  
        
    <key>new_game</key>  
        
    <string>新游?/span></string>  
        
    <key>setting_game</key>  
        
    <string></string>  
        
    <key>quit_game</key>  
        
    <string>退?/span></string>  
    </dict>  
    </plist>  
    然后在代码中dQ?/span>

    CCDictionary *strings = CCDictionary::createWithContentsOfFile("fonts/strings.xml");

    const char *titleStr = (CCString*)strings->objectForKey("title")->m_sString.c_str();

    ......



    Hiji 2013-01-15 19:26 发表评论
    ]]>
    Activity.startActivityForResulthttp://www.aygfsteel.com/demibug/archive/2013/01/01/393686.htmlHijiHijiTue, 01 Jan 2013 15:14:00 GMThttp://www.aygfsteel.com/demibug/archive/2013/01/01/393686.htmlhttp://www.aygfsteel.com/demibug/comments/393686.htmlhttp://www.aygfsteel.com/demibug/archive/2013/01/01/393686.html#Feedback0http://www.aygfsteel.com/demibug/comments/commentRss/393686.htmlhttp://www.aygfsteel.com/demibug/services/trackbacks/393686.html阅读全文

    Hiji 2013-01-01 23:14 发表评论
    ]]>
    遍历hash maphttp://www.aygfsteel.com/demibug/archive/2013/01/01/393669.htmlHijiHijiMon, 31 Dec 2012 21:01:00 GMThttp://www.aygfsteel.com/demibug/archive/2013/01/01/393669.htmlhttp://www.aygfsteel.com/demibug/comments/393669.htmlhttp://www.aygfsteel.com/demibug/archive/2013/01/01/393669.html#Feedback0http://www.aygfsteel.com/demibug/comments/commentRss/393669.htmlhttp://www.aygfsteel.com/demibug/services/trackbacks/393669.html
    // 遍历hashmap Itterator< Map.Entry<K,V> >
                    Iterator<Map.Entry<String, String>> iter = wallLayer.properties.entrySet().iterator();
                    while (iter.hasNext()) {
                        Entry<String, String> entry = iter.next();
                        Gdx.app.log(entry.getKey().toString(), entry.getValue().toString());
                    }
                    for (int i = 0; i < wallLayer.tiles.length; i++) {
                        int arr2[] = wallLayer.tiles[i];
                        for (int j = 0; j < arr2.length; j ++)
                        Gdx.app.log("tiles[" + i + "][" + j + "]", Integer.toString(wallLayer.tiles[i][j]));
                    }


    Hiji 2013-01-01 05:01 发表评论
    ]]>
    վ֩ģ壺 | | ζ| ޭ| | | | | | Զ| | ǿ| | | ҳ| Ͽ| | | | | | ʡ| ̩| | Ϫ| ޻| ϰˮ| Ϸ| | ʤ| | | | Ϫ| ¡| ̨| ٹ| ˮ| ƺ| ̫| Դ|