void Ajustes::initTitulo(){ LayerColor *capaPosTitulo = LayerColor::create(Color4B(23, 70, 108, 210), cuadroJuego->getContentSize().width-(espacioBordesCuadro*escala*2), 200*escala); capaPosTitulo->setAnchorPoint(Vec2(0,1)); capaPosTitulo->setPosition(anchoLateralCE+(espacioSuperiorBtAtras*escala),visibleSize.height-(200*escala)-(espacioSuperiorBtAtras*escala)); capaPosTitulo->setZOrder(1); this->addChild(capaPosTitulo); tituloEscena = CCLabelTTF::create(LanguageManager::getInstance()->getString("AjustesLbTitulo"), "HVD_Comic_Serif_Pro.ttf", 130*escala,CCSizeMake(anchoNoLateralCE, capaPosTitulo->getContentSize().height), TextHAlignment::CENTER); tituloEscena->setColor(Color3B(216,254,51)); tituloEscena->setVerticalAlignment(TextVAlignment::CENTER); tituloEscena->setAnchorPoint(Vec2(0, 0)); tituloEscena->setPosition(anchoLateralCE,capaPosTitulo->getPositionY()); tituloEscena->setZOrder(10); this->addChild(tituloEscena, 1); tituloEscena->retain(); }
void FriendListScene::buildScene() { _friendDictionary.clear(); _friendList.clear(); _tableView = NULL; _downloadCount = 0; const char* headerString = ""; switch (_selectedFriendCircle) { case ALL_FRIENDS: headerString = "All Friends"; break; case INSTALLED_ONLY: headerString = "Friends Playing Game"; break; case NON_PLAYING_ONLY: headerString = "Friends not Playing Game"; break; case MY_DEVICE_ONLY: #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) headerString = "Friends playing on iOS Device"; #else headerString = "Friends playing on Android Device"; #endif default: break; } //_friendList = CCArray::createWithCapacity(5); //_friendList->retain(); CCLOG("ALL Request count = %lu", _friendList.size()); // Add background layers to the scene. LayerColor *bg = LayerColor::create(Color4B(255, 255, 255, 255), AppDelegate::SCREEN_WIDTH, AppDelegate::SCREEN_HEIGHT); this->addChild(bg); LayerColor *secondBG = LayerColor::create(Color4B(95, 95, 95, 255), AppDelegate::SCREEN_WIDTH - SCALED_VALUE(20.0f), AppDelegate::SCREEN_HEIGHT - SCALED_VALUE(20.0f)); secondBG->setPosition(Point(SCALED_VALUE(10.0f), SCALED_VALUE(10.0f))); this->addChild(secondBG); // Set the table header. LayerColor *header = LayerColor::create(Color4B(66, 66, 66, 255), AppDelegate::SCREEN_WIDTH - SCALED_VALUE(20.0f), SCALED_VALUE(100.0f)); header->setAnchorPoint(Point(0, 0)); header->setPosition(Point(SCALED_VALUE(10.0f), AppDelegate::SCREEN_HEIGHT - SCALED_VALUE(110.0f))); this->addChild(header); // Set the header text. auto headerText = LabelTTF::create(headerString, "Arial", SCALED_VALUE(40.0f)); headerText->setAnchorPoint(Point(0.0f, 0.5f)); header->addChild(headerText); headerText->setPositionX(SCALED_VALUE(28.0f)); headerText->setPositionY(header->getContentSize().height/2); // Add back button go back to previous scene MenuItemImage *backButton = MenuItemImage::create(); backButton->setNormalSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("btn_table_back_nrl")); backButton->setSelectedSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("btn_table_back_prd")); backButton->setCallback(CC_CALLBACK_1(FriendListScene::backButtonPressed, this)); backButton->setAnchorPoint(Point(1.0f, 0.5)); Menu* backMenu = Menu::create(backButton, NULL); header->addChild(backMenu); backMenu->setPositionX(header->getContentSize().width - SCALED_VALUE(20.0f)); backMenu->setPositionY(header->getContentSize().height/2); // Create the table view. float tableHeight = bg->getContentSize().height - secondBG->getPositionY() - (header->getContentSize().height) - SCALED_VALUE(10); _tableView = TableView::create(this, Size(secondBG->getContentSize().width, tableHeight)); _tableView->setAnchorPoint(Point(0, 0.0)); _tableView->setDirection(ScrollView::Direction::VERTICAL); _tableView->setPosition(Point(SCALED_VALUE(10.0f), SCALED_VALUE(10))); _tableView->setDelegate(this); this->addChild(_tableView); }