Tinkr2/4.2/AphelionCore/AphelionCore/Core/Core.cs
/// <summary>
/// Safely flushes the screen accounting for overlays and mouse cursor.
/// </summary>
Safely flushes the screen accounting for overlays and mouse cursor.
Safely flushes the screen accounting for overlays and mouse cursor .
public static void SafeFlush()
      {
         bool drawMouse = false;
         if (MouseAvailable && _instance._showMouse)
         {
            _instance._mouseBuffer.DrawImage(0, 0, _instance._screen, _instance._mouseX, _instance._mouseY, 12, 19);
            drawMouse = true;
         }
         if (_instance._overlay != null)
         {
            if (_instance._overlayBuffer == null)
            {
               _instance._overlayBuffer = new Bitmap(_instance._overlay.Size.Width, _instance._overlay.Size.Height);
            }
            _instance._overlayBuffer.DrawImage(0, 0, 
               _instance._screen, _instance._overlay.Position.X, _instance._overlay.Position.Y,
               _instance._overlayBuffer.Width, _instance._overlayBuffer.Height);
            _instance._screen.DrawRectangle(_instance._overlay.BorderColor, 1, _instance._overlay.Position.X, _instance._overlay.Position.Y,
                _instance._overlay.Size.Width, _instance._overlay.Size.Height, 0, 0, _instance._overlay.BackColor, 0, 0,
                _instance._overlay.BackColor, 0, 0, 128);
            if (_instance._overlay.Image == null)
            {
               _instance._screen.DrawText(_instance._overlay.Text, _instance._overlay.Font, _instance._overlay.ForeColor,
                   _instance._overlay.Position.X + 8, _instance._overlay.Position.Y + 4);
            }
            else
            {
               _instance._screen.DrawImage(_instance._overlay.Position.X + 8, _instance._overlay.Position.Y + 4, _instance._overlay.Image, 0, 0,
                   _instance._overlay.Image.Width, _instance._overlay.Image.Height);
               _instance._screen.DrawText(_instance._overlay.Text, _instance._overlay.Font, _instance._overlay.ForeColor,
                   _instance._overlay.Position.X + 16 + _instance._overlay.Image.Width,
                   _instance._overlay.Position.Y + 4 + (_instance._overlay.Image.Height / 2 - _instance._overlay.Font.Height / 2));
            }
            _instance._screen.DrawImage(_instance._overlay.Position.X, _instance._overlay.Position.Y, _instance._overlayBuffer, 0, 0,
                _instance._overlayBuffer.Width, _instance._overlayBuffer.Height, (ushort)(256 - _instance._overlay.Opacity));
         }
         if (drawMouse)
         {
            _instance._screen.DrawImage(_instance._mouseX, _instance._mouseY, _instance._mouse, 0, 0, 12, 19);
         }
         _instance._screen.Flush();
      }
public static void SafeFlush ( ) { bool drawMouse = false ; if ( MouseAvailable && _instance . _showMouse ) { _instance . _mouseBuffer . DrawImage ( 0 , 0 , _instance . _screen , _instance . _mouseX , _instance . _mouseY , 12 , 19 ) ; drawMouse = true ; } if ( _instance . _overlay != null ) { if ( _instance . _overlayBuffer == null ) { _instance . _overlayBuffer = new Bitmap ( _instance . _overlay . Size . Width , _instance . _overlay . Size . Height ) ; } _instance . _overlayBuffer . DrawImage ( 0 , 0 , _instance . _screen , _instance . _overlay . Position . X , _instance . _overlay . Position . Y , _instance . _overlayBuffer . Width , _instance . _overlayBuffer . Height ) ; _instance . _screen . DrawRectangle ( _instance . _overlay . BorderColor , 1 , _instance . _overlay . Position . X , _instance . _overlay . Position . Y , _instance . _overlay . Size . Width , _instance . _overlay . Size . Height , 0 , 0 , _instance . _overlay . BackColor , 0 , 0 , _instance . _overlay . BackColor , 0 , 0 , 128 ) ; if ( _instance . _overlay . Image == null ) { _instance . _screen . DrawText ( _instance . _overlay . Text , _instance . _overlay . Font , _instance . _overlay . ForeColor , _instance . _overlay . Position . X + 8 , _instance . _overlay . Position . Y + 4 ) ; } else { _instance . _screen . DrawImage ( _instance . _overlay . Position . X + 8 , _instance . _overlay . Position . Y + 4 , _instance . _overlay . Image , 0 , 0 , _instance . _overlay . Image . Width , _instance . _overlay . Image . Height ) ; _instance . _screen . DrawText ( _instance . _overlay . Text , _instance . _overlay . Font , _instance . _overlay . ForeColor , _instance . _overlay . Position . X + 16 + _instance . _overlay . Image . Width , _instance . _overlay . Position . Y + 4 + ( _instance . _overlay . Image . Height / 2 - _instance . _overlay . Font . Height / 2 ) ) ; } _instance . _screen . DrawImage ( _instance . _overlay . Position . X , _instance . _overlay . Position . Y , _instance . _overlayBuffer , 0 , 0 , _instance . _overlayBuffer . Width , _instance . _overlayBuffer . Height , ( ushort ) ( 256 - _instance . _overlay . Opacity ) ) ; } if ( drawMouse ) { _instance . _screen . DrawImage ( _instance . _mouseX , _instance . _mouseY , _instance . _mouse , 0 , 0 , 12 , 19 ) ; } _instance . _screen . Flush ( ) ; }
Safely flushes the screen accounting for overlays and mouse cursor.
Safely flushes the screen accounting for overlays and mouse cursor .
// Update Mouse Buffer