Esempio n. 1
0
bool Card::initWithNum(int num){
    CCSprite::init();
    _num = num;
    
    setContentSize(CCSize(80, 80));
    
    recto = CCSprite::create();
    recto->setTextureRect(CCRect(0, 0, 80, 80));
    recto->setColor(ccc3(0, 0, 255));
    recto->setAnchorPoint(ccp(0,0));
    addChild(recto);
    label = CCLabelTTF::create(CCString::createWithFormat("%d",num)->getCString(), "Courier", 60);
    recto->addChild(label);
    label->setPosition(ccp(40, 40));
    
    verso = CCSprite::create();
    verso->setAnchorPoint(ccp(0, 0));
    verso->setTextureRect(CCRect(0, 0, 80, 80));
    verso->setColor(ccc3(255, 0, 0));
    addChild(verso);
    
    setAnchorPoint(ccp(0, 0));
    
    showRecto();
    return true;
}
Esempio n. 2
0
bool Card::init(){
    CCSprite::init();
    
    setContentSize(CCSizeMake(80, 80));
    setAnchorPoint(ccp(0,0));
    
    recto = CCLabelTTF::create("2", "Courier", 48);
    recto->setPosition(ccp(40, 40));
    addChild(recto);
    
    verso = CCSprite::create();
    verso->setTextureRect(CCRectMake(0, 0, 80, 80));
    verso->setColor(ccc3(255, 255, 255));
    verso->setAnchorPoint(ccp(0, 0));
    addChild(verso);
    
    showRecto();
    
    return true;
}