当前位置: 首页>>代码示例>>C++>>正文


C++ UIControl::SetSprite方法代码示例

本文整理汇总了C++中UIControl::SetSprite方法的典型用法代码示例。如果您正苦于以下问题:C++ UIControl::SetSprite方法的具体用法?C++ UIControl::SetSprite怎么用?C++ UIControl::SetSprite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIControl的用法示例。


在下文中一共展示了UIControl::SetSprite方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FillCell

void DataGraph::FillCell(UIHierarchyCell *cell, void *node)
{
    //Temporary fix for loading of UI Interface to avoid reloading of texrures to different formates.
    // 1. Reset default format before loading of UI
    // 2. Restore default format after loading of UI from stored settings.
    Texture::SetDefaultGPU(GPU_UNKNOWN);

    DataNode *n = (DataNode *)node;
    UIStaticText *text =  (UIStaticText *)cell->FindByName("_Text_");
    text->SetText(StringToWString(n->GetName()));
    
    UIControl *icon = cell->FindByName("_Icon_");
    icon->SetSprite("~res:/Gfx/UI/SceneNode/datanode", 0);

    UIControl *marker = cell->FindByName("_Marker_");
    marker->SetVisible(false);
    
    if(n == workingNode)
    {
        cell->SetSelected(true, false);
    }
    else
    {
        cell->SetSelected(false, false);
    }
    
    Texture::SetDefaultGPU(EditorSettings::Instance()->GetTextureViewGPU());
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: CustomizeButtonExpandable

void ControlsFactory::CustomizeButtonExpandable(UIButton *btn)
{
    UIControl *expandable = new UIControl(Rect(btn->GetSize().dx - btn->GetSize().dy, 0, btn->GetSize().dy, btn->GetSize().dy));
    expandable->SetInputEnabled(false);
    expandable->SetSprite("~res:/Gfx/UI/arrowdown", 0);
    btn->AddControl(expandable);
    
    SafeRelease(expandable);
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例3: LoadResources

void FormatsTest::LoadResources()
{
    GetBackground()->SetColor(Color(0.0f, 1.0f, 0.0f, 1.0f));

    int32 columnCount = 6;
    int32 rowCount = (FORMAT_COUNT-1) / columnCount;
    if(0 != FORMAT_COUNT % columnCount)
    {
        ++rowCount;
    }

    float32 size = Min(GetSize().x / columnCount, GetSize().y / rowCount);
    
    Font *font = FTFont::Create("~res:/Fonts/korinna.ttf");
    DVASSERT(font);
	font->SetSize(20);


    for(int32 i = FORMAT_RGBA8888; i < FORMAT_COUNT; ++i)
    {
        int32 y = (i-1) / columnCount;
        int32 x = (i-1) % columnCount;
        
        String formatName = Texture::GetPixelFormatString((PixelFormat)i);
        
        UIControl *c = new UIControl(Rect(x*size, y*size, size - 2, size - 2));
        c->SetSprite(Format("~res:/TestData/FormatTest/%s/number_0", formatName.c_str()), 0);
        c->GetBackground()->SetDrawType(UIControlBackground::DRAW_SCALE_TO_RECT);
        
        UIStaticText *text = new UIStaticText(Rect(0, c->GetSize().y - 30, c->GetSize().x, 30));

        text->SetText(StringToWString(formatName));
        text->SetFont(font);
        text->SetTextColor(Color(1.0f, 1.0f, 1.0f, 1.0f));

        
        c->AddControl(text);
        AddControl(c);

        SafeRelease(text);
        SafeRelease(c);
    }
    
    SafeRelease(font);
}
开发者ID:,项目名称:,代码行数:45,代码来源:

示例4: UIListCell

UIListCell *MaterialEditor::CellAtIndex(UIList *forList, int32 index)
{
    UIListCell *c = forList->GetReusableCell("Material name cell");
    if (!c) 
    {
        c = new UIListCell(Rect(0, 0, forList->GetRect().dx, 20), "Material name cell");

        float32 boxSize = 16;
        float32 y = (CellHeight(forList, index) - boxSize) / 2;
        float32 x = forList->GetRect().dx - boxSize;
        
        
        //Temporary fix for loading of UI Interface to avoid reloading of texrures to different formates.
        // 1. Reset default format before loading of UI
        // 2. Restore default format after loading of UI from stored settings.
        Texture::SetDefaultFileFormat(NOT_FILE);
        
        Rect r = Rect(x, y, boxSize, boxSize);
        UIControl *sceneFlagBox = new UIControl(r);
        sceneFlagBox->SetName("flagBox");
        sceneFlagBox->GetBackground()->SetDrawType(UIControlBackground::DRAW_SCALE_TO_RECT);
        sceneFlagBox->SetSprite("~res:/Gfx/UI/marker", 1);
        sceneFlagBox->SetInputEnabled(false);
        c->AddControl(sceneFlagBox);
        SafeRelease(sceneFlagBox);
        
        Texture::SetDefaultFileFormat((ImageFileFormat)EditorSettings::Instance()->GetTextureViewFileFormat());
    }

    Material *mat = GetMaterial(index);
    bool found = false;
    if(EDM_ALL == displayMode)
    {
        for (int32 i = 0; i < (int32)workingNodeMaterials.size(); ++i)
        {
            if(workingNodeMaterials[i] == mat)
            {
                found = true;
                break;
            }
        }
    }
    else
    {
        found = true;
    }
    
    ControlsFactory::CustomizeListCell(c, StringToWString(mat->GetName()), false);
    UIControl *sceneFlagBox = c->FindByName("flagBox");
    sceneFlagBox->SetVisible(found, false);
    
    if (index == selectedMaterial) 
    {
        c->SetSelected(true, false);
        lastSelection = c;
    }
    else
    {
        c->SetSelected(false, false);
    }
    
    return c;
}
开发者ID:abaradulkin,项目名称:dava.framework,代码行数:63,代码来源:MaterialEditor.cpp


注:本文中的UIControl::SetSprite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。