示例#1
0
        /// <summary>
        /// Renders the currently visible tooltip.
        /// </summary>
        /// <param name="skin"></param>
        public static void RenderToolTip(SkinBase skin)
        {
            if (null == g_ToolTip)
            {
                return;
            }

            RendererBase render = skin.Renderer;

            Point     oldRenderOffset = render.RenderOffset;
            Point     mousePos        = Input.InputHandler.MousePosition;
            Rectangle bounds          = g_ToolTip.ToolTip.Bounds;

            Rectangle offset = Util.FloatRect(mousePos.X - bounds.Width * 0.5f, mousePos.Y - bounds.Height - 10,
                                              bounds.Width, bounds.Height);

            offset = Util.ClampRectToRect(offset, g_ToolTip.GetCanvas().Bounds);

            //Calculate offset on screen bounds
            render.AddRenderOffset(offset);
            render.EndClip();

            skin.DrawToolTip(g_ToolTip.ToolTip);
            g_ToolTip.ToolTip.DoRender(skin);

            render.RenderOffset = oldRenderOffset;
        }
示例#2
0
        /// <summary>
        /// Renders the canvas. Call in your rendering loop.
        /// </summary>
        public void RenderCanvas()
        {
            DoThink();

            RendererBase render = Skin.Renderer;

            render.Begin();

            RecurseLayout(Skin);

            render.ClipRegion   = Bounds;
            render.RenderOffset = Point.Empty;
            render.Scale        = Scale;

            if (ShouldDrawBackground)
            {
                render.DrawColor = m_BackgroundColor;
                render.DrawFilledRect(RenderBounds);
            }

            DoRender(Skin);

            DragAndDrop.RenderOverlay(this, Skin);

            Gwen.ToolTip.RenderToolTip(Skin);

            render.EndClip();

            render.End();
        }