Exemple #1
0
 /// <summary>
 /// Checks if this render state equals the specified render state.
 /// </summary>
 /// <param name="other">The other.</param>
 /// <returns></returns>
 protected bool Equals(RenderState other)
 {
     return(Equals(RenderSettings, other.RenderSettings) && TileSet.SequenceEqual(other.TileSet) &&
            BackgroundTileMap.SequenceEqual(other.BackgroundTileMap) && WindowTileMap.SequenceEqual(other.WindowTileMap) &&
            SpriteOam.SequenceEqual(other.SpriteOam) && SpriteTileSet.SequenceEqual(other.SpriteTileSet));
 }
Exemple #2
0
        /// <summary>
        /// Gets the render states that have changed in comparison to the specified render state.
        /// </summary>
        /// <param name="other">The other.</param>
        /// <returns></returns>
        public RenderStateChange GetRenderStateChange(RenderState other)
        {
            if (other == null)
            {
                return(RenderStateChange.All);
            }

            var result = RenderSettings.GetRenderStateChange(other.RenderSettings);

            if (!result.HasFlag(RenderStateChange.TileSet) && !TileSet.SequenceEqual(other.TileSet))
            {
                result |= RenderStateChange.TileSet;
            }

            if (!result.HasFlag(RenderStateChange.BackgroundTileMap) && !BackgroundTileMap.SequenceEqual(other.BackgroundTileMap))
            {
                result |= RenderStateChange.BackgroundTileMap;
            }

            // If window settings haven't changed and the window is not enabled then we're not bothered what happens to the window tile map.
            if (!result.HasFlag(RenderStateChange.WindowTileMap) && RenderSettings.WindowEnabled && !WindowTileMap.SequenceEqual(other.WindowTileMap))
            {
                result |= RenderStateChange.WindowTileMap;
            }

            if (!result.HasFlag(RenderStateChange.Sprites) && !RenderSettings.SpritesEnabled)
            {
                return(result);
            }

            // If sprite settings haven't changed and sprite are not enabled then we're not bothered what happens to sprite OAM.
            if (!result.HasFlag(RenderStateChange.SpriteOam) && !SpriteOam.SequenceEqual(other.SpriteOam))
            {
                result |= RenderStateChange.SpriteOam;
            }

            if (!result.HasFlag(RenderStateChange.SpriteTileSet) && !SpriteTileSet.SequenceEqual(other.SpriteTileSet))
            {
                result |= RenderStateChange.SpriteTileSet;
            }

            return(result);
        }