示例#1
0
//----------------------------------------------------------------------------//
void FalagardListView::createRenderGeometry(ListView* list_view)
{
    Rectf items_area(getViewRenderArea());
    glm::vec2 item_pos(getItemRenderStartPosition(list_view, items_area));

    for (size_t i = 0; i < list_view->getItems().size(); ++i)
    {
        ListViewItemRenderingState* item = list_view->getItems().at(i);
        RenderedString& rendered_string = item->d_string;
        Sizef size(item->d_size);

        size.d_width = std::max(items_area.getWidth(), size.d_width);

        Rectf item_rect;
        item_rect.left(item_pos.x);
        item_rect.top(item_pos.y);
        item_rect.setSize(size);

        if (!item->d_icon.empty())
        {
            Image& img = ImageManager::getSingleton().get(item->d_icon);

            Rectf icon_rect(item_rect);
            icon_rect.setWidth(size.d_height);
            icon_rect.setHeight(size.d_height);

            Rectf icon_clipper(icon_rect.getIntersection(items_area));

            ImageRenderSettings renderSettings(
                icon_rect, &icon_clipper,
                true, ICON_COLOUR_RECT, 1.0f);

            auto imgGeomBuffers = img.createRenderGeometry(renderSettings);

            list_view->appendGeometryBuffers(imgGeomBuffers);

            item_rect.left(item_rect.left() + icon_rect.getWidth());
        }

        Rectf item_clipper(item_rect.getIntersection(items_area));

        createRenderGeometryAndAddToItemView(list_view, rendered_string, item_rect,
            list_view->getFont(), &item_clipper, item->d_isSelected);

        item_pos.y += size.d_height;
    }
}
示例#2
0
/******************************************************************************
* Is called when the value of a reference field of this RefMaker changes.
******************************************************************************/
void DataSet::referenceReplaced(const PropertyFieldDescriptor& field, RefTarget* oldTarget, RefTarget* newTarget)
{
    if(field == PROPERTY_FIELD(DataSet::_viewportConfig))
        Q_EMIT viewportConfigReplaced(viewportConfig());
    else if(field == PROPERTY_FIELD(DataSet::_animSettings))
        Q_EMIT animationSettingsReplaced(animationSettings());
    else if(field == PROPERTY_FIELD(DataSet::_renderSettings))
        Q_EMIT renderSettingsReplaced(renderSettings());
    else if(field == PROPERTY_FIELD(DataSet::_selection))
        Q_EMIT selectionSetReplaced(selection());

    // Install a signal/slot connection that updates the viewports every time the animation time changes.
    if(field == PROPERTY_FIELD(DataSet::_viewportConfig) || field == PROPERTY_FIELD(DataSet::_animSettings)) {
        disconnect(_updateViewportOnTimeChangeConnection);
        if(animationSettings() && viewportConfig()) {
            _updateViewportOnTimeChangeConnection = connect(animationSettings(), &AnimationSettings::timeChangeComplete, viewportConfig(), &ViewportConfiguration::updateViewports);
            viewportConfig()->updateViewports();
        }
    }

    RefTarget::referenceReplaced(field, oldTarget, newTarget);
}
void render_settings(Game *game)
{
    renderBackground(mainmenuTexture);
    renderSettings(game);
    renderSettingsText(game);
}