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


C++ Layout::Allocate方法代码示例

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


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

示例1: scrollCoordinates

    void    VolumetricFogSettings::Render(  IOverlayContext* context, Layout& layout, 
                                            Interactables& interactables, InterfaceState& interfaceState)
    {
        using namespace RenderOverlays::DebuggingDisplay;
        layout.AllocateFullWidth(64);

        class ScrollBarObj
        {
        public:
            float *_member;
            const char* _name;
            float _min, _max;
        };

        ScrollBarObj objects[dimof(VolumetricFogSettings::_scrollers)] = 
        {
            { &_materialSettings->_density,             "Density",              0.f,   1.f },
            { &_materialSettings->_noiseDensityScale,   "NoiseDensityScale",    0.f,   1.f },
            { &_materialSettings->_noiseSpeed,          "NoiseSpeed",           0.001f,   10.f },
            // { &_materialSettings->_heightStart,         "HeightStart",          0.f,   300.f },
            // { &_materialSettings->_heightEnd,           "HeightEnd",            0.f,   300.f },

            { &_materialSettings->_forwardColour[0],    "ForwardR",             0.f,   1.f },
            { &_materialSettings->_forwardColour[1],    "ForwardG",             0.f,   1.f },
            { &_materialSettings->_forwardColour[2],    "ForwardB",             0.f,   1.f },
            // { &_materialSettings->_forwardBrightness,   "ForwardBrightness",    0.f,   50.f },

            { &_materialSettings->_backColour[0],       "BackR",                0.f,   1.f },
            { &_materialSettings->_backColour[1],       "BackG",                0.f,   1.f },
            { &_materialSettings->_backColour[2],       "BackB",                0.f,   1.f },
            // { &_materialSettings->_backBrightness,      "BackBrightness",       0.f,   50.f },

            { &_materialSettings->_ESM_C,               "ESM_C",                0.f,   150.f },
            { &_materialSettings->_jitteringAmount,     "JitteringAmount",      0.f,   1.f }
        };

        const auto scrollBarId = InteractableId_Make("ScrollBar");
        for (unsigned q=0; q<dimof(objects); ++q) {
            static Coord2 scrollBarSize(600, 24);
            Rect windAngle0 = layout.Allocate(scrollBarSize);

            Rect gridBackgroundRect = windAngle0;
            gridBackgroundRect._topLeft[0] += 128; gridBackgroundRect._bottomRight[0] -= 4;
            gridBackgroundRect._topLeft[1] += 4; gridBackgroundRect._bottomRight[1] -= 4;
            HScrollBar_DrawGridBackground(context, gridBackgroundRect);
            
            Rect labelRect = windAngle0;
            labelRect._bottomRight[0] = labelRect._topLeft[0] + 256;
            HScrollBar_DrawLabel(context, labelRect);
            
            Rect textRect = windAngle0;
            textRect._topLeft[0] += 32;
            /*Coord a = */DrawFormatText(context, textRect, nullptr, ColorB(0xffffffff), objects[q]._name);

            Rect scrollBar = windAngle0;
            scrollBar._topLeft[0] = labelRect._bottomRight[0];
            scrollBar._topLeft[0] += 16;
            scrollBar._bottomRight[0] -= 16;

            ScrollBar::Coordinates scrollCoordinates(
                scrollBar, objects[q]._min, objects[q]._max, (objects[q]._max - objects[q]._min)/40.f,
                ScrollBar::Coordinates::Flags::NoUpDown|ScrollBar::Coordinates::Flags::Horizontal);
            *objects[q]._member = _scrollers[q].CalculateCurrentOffset(scrollCoordinates, *objects[q]._member);
            HScrollBar_Draw(context, scrollCoordinates, *objects[q]._member);
            interactables.Register(
                Interactables::Widget(scrollCoordinates.InteractableRect(), scrollBarId+q));

            DrawFormatText(context, scrollBar, 0.f, nullptr, ColorB(0xffffffff), TextAlignment::Right, "%.3f", *objects[q]._member);
        }
    }
开发者ID:ldh9451,项目名称:XLE,代码行数:70,代码来源:VolFogSettings.cpp


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