コード例 #1
0
ファイル: SpriteReader.cpp プロジェクト: fjz13/Medusa
INode* SpriteReader::CreateNodeWithFlatBuffers(INodeEditor& editor, const flatbuffers::Table* spriteOptions, const StringRef& className /*= StringRef::Empty*/, NodeCreateFlags flags /*= NodeCreateFlags::None*/)
{
	auto options = (flatbuffers::SpriteOptions*)spriteOptions;
	auto sprite = CreateSprite(options->fileNameData()->path()->c_str());
	SetPropsWithFlatBuffers(sprite, (flatbuffers::Table*) options->nodeOptions());
	return sprite;
}
コード例 #2
0
 Component* ComAudioReader::createComAudioWithFlatBuffers(const flatbuffers::Table *comAudioOptions)
 {
     auto options = (ComAudioOptions*)comAudioOptions;
     
     Component* component = ComAudio::create();
     ComAudio* audio = static_cast<ComAudio*>(component);
     
     auto fileNameData = options->fileNameData();
     
     int resourceType = fileNameData->resourceType();
     switch (resourceType)
     {
         case 0:
         {
             std::string path = fileNameData->path()->c_str();
             audio->setFile(path.c_str());
             break;
         }
             
         default:
             break;
     }
     
     bool loop = options->loop() != 0;
     audio->setLoop(loop);
     
     audio->setName(options->name()->c_str());
     
     return component;
 }
コード例 #3
0
ファイル: ImageViewReader.cpp プロジェクト: fjz13/Medusa
INode* ImageViewReader::CreateNodeWithFlatBuffers(INodeEditor& editor, const flatbuffers::Table* imageOptions, const StringRef& className, NodeCreateFlags flags /*= NodeCreateFlags::None*/)
{
    auto options = (flatbuffers::ImageViewOptions*)imageOptions;
    StringRef fullName = options->fileNameData()->path()->c_str();
    auto fileId = FileId::ParseFrom(fullName);
    auto sprite = CreateNineGridSprite(options->scale9Enabled(), options->scale9Size(), options->widgetOptions()->size(), options->capInsets(), fileId);
    SetPropsWithFlatBuffers(sprite, (flatbuffers::Table*) options->widgetOptions(), flags);
    return sprite;
}
コード例 #4
0
ファイル: TextBMFontReader.cpp プロジェクト: fjz13/Medusa
INode* TextBMFontReader::CreateNodeWithFlatBuffers(INodeEditor& editor, const flatbuffers::Table* textOptions, const StringRef& className, NodeCreateFlags flags /*= NodeCreateFlags::None*/)
{
	auto options = (flatbuffers::TextBMFontOptions*)textOptions;
	auto fileId = FileId::ParseFrom(options->fileNameData()->path()->c_str());
	FontId fontId;
	fontId = FontFactory::Instance().ExistsOrDefault(fileId);
	ILabel* label = NodeFactory::Instance().CreateSingleLineLabel(fontId, options->text()->c_str());
	label->SetColor(Color4F::White);
	SetPropsWithFlatBuffers(label, (flatbuffers::Table*) options->widgetOptions(), flags);
	return label;
}