本文整理汇总了C++中GuiControl::onRender方法的典型用法代码示例。如果您正苦于以下问题:C++ GuiControl::onRender方法的具体用法?C++ GuiControl::onRender怎么用?C++ GuiControl::onRender使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiControl
的用法示例。
在下文中一共展示了GuiControl::onRender方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderFrame
void GuiOffscreenCanvas::renderFrame(bool preRenderOnly, bool bufferSwap /* = true */)
{
if (!mTargetDirty)
return;
#ifdef TORQUE_ENABLE_GFXDEBUGEVENTS
char buf[256];
dSprintf(buf, sizeof(buf), "OffsceenCanvas %s", getName() ? getName() : getIdString());
GFXDEBUGEVENT_SCOPE_EX(GuiOffscreenCanvas_renderFrame, ColorI::GREEN, buf);
#endif
PROFILE_START(OffscreenCanvasPreRender);
#ifdef TORQUE_GFX_STATE_DEBUG
GFX->getDebugStateManager()->startFrame();
#endif
if (mTarget->getSize() != mTargetSize)
{
_setupTargets();
mNamedTarget.setViewport( RectI( Point2I::Zero, mTargetSize ) );
}
// Make sure the root control is the size of the canvas.
Point2I size = mTarget->getSize();
if(size.x == 0 || size.y == 0)
{
PROFILE_END();
return;
}
RectI screenRect(0, 0, size.x, size.y);
maintainSizing();
//preRender (recursive) all controls
preRender();
PROFILE_END();
// Are we just doing pre-render?
if(preRenderOnly)
{
return;
}
resetUpdateRegions();
PROFILE_START(OffscreenCanvasRenderControls);
GuiCursor *mouseCursor = NULL;
bool cursorVisible = true;
Point2I cursorPos((S32)mCursorPt.x, (S32)mCursorPt.y);
mouseCursor = mDefaultCursor;
mLastCursorEnabled = cursorVisible;
mLastCursor = mouseCursor;
mLastCursorPt = cursorPos;
// Set active target
GFX->pushActiveRenderTarget();
GFX->setActiveRenderTarget(mTarget);
// Clear the current viewport area
GFX->setViewport( screenRect );
GFX->clear( GFXClearTarget, ColorF(0,0,0,0), 1.0f, 0 );
resetUpdateRegions();
// Make sure we have a clean matrix state
// before we start rendering anything!
GFX->setWorldMatrix( MatrixF::Identity );
GFX->setViewMatrix( MatrixF::Identity );
GFX->setProjectionMatrix( MatrixF::Identity );
RectI contentRect(Point2I(0,0), mTargetSize);
{
// Render active GUI Dialogs
for(iterator i = begin(); i != end(); i++)
{
// Get the control
GuiControl *contentCtrl = static_cast<GuiControl*>(*i);
GFX->setClipRect( contentRect );
GFX->setStateBlock(mDefaultGuiSB);
contentCtrl->onRender(contentCtrl->getPosition(), contentRect);
}
// Fill Blue if no Dialogs
if(this->size() == 0)
GFX->clear( GFXClearTarget, ColorF(0,0,0,1), 1.0f, 0 );
GFX->setClipRect( contentRect );
// Draw cursor
//
if (mCursorEnabled && mouseCursor && mShowCursor)
//.........这里部分代码省略.........