void writeArray(H5::Group &group, const std::string &name, const std::vector<int32_t> &values) { DataType dataType(PredType::NATIVE_INT32); DataSpace dataSpace = getDataSpace(values); DSetCreatPropList propList = getPropList(values.size()); auto data = group.createDataSet(name, dataType, dataSpace, propList); data.write(&(values[0]), dataType); }
bool LevelStartView::init() { if (!Layer::init()) { return false; } /*初始化道具选择列表*/ for (int i = 1; i <= PROP_SELECT_NUM; i++) { Sprite *pInitPropSelect = Sprite::create(); pInitPropSelect->retain(); m_propSelect.insert(std::pair<int, Sprite*>(i,pInitPropSelect)); } /*初始化道具列表*/ getPropList(); auto *rootNode = CSLoader::createNode("StartScene.csb"); Layer *pLeaderboard = static_cast<Layer *>(rootNode->getChildByName("LeaderboardPanel")); pLeaderboard->setPosition(500, 210); auto moveTo = MoveTo::create(0.7f, Point(220, 210)); pLeaderboard->runAction(moveTo); Layer *pStart = static_cast<Layer *>(rootNode->getChildByName("StartPanel")); ui::Button *pnextBtn = static_cast<ui::Button *>(pStart->getChildByName("nextBtn")); pnextBtn->addClickEventListener(CC_CALLBACK_1(LevelStartView::nextLevelCallback, this)); ui::Button *pcloseBtn = static_cast<ui::Button *>(pStart->getChildByName("closeBtn")); pcloseBtn->addClickEventListener(CC_CALLBACK_1(LevelStartView::layerCloseCallback, this)); initPropList(pStart); this->addChild(rootNode); return true; }