Exemplo n.º 1
0
        /// <summary>
        ///  Attempts to look-up the surface closest to the given size.
        /// </summary>
        /// <param name="size">The ideal size of the surface requrested.</param>
        /// <returns>A surface that closesly resembles the ideal surface in size.</returns>
        internal ISpriteSurface GetClosestSurface(int size)
        {
            ISpriteSurface close = null;

            if (!_sizedSurfaces)
            {
                return(_surfaces[0]);
            }

            for (var i = 1; i <= 48; i++)
            {
                if (_surfaces[i] == null)
                {
                    continue;
                }
                close = _surfaces[i];

                if (GameConfig.UseLargeGraphics)
                {
                    continue;
                }
                if (i >= size)
                {
                    break;
                }
            }

            return(close);
        }
Exemplo n.º 2
0
 /// <summary>
 ///  Attaches a sized surface to this instance.  No bounds
 ///  checking is performed.  The size should be between 0 and 48.
 ///  The sizedSurfaces field is set to true.
 /// </summary>
 /// <param name="ddss">The sprite surface to attach to this instance.</param>
 /// <param name="size">The size of this sprite surface.</param>
 internal void AttachSurface(ISpriteSurface ddss, int size)
 {
     _sizedSurfaces  = true;
     _surfaces[size] = ddss as DirectDrawSpriteSurface;
 }
Exemplo n.º 3
0
 /// <summary>
 ///  Attaches a single, unsized surface to this instance.
 ///  If sizedSurface was previously set, it is now unset.
 /// </summary>
 /// <param name="ddss">The surface to attach.</param>
 internal void AttachSurface(ISpriteSurface ddss)
 {
     _sizedSurfaces = false;
     _surfaces[0]   = ddss as DirectDrawSpriteSurface;
 }