コード例 #1
0
ファイル: Canvas.cpp プロジェクト: 20-sim/bullet3
void Canvas::RenderCanvas()
{
	DoThink();

	Gwen::Renderer::Base* render = m_Skin->GetRender();
	render->Begin();

	
		RecurseLayout( m_Skin );

		render->SetClipRegion( GetBounds() );
		render->SetRenderOffset( Gwen::Point( 0, 0 ) );
		render->SetScale( Scale() );

		if ( m_bDrawBackground )
		{
			render->SetDrawColor( m_BackgroundColor );
			render->DrawFilledRect( GetRenderBounds() );
		}

		DoRender( m_Skin );

		DragAndDrop::RenderOverlay( this, m_Skin );

		ToolTip::RenderToolTip( m_Skin );

		render->EndClip();

	render->End();
	ProcessDelayedDeletes();

}
コード例 #2
0
ファイル: ToolTip.cpp プロジェクト: darkf/gwen
	void RenderToolTip( Skin::Base* skin )
	{
		if ( !g_ToolTip ) { return; }

		Gwen::Renderer::Base* render = skin->GetRender();
		Gwen::Point pOldRenderOffset = render->GetRenderOffset();
		Gwen::Point MousePos = Input::GetMousePosition();
		Gwen::Rect Bounds = g_ToolTip->GetToolTip()->GetBounds();
		Gwen::Rect rOffset = Gwen::Rect( MousePos.x - Bounds.w * 0.5f, MousePos.y - Bounds.h - 10, Bounds.w, Bounds.h );
		rOffset = Utility::ClampRectToRect( rOffset, g_ToolTip->GetCanvas()->GetBounds() );
		//Calculate offset on screen bounds
		render->AddRenderOffset( rOffset );
		render->EndClip();
		skin->DrawToolTip( g_ToolTip->GetToolTip() );
		g_ToolTip->GetToolTip()->DoRender( skin );
		render->SetRenderOffset( pOldRenderOffset );
	}
コード例 #3
0
ファイル: Base.cpp プロジェクト: darkf/gwen
void Base::DoRender( Gwen::Skin::Base* skin )
{
	// If this control has a different skin,
	// then so does its children.
	if ( m_Skin )
	{ skin = m_Skin; }

	// Do think
	Think();
	Gwen::Renderer::Base* render = skin->GetRender();

	if ( render->GetCTT() && ShouldCacheToTexture() )
	{
		DoCacheRender( skin, this );
		return;
	}

	RenderRecursive( skin, GetBounds() );
}
コード例 #4
0
ファイル: DockBase.cpp プロジェクト: 20-sim/bullet3
void DockBase::RenderOver( Skin::Base* skin )
{
	if ( !m_bDrawHover ) return;

	Gwen::Renderer::Base* render = skin->GetRender();

	render->SetDrawColor( Gwen::Color( 255, 100, 255, 20 ) );
	render->DrawFilledRect( GetRenderBounds() );

	if ( m_HoverRect.w == 0 ) return;

	render->SetDrawColor( Gwen::Color( 255, 100, 255, 100 ) );
	render->DrawFilledRect( m_HoverRect );

	render->SetDrawColor( Gwen::Color( 255, 100, 255, 200 ) );
	render->DrawLinedRect( m_HoverRect );
}
コード例 #5
0
void ScrollControl::Render( Skin::Base* skin )
{
#if 0
	// Debug render - this shouldn't render ANYTHING REALLY - it should be up to the parent!
	Gwen::Rect rect = GetRenderBounds();
	Gwen::Renderer::Base* render = skin->GetRender();
	render->SetDrawColor( Gwen::Color( 255, 255, 0, 100 ) );
	render->DrawFilledRect( rect );
	render->SetDrawColor( Gwen::Color( 255, 0, 0, 100 ) );
	render->DrawFilledRect( m_InnerPanel->GetBounds() );
	render->RenderText( skin->GetDefaultFont(), Gwen::Point( 0, 0 ), Utility::Format( L"Offset: %i %i", m_InnerPanel->X(), m_InnerPanel->Y() ) );
#else //0
	( void ) skin;
#endif //0
}
コード例 #6
0
ファイル: Base.cpp プロジェクト: darkf/gwen
void Base::RenderRecursive( Gwen::Skin::Base* skin, const Gwen::Rect & cliprect )
{
	Gwen::Renderer::Base* render = skin->GetRender();
	Gwen::Point pOldRenderOffset = render->GetRenderOffset();
	render->AddRenderOffset( cliprect );
	RenderUnder( skin );
	Gwen::Rect rOldRegion = render->ClipRegion();

	//
	// If this control is clipping, change the clip rect to ourselves
	// ( if not then we still clip using our parents clip rect )
	//
	if ( ShouldClip() )
	{
		render->AddClipRegion( cliprect );

		if ( !render->ClipRegionVisible() )
		{
			render->SetRenderOffset( pOldRenderOffset );
			render->SetClipRegion( rOldRegion );
			return;
		}
	}

	//
	// Render this control and children controls
	//
	render->StartClip();
	{
		Render( skin );

		if ( !Children.empty() )
		{
			//Now render my kids
			for ( Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter )
			{
				Base* pChild = *iter;

				if ( pChild->Hidden() ) { continue; }

				pChild->DoRender( skin );
			}
		}
	}
	render->EndClip();
	//
	// Render overlay/focus
	//
	{
		render->SetClipRegion( rOldRegion );
		render->StartClip();
		{
			RenderOver( skin );
			RenderFocus( skin );
		}
		render->EndClip();
		render->SetRenderOffset( pOldRenderOffset );
	}
}
コード例 #7
0
ファイル: Base.cpp プロジェクト: darkf/gwen
void Base::DoCacheRender( Gwen::Skin::Base* skin, Gwen::Controls::Base* pMaster )
{
	Gwen::Renderer::Base* render = skin->GetRender();
	Gwen::Renderer::ICacheToTexture* cache = render->GetCTT();

	if ( !cache ) { return; }

	Gwen::Point pOldRenderOffset = render->GetRenderOffset();
	Gwen::Rect rOldRegion = render->ClipRegion();

	if ( this != pMaster )
	{
		render->AddRenderOffset( GetBounds() );
		render->AddClipRegion( GetBounds() );
	}
	else
	{
		render->SetRenderOffset( Gwen::Point( 0, 0 ) );
		render->SetClipRegion( GetBounds() );
	}

	if ( m_bCacheTextureDirty && render->ClipRegionVisible() )
	{
		render->StartClip();
		{
			if ( ShouldCacheToTexture() )
			{ cache->SetupCacheTexture( this ); }

			//Render myself first
			Render( skin );

			if ( !Children.empty() )
			{
				//Now render my kids
				for ( Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter )
				{
					Base* pChild = *iter;

					if ( pChild->Hidden() ) { continue; }

					pChild->DoCacheRender( skin, pMaster );
				}
			}

			if ( ShouldCacheToTexture() )
			{
				cache->FinishCacheTexture( this );
				m_bCacheTextureDirty = false;
			}
		}
		render->EndClip();
	}

	render->SetClipRegion( rOldRegion );
	render->StartClip();
	{
		render->SetRenderOffset( pOldRenderOffset );
		cache->DrawCachedControlTexture( this );
	}
	render->EndClip();
}
コード例 #8
0
ファイル: Base.cpp プロジェクト: Ochakko/MameBake3D
void Base::DoRender( Gwen::Skin::Base* skin )
{
	// If this control has a different skin, 
	// then so does its children.
	if ( m_Skin ) 
		skin = m_Skin;

	// Do think
	Think();

	Gwen::Renderer::Base* render = skin->GetRender();

	if ( render->GetCTT() && ShouldCacheToTexture() )
	{
		DoCacheRender( skin, this );
		return;
	}

	Gwen::Point pOldRenderOffset = render->GetRenderOffset();

	render->AddRenderOffset( GetBounds() );

	RenderUnder( skin );
	
	Gwen::Rect rOldRegion = render->ClipRegion();
	render->AddClipRegion( GetBounds() );

	if ( render->ClipRegionVisible() )
	{
		render->StartClip();
		
		//Render myself first
 		Render( skin );

		if ( !Children.empty() )
		{
			//Now render my kids
			for (Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter)
			{
				Base* pChild = *iter;
				if ( pChild->Hidden() ) continue;

				pChild->DoRender( skin );
			}		
		}

		render->SetClipRegion( rOldRegion );
		render->StartClip();

		RenderOver( skin );
	}
	else
	{
		render->SetClipRegion( rOldRegion );
	}

	RenderFocus( skin );

	render->SetRenderOffset( pOldRenderOffset );
}
コード例 #9
0
void WindowCanvas::RenderCanvas()
{
	//
	// If there isn't anything going on we sleep the thread for a few ms
	// This gives some cpu time back to the os. If you're using a rendering
	// method that needs continual updates, just call canvas->redraw every frame.
	//
	if ( !NeedsRedraw() )
	{
		Platform::Sleep( 10 );
		return;
	}

	m_bNeedsRedraw = false;
	Gwen::Renderer::Base* render = m_Skin->GetRender();

	if ( render->BeginContext( this ) )
	{
		render->Begin();
		RecurseLayout( m_Skin );
		render->SetClipRegion( GetRenderBounds() );
		render->SetRenderOffset( Gwen::Point( X() * -1, Y() * -1 ) );
		render->SetScale( Scale() );

		if ( m_bDrawBackground )
		{
			render->SetDrawColor( m_BackgroundColor );
			render->DrawFilledRect( GetRenderBounds() );
		}

		DoRender( m_Skin );
		DragAndDrop::RenderOverlay( this, m_Skin );
		ToolTip::RenderToolTip( m_Skin );
		render->End();
	}

	render->EndContext( this );
	render->PresentContext( this );
}
コード例 #10
0
ファイル: Base.cpp プロジェクト: craley/Poky
void Base::DoCacheRender(Gwen::Skin::Base* skin, Gwen::Controls::Base* pMaster)
{
    Gwen::Renderer::Base* render = skin->GetRender();
    Gwen::Renderer::ICacheToTexture* cache = render->GetCTT();

    if (!cache)
        return;

    Gwen::Point pOldRenderOffset = render->GetRenderOffset();
    Gwen::Rect rOldRegion = render->ClipRegion();

    if (this != pMaster)
    {
        render->AddRenderOffset(GetBounds());
        render->AddClipRegion(GetBounds());
    }
    else
    {
        render->SetRenderOffset(Gwen::Point(0, 0));
        render->SetClipRegion(GetBounds());
    }

    // See if we need to update the cached texture. Dirty?
    if (m_bCacheTextureDirty && render->ClipRegionVisible())
    {
        render->StartClip();
        {
            if (IsCachedToTexture())
                cache->SetupCacheTexture(this);

            // Render myself first
            Render(skin);

            if (!Children.empty())
            {
                // Now render my kids
                for (Base::List::iterator iter = Children.begin(); iter != Children.end(); ++iter)
                {
                    Base* pChild = *iter;

                    if (!pChild->Hidden())
                    {
                        // Draw child control using normal render. If it is cached it will
                        // be handled in the same way as this one.
                        pChild->DoRender(skin);
                    }
                }
            }

            if (IsCachedToTexture())
            {
                cache->FinishCacheTexture(this);
                m_bCacheTextureDirty = false;
            }
        }
        render->EndClip();
    }

    // Draw the cached texture.
    render->SetClipRegion(rOldRegion);
    render->StartClip();
    {
        render->SetRenderOffset(pOldRenderOffset);
        cache->DrawCachedControlTexture(this);
    }
    render->EndClip();
}