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


C++ Control::Draw方法代码示例

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


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

示例1: DrawWindow

/** This function Draws the Window on the Output Screen */
void Window::DrawWindow()
{
    if (!Visible) return; // no point in drawing invisible windows
    Video* video = core->GetVideoDriver();
    Region clip( XPos, YPos, Width, Height );
    //Frame && Changed
    if ( (Flags & (WF_FRAME|WF_CHANGED) ) == (WF_FRAME|WF_CHANGED) ) {
        Region screen( 0, 0, core->Width, core->Height );
        video->SetScreenClip( NULL );
        //removed this?
        video->DrawRect( screen, ColorBlack );
        if (core->WindowFrames[0])
            video->BlitSprite( core->WindowFrames[0], 0, 0, true );
        if (core->WindowFrames[1])
            video->BlitSprite( core->WindowFrames[1], core->Width - core->WindowFrames[1]->Width, 0, true );
        if (core->WindowFrames[2])
            video->BlitSprite( core->WindowFrames[2], (core->Width - core->WindowFrames[2]->Width) / 2, 0, true );
        if (core->WindowFrames[3])
            video->BlitSprite( core->WindowFrames[3], (core->Width - core->WindowFrames[3]->Width) / 2, core->Height - core->WindowFrames[3]->Height, true );
    }

    video->SetScreenClip( &clip );
    //Float || Changed
    bool bgRefreshed = false;
    if (BackGround && (Flags & (WF_FLOAT|WF_CHANGED) ) ) {
        DrawBackground(NULL);
        bgRefreshed = true;
    }

    std::vector< Control*>::iterator m;
    for (m = Controls.begin(); m != Controls.end(); ++m) {
        Control* c = *m;
        // FIXME: drawing BG in the same loop as controls can produce incorrect results with overlapping controls. the only case I know of this occuring it is ok due to no BG drawing
        // furthermore, overlapping controls are still a problem when NeedsDraw() returns false for the top control, but true for the bottom (see the level up icon on char portraits)
        // we will fix both issues later by refactoring with the concept of views and subviews
        if (BackGround && !bgRefreshed && !c->IsOpaque() && c->NeedsDraw()) {
            const Region& fromClip = c->ControlFrame();
            DrawBackground(&fromClip);
        }
        if (Flags & (WF_FLOAT)) {
            // FIXME: this is a total hack. Required for anything drawing over GameControl (nothing really at all to do with floating)
            c->MarkDirty();
        }
        c->Draw( XPos, YPos );
    }
    if ( (Flags&WF_CHANGED) && (Visible == WINDOW_GRAYED) ) {
        Color black = { 0, 0, 0, 128 };
        video->DrawRect(clip, black);
    }
    video->SetScreenClip( NULL );
    Flags &= ~WF_CHANGED;
}
开发者ID:AlanWasTaken,项目名称:gemrb,代码行数:53,代码来源:Window.cpp

示例2: destRect

void
Window::Draw()
{
    if (fBackground != NULL) {
        GFX::rect destRect(fPosition.x, fPosition.y,
                        fBackground->Width(), fBackground->Height());
        GraphicsEngine::Get()->BlitToScreen(fBackground, NULL, &destRect);
    }

    std::vector<Control*>::const_iterator i;
    for (i = fControls.begin(); i != fControls.end(); i++) {
        Control* control = (*i);
        control->Draw();
    }
}
开发者ID:,项目名称:,代码行数:15,代码来源:


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