This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Card::flipAction() { | |
CCSize winSize = CCDirector::sharedDirector()->getWinSize(); | |
CCSprite* card = CCSprite::spriteWithFile("card_face.png"); | |
card->setPosition(ccp(winSize.width/2, winSize.height/2)); | |
this->addChild(card, CARD_FACE_TAG, CARD_FACE_TAG); | |
card->setVisible(false); | |
CCSprite* card2 = CCSprite::spriteWithFile("card.png"); | |
card2->setPosition(card->getPosition()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool HelloWorld::init() | |
{ | |
if ( !CCLayer::init() ) | |
{ | |
return false; | |
} | |
CCSize size = CCDirector::sharedDirector()->getWinSize(); | |
CCSprite* sprite = CCSprite::create("Icon-72.png"); | |
CCProgressTimer* timer = CCProgressTimer::create(sprite); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary(); | |
CCBReader * ccbReader = new CCBReader(ccNodeLoaderLibrary); | |
CCNode* node = ccbReader->readNodeGraphFromFile("CCTestLayer.ccbi"); | |
CCScene * scene = CCScene::create(); | |
if(node != NULL) { | |
scene->addChild(node); | |
} | |
ccbReader->release(); | |
CCDirector::sharedDirector(->runWithScene(scene); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary(); | |
ccNodeLoaderLibrary->registerCCNodeLoader("CCTestLayer", TestBuilderLoader::loader()); | |
CCBReader * ccbReader = new CCBReader(ccNodeLoaderLibrary); | |
CCNode* node = ccbReader->readNodeGraphFromFile("CCTestLayer.ccbi"); | |
CCScene * scene = CCScene::create(); | |
if(node != NULL) { | |
scene->addChild(node); | |
} | |
ccbReader->release(); | |
CCDirector::sharedDirector()->runWithScene(scene); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "CCTestLayer.h" | |
USING_NS_CC; | |
USING_NS_CC_EXT; | |
SEL_MenuHandler CCTestLayer::onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName) | |
{ | |
CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(this, "menuTapped", CCTestLayer::menuTapped); | |
return NULL; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ModalLayer.h" | |
using namespace cocos2d; | |
bool ModalLayer::init() | |
{ | |
if ( !CCLayer::init() ) | |
{ | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CCSize size = CCDirector::sharedDirector()->getWinSize(); | |
CCRect spriteRect = CCRectMake(0, 0, 70, 70); | |
CCRect capInsents = CCRectMake(6, 6, 58, 58); | |
CCScale9Sprite* backgroundSprite = CCScale9Sprite::create("9x9.png", spriteRect, capInsents); | |
CCLabelTTF* label = CCLabelTTF::create("ボタン1", "Arial", 30); | |
CCControlButton* button = CCControlButton::create(label, backgroundSprite); | |
button->setPreferredSize(CCSizeMake(200, 60)); | |
button->setPosition(ccp(50+button->getContentSize().width/2, size.height/2+button->getContentSize().height)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/cocos2dx/platform/CCFileUtils.cpp b/cocos2dx/platform/CCFileUtils.cpp | |
index ba5b497..0faafa7 100755 | |
--- a/cocos2dx/platform/CCFileUtils.cpp | |
+++ b/cocos2dx/platform/CCFileUtils.cpp | |
@@ -533,6 +533,7 @@ const char* CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const | |
void CCFileUtils::setSearchResolutionsOrder(const std::vector<std::string>& searchResolutionsOrder) | |
{ | |
bool bExistDefault = false; | |
+ m_fullPathCache.clear(); | |
m_searchResolutionsOrderArray.clear(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool HelloWorld::areSpritesColliding(cocos2d::CCSprite *spr1, cocos2d::CCSprite *spr2, bool pp) { | |
bool isColliding = false; | |
CCRect intersection; | |
CCRect r1 = spr1->boundingBox(); | |
CCRect r2 = spr2->boundingBox(); | |
// Look for simple bounding box collision | |
if (r1.intersectsRect(r2)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export ANT_ROOT=/usr/local/bin | |
export NDK_ROOT=/path/to/android-ndk | |
export ANDROID_SDK_ROOT=/path/to/android-sdk | |
export COCOS_CONSOLE_ROOT=/path/to/cocos2d-x/tools/cocos2d-console/bin | |
$COCOS_CONSOLE_ROOT/cocos run -s $SRCROOT/../ -p android |
OlderNewer