コード例 #1
0
ファイル: Screen.cs プロジェクト: yadiate/MoonLightCraft
        public override void Draw(SpriteBatch spriteBatch)
        {
            DotCamera.DotCameraBegin(spriteBatch, Camera, SpriteSortMode.Immediate);
            foreach (Point location in dungeon.CellLocations)
            {
                Cell cell = dungeon[location];

                LineExt.DrawFullRectangle(spriteBatch, new Rectangle(TopLeft(location).X, TopLeft(location).Y, xStep, yStep), GetWallCount(cell) == 4 ? Color.Black : Color.Transparent);
                //g.FillRectangle(GetWallCount(cell) == 4 ? Brushes.Black : Brushes.Transparent, TopLeft(location).X, TopLeft(location).Y, xStep, yStep);

                Color pen = GetSidePen(cell.NorthSide);
                LineExt.DrawLine(spriteBatch, TopLeft(location).ToVector2(), TopRight(location).ToVector2(), pen);
                //g.DrawLine(pen, TopLeft(location), TopRight(location));
                if (cell.NorthSide == SideType.Door)
                {
                    LineExt.DrawFullRectangle(spriteBatch, new Rectangle(TopLeft(location).X + 1 + (xStep - 2) / 4, TopLeft(location).Y - 3, (xStep / 2) - 1, 6), pen);
                }
                //if (cell.NorthSide == SideType.Door) g.DrawRectangle(pen, TopLeft(location).X + 1 + (xStep - 2) / 4, TopLeft(location).Y - 3, (xStep / 2) - 1, 6);


                pen = GetSidePen(cell.WestSide);
                LineExt.DrawLine(spriteBatch, TopLeft(location).ToVector2(), BottomLeft(location).ToVector2(), pen);
                //g.DrawLine(pen, TopLeft(location), BottomLeft(location));
                if (cell.WestSide == SideType.Door)
                {
                    LineExt.DrawFullRectangle(spriteBatch, new Rectangle(TopLeft(location).X - 3, TopLeft(location).Y + 1 + (yStep - 2) / 4, 6, (xStep / 2) - 1), pen);
                }
                //if (cell.WestSide == SideType.Door) g.DrawRectangle(pen, TopLeft(location).X - 3, TopLeft(location).Y + 1 + (yStep - 2) / 4, 6, (xStep / 2) - 1);

                LineExt.DrawLine(spriteBatch, BottomLeft(location).ToVector2(), BottomRight(location).ToVector2(), GetSidePen(cell.SouthSide));
                //g.DrawLine(GetSidePen(cell.SouthSide), BottomLeft(location), BottomRight(location));
                LineExt.DrawLine(spriteBatch, TopRight(location).ToVector2(), BottomRight(location).ToVector2(), GetSidePen(cell.EastSide));
                //g.DrawLine(GetSidePen(cell.EastSide), TopRight(location), BottomRight(location));
            }

            SpritesDraw(spriteBatch);
            spriteBatch.End();
            DotCamera.DotCameraBegin(spriteBatch, Camera);


            Items.DrawCustome(spriteBatch);
            Unit.DrawCustome(spriteBatch);
            spriteBatch.End();
            DotCamera.DotCameraBegin(spriteBatch, Camera);
            Physics.DrawDebugView(Camera);
            spriteBatch.End();
        }