Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="batch"></param>
        /// <param name="field"></param>
        /// <param name="position"></param>
        /// <param name="direction"></param>
        public override void Draw(SpriteBatch batch, ViewField field, ViewFieldPosition position, CardinalPoint direction)
        {
            // Foreach wall side
            foreach (TileDrawing td in DisplayCoordinates.GetWalls(position))
            {
                // Not the good side
                if (Compass.GetDirectionFromView(direction, td.Side) != Side)
                {
                    continue;
                }

                DecorationSet decoset = field.Maze.Decoration;
                if (decoset == null)
                {
                    return;
                }

                Decoration deco = decoset.GetDecoration(IsActivated ? ActivatedDecoration : DeactivatedDecoration);
                if (deco == null)
                {
                    return;
                }

                deco.DrawDecoration(batch, decoset, position, Compass.IsSideFacing(direction, Side));
            }
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        void RenderActivated()
        {
            ActivatedGLBox.MakeCurrent();
            Display.ClearBuffers();

            Batch.Begin();

            // Background
            Batch.DrawTile(Maze.WallTileset, 0, Point.Empty);

            // Render the walls
            foreach (TileDrawing tmp in DisplayCoordinates.GetWalls(ViewFieldPosition.L))
            {
                Batch.DrawTile(Maze.WallTileset, tmp.ID, tmp.Location);
            }

            // Draw decoration
            if (DecorationSet != null)
            {
                DecorationSet.Draw(Batch, (int)ActivatedIdBox.Value, ViewFieldPosition.L);
            }

            Batch.End();

            ActivatedGLBox.SwapBuffers();
        }
Beispiel #3
0
        /// <summary>
        /// Draws a single decoration
        /// </summary>
        /// <param name="batch">Spritebatch handle</param>
        /// <param name="decoration">DecorationSet handle</param>
        /// <param name="position">Position of the square in the view</param>
        /// <param name="view">Viewing direction</param>
        /// <param name="alignview">True if the side is facing south (horizontaly span the decoration)</param>
        public void DrawDecoration(SpriteBatch batch, DecorationSet set, ViewFieldPosition position, bool alignview)
        {
            if (batch == null || set == null)
            {
                return;
            }

            // Location of the decoration on the screen
            Point location = GetLocation(position);

            // Tile id
            int tileid = GetTileId(position);


            // Offset the decoration if facing to the view point
            if (alignview)
            {
                location = PrepareLocation(position);
                tileid   = PrepareTile(position);
            }


            // Draws the decoration
            batch.DrawTile(set.Tileset,
                           tileid,
                           location, Color.White,
                           0.0f,
                           GetSwap(position) ? SpriteEffects.FlipHorizontally : SpriteEffects.None,
                           0.0f);
        }
Beispiel #4
0
		/// <summary>
		/// Draws a single decoration
		/// </summary>
		/// <param name="batch">Spritebatch handle</param>
		/// <param name="decoration">DecorationSet handle</param>
		/// <param name="position">Position of the square in the view</param>
		/// <param name="view">Viewing direction</param>
		/// <param name="alignview">True if the side is facing south (horizontaly span the decoration)</param>
		public void DrawDecoration(SpriteBatch batch, DecorationSet set, ViewFieldPosition position, bool alignview)
		{
			if (batch == null || set == null)
				return;

			// Location of the decoration on the screen
			Point location = GetLocation(position);

			// Tile id
			int tileid = GetTileId(position);


			// Offset the decoration if facing to the view point
			if (alignview)
			{
				location = PrepareLocation(position);
				tileid = PrepareTile(position);
			}


			// Draws the decoration
			batch.DrawTile(set.Tileset,
			tileid,
			location, Color.White,
			0.0f,
			GetSwap(position) ? SpriteEffects.FlipHorizontally : SpriteEffects.None,
			0.0f);
		}