Exemplo n.º 1
0
 ///  <inheritdoc/>
 public void Render(IRenderer renderer, IScreenSurface screenObject)
 {
     // If the tint isn't covering everything
     if (screenObject.Tint.A != 255)
     {
         // Draw any cursors
         foreach (Components.Cursor cursor in screenObject.GetSadComponents <Components.Cursor>())
         {
             if (cursor.IsVisible && screenObject.Surface.IsValidCell(cursor.Position.X, cursor.Position.Y) && screenObject.Surface.View.Contains(cursor.Position))
             {
                 GameHost.Instance.DrawCalls.Enqueue(
                     new DrawCalls.DrawCallGlyph(cursor.CursorRenderCell,
                                                 ((Host.GameTexture)screenObject.Font.Image).Texture,
                                                 new XnaRectangle(screenObject.Font.GetRenderRect(cursor.Position.X - screenObject.Surface.ViewPosition.X,
                                                                                                  cursor.Position.Y - screenObject.Surface.ViewPosition.Y,
                                                                                                  screenObject.FontSize).Translate(screenObject.AbsolutePosition).Position.ToMonoPoint(),
                                                                  screenObject.FontSize.ToMonoPoint()),
                                                 screenObject.Font.SolidGlyphRectangle.ToMonoRectangle(),
                                                 screenObject.Font.GetGlyphSourceRectangle(cursor.CursorRenderCell.Glyph).ToMonoRectangle()
                                                 )
                     );
             }
         }
     }
 }
Exemplo n.º 2
0
        ///  <inheritdoc/>
        public void Render(IRenderer renderer, IScreenSurface screenObject)
        {
            // If the tint isn't covering everything
            if (screenObject.Tint.A != 255)
            {
                // Draw any cursors
                foreach (Components.Cursor cursor in screenObject.GetSadComponents <Components.Cursor>())
                {
                    if (cursor.IsVisible && screenObject.Surface.IsValidCell(cursor.Position.X, cursor.Position.Y) && screenObject.Surface.View.Contains(cursor.Position))
                    {
                        Point cursorPosition = screenObject.AbsoluteArea.Position + screenObject.Font.GetRenderRect(cursor.Position.X - screenObject.Surface.ViewPosition.X, cursor.Position.Y - screenObject.Surface.ViewPosition.Y, screenObject.FontSize).Position;

                        GameHost.Instance.DrawCalls.Enqueue(
                            new DrawCalls.DrawCallCell(cursor.CursorRenderCell,
                                                       new Rectangle(cursorPosition.X, cursorPosition.Y, screenObject.FontSize.X, screenObject.FontSize.Y).ToIntRect(),
                                                       screenObject.Font,
                                                       true
                                                       )
                            );
                    }
                }
            }
        }