本文整理汇总了C++中Sprite::GetRelativePathname方法的典型用法代码示例。如果您正苦于以下问题:C++ Sprite::GetRelativePathname方法的具体用法?C++ Sprite::GetRelativePathname怎么用?C++ Sprite::GetRelativePathname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite
的用法示例。
在下文中一共展示了Sprite::GetRelativePathname方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EnumerateSpritesForParticleEmitter
void SpritePackerHelper::EnumerateSpritesForParticleEmitter(ParticleEmitter* emitter, Map<String, Sprite *> &sprites)
{
if (!emitter)
{
return;
}
Vector<ParticleLayer*> & layers = emitter->GetLayers();
int32 layersCount = layers.size();
for (int il = 0; il < layersCount; ++il)
{
ParticleLayer* curLayer = layers[il];
Sprite *sprite = curLayer->GetSprite();
if (sprite)
{
sprites[sprite->GetRelativePathname().GetAbsolutePathname()] = sprite;
}
// Superemitter layers might have inner emitter with its own sprites.
if (curLayer->GetInnerEmitter())
{
EnumerateSpritesForParticleEmitter(curLayer->GetInnerEmitter(), sprites);
}
}
}
示例2: UpdatePushButtonWidgetWithFont
void TextPropertyGridWidget::UpdatePushButtonWidgetWithFont(QPushButton *pushButtonWidget, Font* font)
{
if (pushButtonWidget != this->ui->fontSelectButton)
{
return; //Not font select button
}
if (font)
{
//Set button text
Font::eFontType fontType = font->GetFontType();
QString buttonText;
switch (fontType)
{
case Font::TYPE_FT:
{
FTFont *ftFont = static_cast<FTFont*>(font);
//Set pushbutton widget text
buttonText = QString::fromStdString(ftFont->GetFontPath().GetFrameworkPath());
break;
}
case Font::TYPE_GRAPHICAL:
{
GraphicsFont *gFont = static_cast<GraphicsFont*>(font);
//Put into result string font definition and font sprite path
Sprite *fontSprite = gFont->GetFontSprite();
if (!fontSprite) //If no sprite available - quit
{
pushButtonWidget->setText("Graphical font is not available");
return;
}
//Get font definition and sprite relative path
QString fontDefinitionName = QString::fromStdString(gFont->GetFontDefinitionName().GetFrameworkPath());
QString fontSpriteName =QString::fromStdString(fontSprite->GetRelativePathname().GetFrameworkPath());
//Set push button widget text - for grapics font it contains font definition and sprite names
buttonText = QString("%1\n%2").arg(fontDefinitionName, fontSpriteName);
break;
}
case Font::TYPE_DISTANCE:
{
DFFont *dfFont = static_cast<DFFont*>(font);
//Set pushbutton widget text
buttonText = QString::fromStdString(dfFont->GetFontPath().GetFrameworkPath());
break;
}
default:
{
//Do nothing if we can't determine font type
return;
}
}
pushButtonWidget->setText(buttonText);
}
}
示例3: GetSpriteNameForState
QString UIButtonMetadata::GetSpriteNameForState(UIControl::eControlState state) const
{
Sprite* sprite = GetActiveUIButton()->GetStateSprite(state);
if (sprite == NULL)
{
return "<No sprite is set>";
}
return sprite->GetRelativePathname().c_str();
}
示例4: GetSpriteNameForState
QString UIButtonMetadata::GetSpriteNameForState(UIControl::eControlState state) const
{
Sprite* sprite = GetActiveUIButton()->GetStateSprite(state);
if (sprite == NULL)
{
return StringConstants::NO_SPRITE_IS_SET;
}
return sprite->GetRelativePathname().c_str();
}
示例5: UpdatePushButtonWidgetWithPropertyValue
void UITextFieldPropertyGridWidget::UpdatePushButtonWidgetWithPropertyValue(QPushButton *pushButtonWidget, const QMetaProperty &curProperty)
{
if (pushButtonWidget != this->ui->fontSelectButton)
{
return; //Not font select button
}
bool isPropertyValueDiffers = false;
Font *fontPropertyValue = PropertiesHelper::GetPropertyValue<Font *>(this->activeMetadata,
curProperty.name(), isPropertyValueDiffers);
if (fontPropertyValue)
{
//Set button text
WidgetSignalsBlocker blocker(pushButtonWidget);
Font::eFontType fontType = fontPropertyValue->GetFontType();
QString buttonText;
switch (fontType)
{
case Font::TYPE_FT:
{
FTFont *ftFont = dynamic_cast<FTFont*>(fontPropertyValue);
//Set pushbutton widget text
buttonText = QString::fromStdString(ftFont->GetFontPath().GetFrameworkPath());
break;
}
case Font::TYPE_GRAPHICAL:
{
GraphicsFont *gFont = dynamic_cast<GraphicsFont*>(fontPropertyValue);
//Put into result string font definition and font sprite path
Sprite *fontSprite = gFont->GetFontSprite();
if (!fontSprite) //If no sprite available - quit
{
pushButtonWidget->setText("Graphical font is not available");
return;
}
//Get font definition and sprite relative path
QString fontDefinitionName = QString::fromStdString(gFont->GetFontDefinitionName().GetFrameworkPath());
QString fontSpriteName =QString::fromStdString(fontSprite->GetRelativePathname().GetFrameworkPath());
//Set push button widget text - for grapics font it contains font definition and sprite names
buttonText = QString("%1\n%2").arg(fontDefinitionName, fontSpriteName);
break;
}
default:
{
//Do nothing if we can't determine font type
return;
}
}
pushButtonWidget->setText(buttonText);
}
}
示例6: GetGraphicsFontPath
QString ResourcesManageHelper::GetGraphicsFontPath(Font* font)
{
if (font && (font->GetFontType() == Font::TYPE_GRAPHICAL))
{
GraphicsFont *gFont = dynamic_cast<GraphicsFont*>(font);
// Get graphics font sprite if it's available
Sprite *fontSprite = gFont->GetFontSprite();
if (fontSprite)
{
// Save graphics font sprite path
return QString::fromStdString(fontSprite->GetRelativePathname().GetAbsolutePathname());
}
}
return QString();
}
示例7: EnumerateSpritesForReloading
void SpritePackerHelper::EnumerateSpritesForReloading(SceneData* sceneData, Map<String, Sprite *> &sprites)
{
List<Entity*> particleEffects;
sceneData->GetAllParticleEffects(particleEffects);
for (auto it = particleEffects.begin(); it != particleEffects.end(); ++it)
{
Entity* curNode = (*it);
ParticleEffectComponent * effectComponent = cast_if_equal<ParticleEffectComponent*>(curNode->GetComponent(Component::PARTICLE_EFFECT_COMPONENT));
if (!effectComponent)
{
continue;
}
effectComponent->Stop();
// All the children of this Scene Node must have Emitter components.
int32 emittersCount = curNode->GetChildrenCount();
for (int32 i = 0; i < emittersCount; i ++)
{
Entity* childNode = curNode->GetChild(i);
ParticleEmitter * emitter = GetEmitter(childNode);
if (!emitter)
{
continue;
}
Vector<ParticleLayer*> & layers = emitter->GetLayers();
int32 layersCount = layers.size();
for (int il = 0; il < layersCount; ++il)
{
Sprite *sprite = layers[il]->GetSprite();
sprites[sprite->GetRelativePathname()] = sprite;
}
}
effectComponent->Start();
}
}
示例8: GetDefaultFontPath
EditorFontManager::DefaultFontPath EditorFontManager::GetDefaultFontPath()
{
FilePath defFontPath;
FilePath defFontSpritePath;
if (defaultFont)
{
Font::eFontType fontType = defaultFont->GetFontType();
switch (fontType)
{
case Font::TYPE_FT:
{
FTFont *ftFont = dynamic_cast<FTFont*>(defaultFont);
FilePath ftFontPath = ftFont->GetFontPath();
// Don't save standart default font
if (ftFontPath.GetAbsolutePathname().find(DEFAULT_FONT_NAME) == String::npos)
{
// Set font path
defFontPath = ftFontPath;
}
break;
}
case Font::TYPE_GRAPHICAL:
{
GraphicsFont *gFont = dynamic_cast<GraphicsFont*>(defaultFont);
// Try to get font sprite
Sprite *fontSprite = gFont->GetFontSprite();
// Save font only if sprite is available
if (fontSprite)
{
// Set font definition and sprite relative path
defFontPath = gFont->GetFontDefinitionName();
defFontSpritePath = fontSprite->GetRelativePathname();
}
break;
}
}
}
return DefaultFontPath(defFontPath, defFontSpritePath);
}
示例9: path
YamlNode * GraphicsFont::SaveToYamlNode()
{
YamlNode *node = Font::SaveToYamlNode();
//Type
node->Set("type", "GraphicsFont");
//horizontalSpacing
node->Set("horizontalSpacing", this->GetHorizontalSpacing());
//Sprite
Sprite *sprite = this->fontSprite;
if (sprite)
{
//Truncate sprite ".txt" extension before save
FilePath path(sprite->GetRelativePathname());
path.TruncateExtension();
node->Set("sprite", path.GetAbsolutePathname());
}
//Font Definition
node->Set("definition", this->GetFontDefinitionName().GetAbsolutePathname());
return node;
}
示例10: CopyEmitter
void SceneSaver::CopyEmitter( ParticleEmitter *emitter, Set<String> &errorLog )
{
sceneUtils.CopyFile(emitter->GetConfigPath(), errorLog);
const Vector<ParticleLayer*> &layers = emitter->GetLayers();
uint32 count = (uint32)layers.size();
for(uint32 i = 0; i < count; ++i)
{
if(layers[i]->type == ParticleLayer::TYPE_SUPEREMITTER_PARTICLES)
{
CopyEmitter(layers[i]->GetInnerEmitter(), errorLog);
}
else
{
Sprite *sprite = layers[i]->GetSprite();
if(!sprite) continue;
FilePath psdPath = ReplaceInString(sprite->GetRelativePathname().GetAbsolutePathname(), "/Data/", "/DataSource/");
psdPath.ReplaceExtension(".psd");
sceneUtils.CopyFile(psdPath, errorLog);
}
}
}
示例11: UpdatePushButtonWidgetWithPropertyValue
void EditFontDialog::UpdatePushButtonWidgetWithPropertyValue(QPushButton *pushButtonWidget)//, const QMetaProperty &curProperty)
{
Font *fontPropertyValue = NULL;
if(pushButtonWidget == ui->fontSelectButton)
{
fontPropertyValue = dialogResult.font;
}
else if(pushButtonWidget == ui->localizedFontSelectButton)
{
fontPropertyValue = dialogResult.GetLocalizedFont(currentLocale);
}
Logger::FrameworkDebug("EditFontDialog::UpdatePushButtonWidgetWithPropertyValue fontPropertyValue=%p fontPresetName=%s", fontPropertyValue, dialogResult.fontPresetName.c_str());
if(fontPropertyValue)
{
//Set button text
Font::eFontType fontType = fontPropertyValue->GetFontType();
QString buttonText;
switch(fontType)
{
case Font::TYPE_FT:
{
FTFont *ftFont = static_cast<FTFont*>(fontPropertyValue);
//Set pushbutton widget text
buttonText = QString::fromStdString(ftFont->GetFontPath().GetFrameworkPath());
break;
}
case Font::TYPE_GRAPHICAL:
{
GraphicsFont *gFont = static_cast<GraphicsFont*>(fontPropertyValue);
//Put into result string font definition and font sprite path
Sprite *fontSprite = gFont->GetFontSprite();
if (!fontSprite) //If no sprite available - quit
{
pushButtonWidget->setText("Graphical font is not available");
return;
}
//Get font definition and sprite relative path
QString fontDefinitionName = QString::fromStdString(gFont->GetFontDefinitionName().GetFrameworkPath());
QString fontSpriteName =QString::fromStdString(fontSprite->GetRelativePathname().GetFrameworkPath());
//Set push button widget text - for grapics font it contains font definition and sprite names
buttonText = QString("%1\n%2").arg(fontDefinitionName, fontSpriteName);
break;
}
case Font::TYPE_DISTANCE:
{
DFFont *dfFont = static_cast<DFFont*>(fontPropertyValue);
//Set pushbutton widget text
buttonText = QString::fromStdString(dfFont->GetFontPath().GetFrameworkPath());
break;
}
default:
{
//Do nothing if we can't determine font type
return;
}
}
Logger::FrameworkDebug("EditFontDialog::UpdatePushButtonWidgetWithPropertyValue %s", buttonText.toStdString().c_str());
pushButtonWidget->setText(buttonText);
}
}