Exemple #1
0
        public void Draw(Graphics g, int currentRoomX, int currentRoomY)
        {
            Point contentSize = new Point(rooms.GetLength(0) * mapTiles.FrameSize.X, rooms.GetLength(1) * mapTiles.FrameSize.Y);
            g.PushClipRectangle(new Rectangle(200 - mapPaper.Width / 2, 150 - mapPaper.Height / 2 - 16, mapPaper.Width + 2, mapPaper.Height + 2));
            g.Begin();
            g.Draw(mapPaper, new Point(2, 2), new Color(0, 0, 0, 50));
            g.Draw(mapPaper, Point.Zero, new Color(255, 255, 255, 220));

            g.PushClipRectangle(new Rectangle((mapPaper.Width - contentSize.X) / 2, (mapPaper.Height - contentSize.Y) / 2, contentSize.X, contentSize.Y));

            for (int y = 0; y < rooms.GetLength(1); y++)
            {
                for (int x = 0; x < rooms.GetLength(0); x++)
                {
                    if (rooms[x, y] >= 0)
                    {
                        mapTiles.Draw(g, new Point(x * mapTiles.FrameSize.X, y * mapTiles.FrameSize.Y), rooms[x, y], new Color(255, 255, 255, 128));
                    }
                }
            }

            mapTiles.Draw(g, new Point(currentRoomX * mapTiles.FrameSize.X, currentRoomY * mapTiles.FrameSize.Y), 17);
            mapTiles.Draw(g, new Point(treasureX * mapTiles.FrameSize.X, treasureY * mapTiles.FrameSize.Y), 19);

            g.PopClipRectangle();

            g.End();
            g.PopClipRectangle();
        }
Exemple #2
0
        public void Draw(Graphics graphics, Diver diver)
        {
            if (action != Action.None)
            {
                int tipX = diver.X + diver.Width / 2 + length * direction;
                int tipY = diver.Y + diver.Height - 12;

                if (direction < 0)
                {
                    graphics.Begin();
                    graphics.Draw(texture, new Point(tipX, tipY - 4), new Rectangle(0, action == Action.Pulling ? 8 : 0, length, 8), Color.White);
                    graphics.End();
                }
                else
                {
                    graphics.Begin();
                    graphics.Draw(texture, new Rectangle(diver.X + diver.Width / 2, tipY - 4, length, 8), new Rectangle(0, action == Action.Pulling ? 8 : 0, length, 8), Color.White, 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0.0f);
                    graphics.End();
                }
            }
        }