锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲午夜久久久久久久久久,亚洲熟女www一区二区三区,亚洲一区二区三区四区视频http://www.tkk7.com/demibug/zh-cnSun, 11 May 2025 06:05:55 GMTSun, 11 May 2025 06:05:55 GMT60- PS 濡備綍鍘婚櫎鍏夋檿鐨勯粦鑹茶儗鏅?/title>http://www.tkk7.com/demibug/archive/2013/03/20/396721.htmlHijiHijiWed, 20 Mar 2013 04:19:00 GMThttp://www.tkk7.com/demibug/archive/2013/03/20/396721.htmlhttp://www.tkk7.com/demibug/comments/396721.htmlhttp://www.tkk7.com/demibug/archive/2013/03/20/396721.html#Feedback1http://www.tkk7.com/demibug/comments/commentRss/396721.htmlhttp://www.tkk7.com/demibug/services/trackbacks/396721.html鑳屾櫙鑹叉槸綰粦鐨勶紵
杞埌閫氶亾闈㈡澘錛屾寜浣廋trl+Shift閿紝渚濇鐐瑰嚮綰㈢豢钃濅笁涓氶亾錛屽緱鍒板厜鏅曠殑閫夊尯銆傞変腑鍥懼眰錛屾寜涓婥trl+J閿紝寰楀埌鍏夋檿鍥懼眰銆傞殣钘忚儗鏅浘灞傘傛鏃剁殑鍏夋檿鍖呭惈鏈夊皯閲忛忔槑鐨勯粦搴曪紝鍥犱負鑳屾櫙鏄粦鑹詫紝褰撴妸閫忔槑鐨勫厜鏅曞浘灞傛斁鍒板埆鐨勫浘灞備笂鏃訛紝灝嗘販鍚堟ā寮忔敼涓?#8220;婊よ壊”鍗沖彲杈懼埌灞忚斀榛戣壊鑳屾櫙鐨勭洰鐨勩?br />鎴栬呯敤鑳屾櫙姍$毊鎿︼紝浣嗘槸鏁堟灉涓嶆槸寰堝ソ銆?/pre>
]]> - cocos2d-x 2.0鐗堟湰 鑷傚簲灞忓箷鍒嗚鯨鐜?/title>http://www.tkk7.com/demibug/archive/2013/03/13/396355.htmlHijiHijiTue, 12 Mar 2013 17:25:00 GMThttp://www.tkk7.com/demibug/archive/2013/03/13/396355.htmlhttp://www.tkk7.com/demibug/comments/396355.htmlhttp://www.tkk7.com/demibug/archive/2013/03/13/396355.html#Feedback0http://www.tkk7.com/demibug/comments/commentRss/396355.htmlhttp://www.tkk7.com/demibug/services/trackbacks/396355.html鎴戜嬌鐢ㄧ殑鐗堟湰鏄痗ocos2d-2.0-x-2.0.4錛宑ocos2dx-2.0鐗堟湰瀵瑰鍒嗚鯨鐜囬傞厤鎻愪緵浜嗗緢濂界殑鏀寔錛屼嬌鐢ㄨ搗鏉ユ瘮1.0鐗堟湰瑕佺畝鍗曚簺錛?.0鐗堟湰鐨勯傞厤鍙互鍙傝?a target="_blank" style="color: #950000; text-decoration: initial;">榪欑瘒鍗氭枃銆?br />1. 鍋?.0鐗堟湰鐨勯傞厤棣栧厛闇瑕佷簡瑙d笅闈㈣繖浜涚煡璇嗐?br />(1)閫傞厤絳栫暐
2.0鐗堟湰鎻愪緵浜嗕笁縐嶉傞厤絳栫暐錛?br />kResolutionNoBorder錛?/span>瓚呭嚭灞忓箷鐨勯儴鍒嗕細琚鍓紝涓や晶娌℃湁榛戣竟錛岄摵婊″睆騫曪紝鎸夊浘鐗囧師濮嬫瘮渚嬫樉紺猴紝鍥劇墖涓嶅彉褰€?br />kResolutionShowAll錛?/span>鏁翠釜娓告垙鐣岄潰鏄彲瑙佺殑錛屼細鎸夊師濮嬫瘮渚嬭繘琛岀緝鏀撅紝鍥劇墖涓嶅彉褰紝浣嗕袱渚у彲鑳戒細鐣欐湁榛戣竟錛屼笉閾烘弧灞忓箷銆?br />kResolutionExactFit錛?/span>鏁翠釜娓告垙鐣岄潰鏄彲瑙佺殑錛屽浘鐗囧彲鑳戒細榪涜鎷変幾鎴栬呭帇緙╁鐞嗭紝閾烘弧灞忓箷錛屽浘鐗囦細鍙樺艦銆?br />鍙互鏍規嵁鑷繁鐨勮姹傞夋嫨銆?br />(2)VisibleSize鍜孷isibleOrigin
getVisibleSize錛氳〃紺鴻幏寰楄鍙?鍙鍖哄煙)鐨勫ぇ灝忥紝濡傛灉DesignResolutionSize璺熷睆騫曞昂瀵鎬竴鏍峰ぇ錛屽垯getVisibleSize絳変簬getWinSize銆?br />getVisibleOrigin錛氳〃紺哄彲瑙嗗尯鍩熺殑璧風偣鍧愭爣錛岃繖鍦ㄥ鐞嗙浉瀵逛綅緗殑鏃跺欓潪甯告湁鐢紝紜繚鑺傜偣鍦ㄤ笉鍚屽垎杈ㄧ巼涓嬬殑浣嶇疆涓鑷淬?br />(3)DesignResolutionSize
DesignResolutionSize鏄竴涓瘮杈冮噸瑕佺殑姒傚康錛屽叾瀹?.0鐗堟湰鐨勯傞厤璺?.0鐗堟湰鍘熺悊宸笉澶氾紝閮芥槸鎸夋瘮渚嬭繘琛岀緝鏀俱傝繖涓狣esignResolutionSize琛ㄧず璁捐鏂規錛屽氨鏄綘鐨勬父鎴忓畬緹庢敮鎸佺殑鍒嗚鯨鐜囨柟妗堬紝涓鑸牴鎹浘鐗囪祫婧愮殑灝哄鏉ュ畾錛岃嚜閫傞厤鏃朵細鎸夌収榪欎釜鍒嗚鯨鐜囪綆楀嚭緙╂斁鍥犲瓙銆傚洜姝わ紝榪欎釜鍊間篃搴旇鏄姩鎬佺殑錛屽鏋滄槸妯睆娓告垙鍒欓珮搴﹁偗瀹氭槸閾烘弧灞忓箷鐨勶紝瀹藉害涔熻灝藉彲鑳界殑閾烘弧灞忓箷錛屽洜姝ゅ簲璇ラ夋嫨瀹介珮姣旀渶澶х殑浣滀負璁捐鍒嗚鯨鐜囷紝涓嬮潰鐨刣emo浼氱粰鍑轟嬌鐢ㄦ柟娉曘?br />(4)璁劇疆鐩稿浣嶇疆
鍦ㄦ父鎴忎腑浣跨敤鐩稿浣嶇疆璁劇疆鍧愭爣鐨勫ソ澶勬槸鏄捐屾槗瑙佺殑錛岃繖鏍峰氨涓嶉渶瑕佷負姣忎釜鍒嗚鯨鐜囬兘瀹氫箟涓濂楀潗鏍囦簡銆傞鍏堝緱瀹氫箟涓浜涘弬鑰冪偣錛屽紩鎿庣殑TestCpp渚嬪瓙涓氨鎻愪緵浜嗕竴縐嶆柟娉曪紝浠ュ睆騫曚笂鍙鍖哄煙鐨?涓偣浣滀負鍙傝冪偣錛岀浉褰撲簬鍦ㄨ鐭╁艦鍐呭啓涓涓背瀛楋紝榪?涓偣鍒嗗埆鏄細宸︿笂銆佸乏銆佸乏涓嬨佷笅銆佸彸涓嬨佸彸銆佸彸涓娿佷笂銆佷腑蹇冦?/p>2. 涓嬮潰鏉ュ疄鐜頒竴涓畝鍗曠殑demo錛岄鍏堝垱寤轟竴涓獁in32宸ョ▼錛岃繖涓氨涓嶈榪頒簡銆?br />(1)鍒涘緩涓涓狝ppMacros.h鏂囦歡錛屽畾涔変簡涓浜涘畯錛屾簮鐮佸涓嬶細
- #ifndef __APPMACROS_H__
- #define __APPMACROS_H__
-
- #include "cocos2d.h"
-
- typedef struct tagResource
- {
- cocos2d::CCSize size;
- char directory[100];
- }Resource;
-
- //鍙敤鐨勮祫婧愬昂瀵?nbsp;
- static Resource smallResource = { cocos2d::CCSizeMake(480, 320), "iphone" };
- static Resource mediumResource = { cocos2d::CCSizeMake(1024, 768), "ipad" };
- static Resource largeResource = { cocos2d::CCSizeMake(2048, 1536), "ipadhd" };
-
- //璁捐鏂規
- static cocos2d::CCSize smallDesignResolutionSize = cocos2d::CCSizeMake(480.0f, 320.0f);
- static cocos2d::CCSize mediumDesignResolutionSize = cocos2d::CCSizeMake(1024.0f, 768.0f);
- static cocos2d::CCSize largeDesignResolutionSize = cocos2d::CCSizeMake(2048.0f, 1536.0f);
-
- //緙╂斁鍥犲瓙錛屼富瑕佺粰鏂囧瓧鏍囩浣跨敤
- #define SCALE_FACTOR (cocos2d::CCEGLView::sharedOpenGLView()->getDesignResolutionSize().width / smallResource.size.width)
-
- #endif
(2)鎺ヤ笅鏉ヤ慨鏀笰ppDelegate.cpp鏂囦歡鐨刟pplicationDidFinishLaunching鍑芥暟錛屾坊鍔犱互涓嬩唬鐮侊細- bool AppDelegate::applicationDidFinishLaunching()
- {
- // initialize director
- CCDirector *pDirector = CCDirector::sharedDirector();
- CCEGLView *pEGLView = CCEGLView::sharedOpenGLView();
- pDirector->setOpenGLView(pEGLView);
-
- CCSize frameSize = pEGLView->getFrameSize();
- float ratio = frameSize.width / frameSize.height;
- float ratio1 = largeDesignResolutionSize.width / largeDesignResolutionSize.height;
- float ratio2 = mediumDesignResolutionSize.width / mediumDesignResolutionSize.height;
- float ratio3 = smallDesignResolutionSize.width / smallDesignResolutionSize.height;
- float d1 = abs(ratio - ratio1);
- float d2 = abs(ratio - ratio2);
- float d3 = abs(ratio - ratio3);
- std::map<float, CCSize> designSize;
- designSize[d1] = largeDesignResolutionSize;
- designSize[d2] = mediumDesignResolutionSize;
- designSize[d3] = smallDesignResolutionSize;
- std::map<float, CCSize>::reverse_iterator iter = designSize.rbegin();
- //寰楀埌key鏈澶х殑錛屽洜姝ゆ垜榪欓噷鏄í灞忥紝鎵浠ヤ互楂樺害涓哄熀鍑嗭紝涓轟簡紜繚緙╂斁鍚庡搴﹁兘鍏ㄥ睆錛屾墍浠ラ夊彇瀹介珮姣旀渶澶х殑涓鴻璁℃柟妗?nbsp;
- CCSize designResolutionSize = iter->second;
-
- //pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
- pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionShowAll);
- //pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionExactFit);
-
- if (frameSize.height > mediumResource.size.height)
- {
- CCFileUtils::sharedFileUtils()->setResourceDirectory(largeResource.directory);
- pDirector->setContentScaleFactor(largeResource.size.height/designResolutionSize.height);
- }
- else if (frameSize.height > smallResource.size.height)
- {
- CCFileUtils::sharedFileUtils()->setResourceDirectory(mediumResource.directory);
- pDirector->setContentScaleFactor(mediumResource.size.height/designResolutionSize.height);
- }
- else
- {
- CCFileUtils::sharedFileUtils()->setResourceDirectory(smallResource.directory);
- pDirector->setContentScaleFactor(smallResource.size.height/designResolutionSize.height);
- }
-
- pDirector->setDisplayStats(true);
-
- pDirector->setAnimationInterval(1.0 / 60);
-
- CCScene *pScene = HelloWorld::scene();
-
- pDirector->runWithScene(pScene);
-
- return true;
- }
(3)鍒涘緩VisibleRect.h鍜孷isibleRect.cpp鏂囦歡錛屽皝瑁呬簡鑾峰彇閭?涓偣鍧愭爣鐨勫嚱鏁幫紝姣旇緝綆鍗曘備唬鐮佸涓嬶細
VisibleRect.h- #ifndef __VISIBLERECT_H__
- #define __VISIBLERECT_H__
-
- #include "cocos2d.h"
- USING_NS_CC;
-
- class VisibleRect
- {
- public:
- static CCRect getVisibleRect();
-
- static CCPoint left();
- static CCPoint right();
- static CCPoint top();
- static CCPoint bottom();
- static CCPoint center();
- static CCPoint leftTop();
- static CCPoint rightTop();
- static CCPoint leftBottom();
- static CCPoint rightBottom();
- private:
- static void lazyInit();
- static CCRect s_visibleRect;
- };
-
- #endif
VisibleRect.cpp
- #include "VisibleRect.h"
-
- CCRect VisibleRect::s_visibleRect;
-
- void VisibleRect::lazyInit()
- {
- if (s_visibleRect.size.width == 0.0f && s_visibleRect.size.height == 0.0f)
- {
- CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
- s_visibleRect.origin = pEGLView->getVisibleOrigin();
- s_visibleRect.size = pEGLView->getVisibleSize();
- }
- }
-
- CCRect VisibleRect::getVisibleRect()
- {
- lazyInit();
- return CCRectMake(s_visibleRect.origin.x, s_visibleRect.origin.y, s_visibleRect.size.width, s_visibleRect.size.height);
- }
-
- CCPoint VisibleRect::left()
- {
- lazyInit();
- return ccp(s_visibleRect.origin.x, s_visibleRect.origin.y + s_visibleRect.size.height/2);
- }
-
- CCPoint VisibleRect::right()
- {
- lazyInit();
- return ccp(s_visibleRect.origin.x+s_visibleRect.size.width, s_visibleRect.origin.y + s_visibleRect.size.height/2);
- }
-
- CCPoint VisibleRect::top()
- {
- lazyInit();
- return ccp(s_visibleRect.origin.x + s_visibleRect.size.width/2, s_visibleRect.origin.y + s_visibleRect.size.height);
- }
-
- CCPoint VisibleRect::bottom()
- {
- lazyInit();
- return ccp(s_visibleRect.origin.x + s_visibleRect.size.width/2, s_visibleRect.origin.y);
- }
-
- CCPoint VisibleRect::center()
- {
- lazyInit();
- return ccp(s_visibleRect.origin.x + s_visibleRect.size.width/2, s_visibleRect.origin.y + s_visibleRect.size.height/2);
- }
-
- CCPoint VisibleRect::leftTop()
- {
- lazyInit();
- return ccp(s_visibleRect.origin.x, s_visibleRect.origin.y + s_visibleRect.size.height);
- }
-
- CCPoint VisibleRect::rightTop()
- {
- lazyInit();
- return ccp(s_visibleRect.origin.x + s_visibleRect.size.width, s_visibleRect.origin.y + s_visibleRect.size.height);
- }
-
- CCPoint VisibleRect::leftBottom()
- {
- lazyInit();
- return s_visibleRect.origin;
- }
-
- CCPoint VisibleRect::rightBottom()
- {
- lazyInit();
- return ccp(s_visibleRect.origin.x + s_visibleRect.size.width, s_visibleRect.origin.y);
- }
(4)淇敼HelloWorldScene.cpp鐨刬nit鍑芥暟錛屼嬌鐢ㄧ浉瀵逛綅緗緗潗鏍囥?/span>- bool HelloWorld::init()
- {
- if ( !CCLayer::init() )
- {
- return false;
- }
- CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
- "CloseNormal.png",
- "CloseSelected.png",
- this,
- menu_selector(HelloWorld::menuCloseCallback));
-
- pCloseItem->setPosition(ccpAdd(VisibleRect::rightBottom(),
- ccp(-pCloseItem->getContentSize().width/2, pCloseItem->getContentSize().height/2)));
-
- CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
- pMenu->setPosition(CCPointZero);
- this->addChild(pMenu, 1);
-
- CCLabelTTF* pLabel = CCLabelTTF::create("Hello World", "Arial", SCALE_FACTOR * 24);
- pLabel->setPosition(ccpAdd(VisibleRect::top(),
- ccp(0, -pLabel->getContentSize().height)));
- this->addChild(pLabel, 1);
-
- CCSprite* pSprite = CCSprite::create("HelloWorld.png");
- pSprite->setPosition(VisibleRect::center());
- this->addChild(pSprite, 0);
-
- CCSprite *pLogoSprite = CCSprite::create("icon.png");
- pLogoSprite->setAnchorPoint( ccp(0, 0.5) );
- pLogoSprite->setPosition(ccpAdd(VisibleRect::left(), ccp(50, 0)));
- this->addChild(pLogoSprite, 0);
-
- return true;
- }
(5)鍒涘緩紿楀彛錛宮ain.cpp鐨勪富瑕佸唴瀹癸細- AppDelegate app;
- CCEGLView* eglView = CCEGLView::sharedOpenGLView();
- //eglView->setFrameSize(2048, 1536);
- //eglView->setFrameSize(480, 320);
- //eglView->setFrameSize(800, 480);
- //eglView->setFrameSize(1024, 768);
- //eglView->setFrameSize(1280, 800);
- eglView->setFrameSize(1280, 768);
- //eglView->setFrameSize(960, 640);
- eglView->setFrameZoomFactor(0.5f);
-
- int ret = CCApplication::sharedApplication()->run();
OK錛屽埌姝や負姝紝浠g爜閮ㄥ垎宸茬粡瀹屾垚浜嗭紝涓嬮潰鐪嬬湅鍦ㄥ悇縐嶅垎杈ㄧ巼鍜屼笉鍚岀瓥鐣ヤ笅鐨勬晥鏋滃浘錛?/span>
1. kResolutionShowAll絳栫暐錛?/span>
(1)2048×1536
(2)1024×768

(3)480×320

2. kResolutionExactFit絳栫暐
1280×768鍒嗚鯨鐜?/span>
3. kResolutionNoBorder絳栫暐
1280×768鍒嗚鯨鐜?br />

demo婧愮爜錛歨ttp://download.csdn.net/detail/zhoujianghai/4847206
鏈枃閾炬帴錛歨ttp://codingnow.cn/cocos2d-x/975.html

]]> - 娣卞叆浜嗚ВCCSpritehttp://www.tkk7.com/demibug/archive/2013/03/11/396277.htmlHijiHijiMon, 11 Mar 2013 03:05:00 GMThttp://www.tkk7.com/demibug/archive/2013/03/11/396277.htmlhttp://www.tkk7.com/demibug/comments/396277.htmlhttp://www.tkk7.com/demibug/archive/2013/03/11/396277.html#Feedback0http://www.tkk7.com/demibug/comments/commentRss/396277.htmlhttp://www.tkk7.com/demibug/services/trackbacks/396277.html闃呰鍏ㄦ枃

]]> - CCsprite瀛︿範絎旇http://www.tkk7.com/demibug/archive/2013/03/11/396276.htmlHijiHijiMon, 11 Mar 2013 03:04:00 GMThttp://www.tkk7.com/demibug/archive/2013/03/11/396276.htmlhttp://www.tkk7.com/demibug/comments/396276.htmlhttp://www.tkk7.com/demibug/archive/2013/03/11/396276.html#Feedback0http://www.tkk7.com/demibug/comments/commentRss/396276.htmlhttp://www.tkk7.com/demibug/services/trackbacks/396276.html綺劇伒鏄父鎴忎腑鍗佸垎閲嶈鐨勭粍鎴愰儴鍒嗭紝闅忓鍙錛屽錛氭父鎴忚儗鏅丯PC銆佷漢鐗┿侀亾鍏風瓑銆傚湪cocos2d-x寮曟搸涓紝鍙鏄敤鍥劇墖灞曠ず鐨勶紝鍩烘湰涓婇渶瑕佷嬌鐢ㄧ簿鐏電被銆?br />1. 棣栧厛鏉ヤ簡瑙d竴涓嬭窡綺劇伒鐩稿叧鐨勫嚑涓被錛?/strong>
(1) CCTexture2D
鍙互鎶婂畠鐪嬫垚涓涓汗鐞嗭紝瀹冩槸cocos2d-x娓叉煋鍥懼艦鐨勯噸瑕佸弬鏁幫紝鐢ㄦ潵璐村浘錛屽洜涓篶ocos2d-x浣跨敤opengl es緇樺埗2d鍥懼艦鐨勶紝瀹冪殑灝哄鏄?鐨刵嬈℃柟銆備竴鑸氳繃浠ヤ笅鏂瑰紡鑾峰緱錛?/p>1 | CCTexture2D* cache = CCTextureCache::sharedTextureCache()->addImage( "hero.png" );
|
(2) CCSprite
榪欎釜灝辨槸綺劇伒綾伙紝鏄疌CNode鐨勫瓙綾伙紝瀹冪殑鍐呴儴灝佽浜咰CTexture2D(綰圭悊)錛屽彲浠ラ氳繃涓嬮潰鍑犵鏂瑰紡鍒濆鍖栫簿鐏靛璞°?/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琛ㄧず綺劇伒鐨勬煇涓甯э紝澶у鏁版儏鍐典笅綺劇伒鏈韓鐨勫浘鐗囨湁澶氬撫銆傚畠鍐呴儴灝佽浜咰CTexture2D鍜孋CRect錛屽彲浠ヤ粠涓涓ぇ鍥劇墖鍙栧嚭涓閮ㄥ垎浣滀負涓甯с?/code>
static CCSprite* spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
//pszSpriteFrameName琛ㄧず甯х殑鍚嶅瓧錛屾牴鎹撫鍚嶄粠鍐呭瓨涓彇鍑篊CSpriteFrame
static
|

]]> - 鍏充簬C++綾繪垚鍛樺嚱鏁扮殑閲嶈澆銆佽鐩栥侀殣钘忎笌virtual鍏抽敭瀛?/title>http://www.tkk7.com/demibug/archive/2013/03/10/396260.htmlHijiHijiSun, 10 Mar 2013 12:06:00 GMThttp://www.tkk7.com/demibug/archive/2013/03/10/396260.htmlhttp://www.tkk7.com/demibug/comments/396260.htmlhttp://www.tkk7.com/demibug/archive/2013/03/10/396260.html#Feedback0http://www.tkk7.com/demibug/comments/commentRss/396260.htmlhttp://www.tkk7.com/demibug/services/trackbacks/396260.html鏈榪戠湅<<楂樿川閲廋++>>鏃惰鍒扮殑鍏充簬鎴愬憳鍑芥暟鐨勯噸杞?瑕嗙洊/闅愯棌,鎶婃垜鐨勪竴鐐圭悊瑙e啓鍑烘潵,甯屾湜澶у鎵硅瘎涓庢寚姝?
1. 閲嶈澆銆佽鐩栦笌闅愯棌
1)錛庨噸杞斤細鎴愬憳鍑芥暟鍏鋒湁浠ヤ笅鐨勭壒寰佹椂鍙戠敓“閲嶈澆”
A錛庣浉鍚岀殑鑼冨洿錛堝悓涓涓被涓級
B錛庡嚱鏁扮殑鍚嶅瓧鐩稿悓
C錛庡弬鏁扮被鍨嬩笉鍚岋紙涓嶈兘榪涜闅愬紡綾誨瀷杞崲錛?/span>
D錛?/span>Virtual鍏抽敭瀛楀彲鏈夊彲鏃?/span>
2)錛庤鐩栵紙涔熷彨“緇ф壙”錛夛細鎸囨淳鐢熺被鍑芥暟瑕嗙洊鍩虹被鍑芥暟錛岀壒寰佹槸錛?/span>
A錛庝笉鍚岀殑鑼冨洿錛堝垎鍒綅浜庡熀綾諱笌媧劇敓綾諱腑錛?/span>
B錛庡嚱鏁板悕瀛楃浉鍚?/span>
C錛庡弬鏁扮浉鍚?/span>
D錛庡熀綾誨嚱鏁板繀欏繪湁virtual鍏抽敭瀛?/span>
3)錛庨殣钘忥細鏄寚媧劇敓綾葷殑鍑芥暟灞忚斀浜嗕笌鍏跺悓鍚嶇殑鍩虹被鍑芥暟錛岃鍒欏涓嬶細
A錛庡鏋滄淳鐢熺被鐨勫嚱鏁頒笌鍩虹被鐨勫嚱鏁板悓鍚嶏紝浣嗘槸鍙傛暟涓嶅悓錛屾鏃朵笉璁烘湁鏃?/span>virtual鍏抽敭瀛楋紝鍩虹被鐨勫嚱鏁伴兘灝嗚闅愯棌錛屾敞鎰忓埆涓庨噸杞芥販娣嗭級
B錛庡鏋滄淳鐢熺被鐨勫嚱鏁頒笌鍩虹被鐨勫嚱鏁板悓鍚嶏紝騫朵笖鍙傛暟涔熺浉鍚岋紝浣嗘槸鍩虹被鍑芥暟娌℃湁virtual鍏抽敭瀛楋紝姝ゆ椂鍩虹被鐨勫嚱鏁拌闅愯棌錛堟敞鎰忓埆涓庤鐩栨販娣嗭級
2錛庣湅涓嬮潰榪欎釜渚嬪瓙浠g爜錛?/span>
1 #include <iostream>
2 using std::cout;
3 using std::endl;
4
5 class Base
6 {
7 public:
8 virtual void f(float x){ cout << "Base::f(float) " << x << endl;}
9 void g(float x){ std::cout << "Base::g(float) " << x << std::endl;}
10 void h(float x){ std::cout << "Base::h(float) " << x <<std::endl;}
11 };
12
13 class Derived : public Base
14 {
15 public:
16 virtual void f(float x){ std::cout << "Derived::f(float) " << x << std::endl;}
17 void g(int x){ std::cout << "Derived::g(int) " << x << std::endl;}
18 void h(float x){ std::cout << "Derived::h(float) " << x << std::endl;}
19 };
20
21 void main(void)
22 {
23 Derived d;
24 Base *pb = &d;
25 Derived *pd = &d;
26
27 pb->f(3.14f);//Derived::f(float) 3.14
28 pd->f(3.14f);//Derived::f(float) 3.14
29
30 pb->g(3.14f);//Base::g(float) 3.14
31 pd->g(3.14f);//Derived::g(int) 3
32
33 pb->h(3.14f);//Base:h(float) 3.14
34 pd->h(3.14f);//Derived::h(float) 3.14
35 }
3. 瑙i噴
鍦?/span>27涓?/span>28琛岋紝媧劇敓綾葷殑Derived::f(float x)閫氳繃virtual鍏抽敭瀛楃戶鎵匡紙瑕嗙洊錛変簡鍩虹被鐨?/span>Base::f(float x)鏂規硶錛屾墍浠ヨ繖閲屾棤璁洪噰鏈夊熀綾繪寚閽堣繕鏄淳鐢熺被鎸囬拡錛屾渶鍚庤皟鐢ㄧ殑鍏跺疄閮芥槸Derived::f(float x)鏂規硶銆傝繖姝f槸涓鑸儏鍐墊垜浠墍鏈熸湜鐨勩?/span>
鍦?/span>30琛岋紝鐢變簬鍩虹被鐨?/span>Base::g()娌℃湁鐢?/span>virtual鍏抽敭瀛楀0鏄庯紝鎵浠ヨ繖閲屽畠涓嶄細琚淳鐢熺被鐨?/span>Derived::g()鏂規硶瑕嗙洊銆傛墍浠ラ氳繃鍩虹被鎸囬拡璁塊棶鏃跺彧鑳借闂埌Base::g(float x)錛岃屽湪31琛岄氳繃媧劇敓綾繪寚閽堟椂鍙互璁塊棶鐨勬柟娉曟湁Base::g(float x)鍜?/span>Derived::g(int x)錛岃繖涓や釜鏂規硶铏界劧鏂規硶鍚嶇浉鍚岃屼笖鍙傛暟涓嶅悓錛堜技涔庯級絎﹀悎閲嶈澆鐨勬爣鍑嗭紝浣嗘槸瀹冧滑鍗村垎灞炰簬涓嶅悓鐨?#8220;鍩?#8221;鍥犳閲嶈澆涓嶄細鍙戠敓錛岃繖鏃?/span>Derived::g(int x)灝卞彧鑳芥妸Base::g(float x)“闅愯棌”鎺夈?/span>
鍚屼笂錛屽湪絎?/span>33琛岄氳繃鍩虹被鎸囬拡鑳借闂殑鏂規硶鍙湁Base::h(float x)錛岀敱浜庤鏂規硶娌℃湁琚?/span>virtual鍏抽敭瀛楀0鏄庯紝鎵浠ヤ笉浼氳媧劇敓綾繪柟娉?/span>Derived::h(float x)“鏇挎崲”錛屽洜姝よ皟鐢ㄧ殑鏄?/span>Base::h(float x)銆傝屽湪絎?/span>34琛岄氳繃媧劇敓綾繪寚閽堝彲浠ヨ闂殑鏂規硶鍚屾椂鏈?/span>Base::h(float x)涓?/span>Derived::h(float x)錛岃繖浼間箮鍙堝啿紿侊紝鑰岃繖鏃?/span>C++鐨?#8220;闅愯棌”瑙勫垯鍙戠敓浣滅敤錛屾墍浠ユ淳鐢熺被鏂規硶Derived::h(float x)鎶婂熀綾繪柟娉?/span>Base::h(float x)“闅愯棌”錛屼簬鏄?/span>Derived::h(float x)琚皟鐢ㄣ?/span>
4錛庢葷粨
C++鐨?#8220;閲嶈澆”銆?#8220;緇ф壙”涓?#8220;闅愯棌”鏈哄埗姣斾竴鑸兂璞′腑鐨勮澶嶆潅錛岃岃繖灝辯獊鏄句簡virtual鍏抽敭瀛楃殑閲嶈鎬с傛墍浠ュ湪媧劇敓綾誨瓨鍦ㄧ殑鍓嶆彁涓嬩竴錛屼竴瀹氳鎶婂熀綾諱腑鍙兘鍦ㄦ淳鐢熺被涓篃瀹炵幇鐨勬柟娉曠敤virtual鍏抽敭瀛楀0鏄庛傞櫎闈炲湪鐗規畩鎯呭喌涓嬶紝姣斿闇瑕佹鏌ユ寚閽堢被鍨嬬殑鏃跺欍?/span>
1 #include <iostream>
2 using std::cout;
3 using std::endl;
4
5 class Base
6 {
7 public:
8 void CheckType(void){ cout << "This's Base Ptr" << endl;}
9 };
10
11 class Derived : public Base
12 {
13 public:
14 void CheckType(void){ cout << "This;s Derived Ptr" << endl;}
15 };
16
17 void main(void)
18 {
19 Derived d;
20 Base *pb = &d;
21 Derived *pd = &d;
22
23 pb->CheckType();//This's Base Ptr
24 pd->CheckType();//This's Derived Ptr
25 }
26

]]> - Cocos2dx浣跨敤 TexturePacker瀵煎嚭鐨?plisthttp://www.tkk7.com/demibug/archive/2013/03/10/396256.htmlHijiHijiSun, 10 Mar 2013 08:38:00 GMThttp://www.tkk7.com/demibug/archive/2013/03/10/396256.htmlhttp://www.tkk7.com/demibug/comments/396256.htmlhttp://www.tkk7.com/demibug/archive/2013/03/10/396256.html#Feedback0http://www.tkk7.com/demibug/comments/commentRss/396256.htmlhttp://www.tkk7.com/demibug/services/trackbacks/396256.htmlCCSpriteFrameCache* 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);

]]> - cocos2d涓瑿CCallFunc銆丆CCallFuncN鍜孋CCallFuncND鐨勫尯鍒?/title>http://www.tkk7.com/demibug/archive/2013/02/26/395756.htmlHijiHijiTue, 26 Feb 2013 07:36:00 GMThttp://www.tkk7.com/demibug/archive/2013/02/26/395756.htmlhttp://www.tkk7.com/demibug/comments/395756.htmlhttp://www.tkk7.com/demibug/archive/2013/02/26/395756.html#Feedback0http://www.tkk7.com/demibug/comments/commentRss/395756.htmlhttp://www.tkk7.com/demibug/services/trackbacks/395756.htmlcocos2d涓湁3縐嶅洖璋冩柟寮忥細CCCallFunc銆丆CCallFuncN鍜孋CCallFuncND
鍏朵腑錛屼粬浠湁浠涔堝尯鍒憿錛?/p>
榪欓噷鎴戠◢寰葷粨涓嬶紝涓嶅鐨勬榪庤璁哄拰鎷嶇爾錛?/p>
鐪嬫簮浠g爜鐨別xcute鏂規硶錛屾垜鎬葷粨涓嬮潰3鐐癸細
1. CCCallFunc
- -(void) execute
- {
- [targetCallback performSelector:selector];
- }
CCCallFunc鏄墽琛屽搴旂殑鍥炶皟鏂規硶錛屽叾涓洖璋冩柟娉曚笉鍙甫鍙傛暟銆?/p>
2. CCCallFuncN
- -(void) execute
- {
- [targetCallback performSelector:selector withObject:target];
- }
CCCallFuncN澶氬甫涓涓弬鏁幫紝鑰屽弬鏁版湰韜槸鍔ㄤ綔Aciton鏈韓銆傚氨鍍廢IButton閭f牱錛屾垜浠彲浠selector(btnUpInside:)錛屽甫鐨勫弬鏁板氨鏄疷IButton鏈韓銆?/p>
3. CCCallFuncND
- -(void) execute
- {
- [invocation_ setArgument:&target atIndex:2];
- [invocation_ setArgument:&data atIndex:3];
- [invocation_ invoke];
- }
CCCallFuncND甯?涓弬鏁幫紝涓涓槸鍔ㄤ綔Action鏈韓錛屼竴涓槸浣犺嚜宸卞畾涔夌殑鍥炶皟鍑芥暟鐨勫弬鏁般?/span>
]]>- Cocos2dx 涓枃鏀寔http://www.tkk7.com/demibug/archive/2013/01/15/394268.htmlHijiHijiTue, 15 Jan 2013 11:26:00 GMThttp://www.tkk7.com/demibug/archive/2013/01/15/394268.htmlhttp://www.tkk7.com/demibug/comments/394268.htmlhttp://www.tkk7.com/demibug/archive/2013/01/15/394268.html#Feedback1http://www.tkk7.com/demibug/comments/commentRss/394268.htmlhttp://www.tkk7.com/demibug/services/trackbacks/394268.html
灝嗛渶瑕佺殑瀛楃涓蹭繚瀛樹簬 strings.xml鏂囦歡涓細
<?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>鏄敺浜哄氨鍧氭寔20縐?/span></string>
<key>new_game</key>
<string>鏂版父鎴?/span></string>
<key>setting_game</key>
<string>璁劇疆</string>
<key>quit_game</key>
<string>閫鍑?/span></string>
</dict>
</plist>
鐒跺悗鍦ㄤ唬鐮佷腑璇誨彇錛?/span>CCDictionary *strings = CCDictionary::createWithContentsOfFile("fonts/strings.xml");
const char *titleStr = (CCString*)strings->objectForKey("title")->m_sString.c_str();
......

]]> - Activity.startActivityForResulthttp://www.tkk7.com/demibug/archive/2013/01/01/393686.htmlHijiHijiTue, 01 Jan 2013 15:14:00 GMThttp://www.tkk7.com/demibug/archive/2013/01/01/393686.htmlhttp://www.tkk7.com/demibug/comments/393686.htmlhttp://www.tkk7.com/demibug/archive/2013/01/01/393686.html#Feedback0http://www.tkk7.com/demibug/comments/commentRss/393686.htmlhttp://www.tkk7.com/demibug/services/trackbacks/393686.html闃呰鍏ㄦ枃

]]> - 閬嶅巻hash maphttp://www.tkk7.com/demibug/archive/2013/01/01/393669.htmlHijiHijiMon, 31 Dec 2012 21:01:00 GMThttp://www.tkk7.com/demibug/archive/2013/01/01/393669.htmlhttp://www.tkk7.com/demibug/comments/393669.htmlhttp://www.tkk7.com/demibug/archive/2013/01/01/393669.html#Feedback0http://www.tkk7.com/demibug/comments/commentRss/393669.htmlhttp://www.tkk7.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]));
}

]]>
主站蜘蛛池模板:
久久精品国产这里是免费|
亚洲av无码成h人动漫无遮挡|
无码国产精品一区二区免费式芒果
|
亚洲中文字幕在线观看|
免费看美女让人桶尿口|
18成禁人视频免费网站|
国产午夜不卡AV免费|
日本中文字幕免费看|
亚洲av成本人无码网站|
亚洲成a人片在线不卡|
亚洲国产一区在线|
亚洲精品乱码久久久久久蜜桃不卡|
国产一区视频在线免费观看
|
亚洲综合激情六月婷婷在线观看
|
91在线免费观看|
黄色一级毛片免费看|
亚洲另类无码专区首页|
亚洲五月综合缴情婷婷|
亚洲伦理中文字幕|
亚洲国产精品久久久久秋霞影院|
久久亚洲免费视频|
国产亚洲美女精品久久久久狼
|
日本免费A级毛一片|
中文在线日本免费永久18近|
思思久久99热免费精品6|
亚洲av乱码中文一区二区三区|
亚洲中文精品久久久久久不卡|
亚洲不卡1卡2卡三卡2021麻豆|
亚洲一区动漫卡通在线播放|
亚洲福利视频网址|
亚洲国产韩国一区二区|
亚洲色图激情文学|
亚洲色无码专区一区|
亚洲欧美成人一区二区三区|
亚洲中文无码mv|
国产成人高清亚洲一区91|
免费人成在线观看播放a|
四虎影视永久在线精品免费|
一区二区三区免费在线视频|
一日本道a高清免费播放
|
伊人久久大香线蕉亚洲|