Beispiel #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();
        }
Beispiel #2
0
        public override void Draw(Graphics g, GameTime gameTime, Room.Layer layer)
        {
            g.Begin();

            if (layer == this.layer)
                animationGrid.Draw(g, Dimension, animationGridFrame, color);

            g.End();
        }
Beispiel #3
0
 public override void Draw(Graphics g, GameTime gameTime, Room.Layer layer)
 {
     if (layer == Room.Layer.Player)
     {
         g.Begin();
         animationGrid.Draw(g, Position, animationFrame);
         g.End();
     }
 }
Beispiel #4
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();
                }
            }
        }
Beispiel #5
0
        public override void Draw(Graphics g, GameTime gameTime, Room.Layer layer)
        {
            g.Begin();
            SpriteEffects spriteEffects = xSpeed.Diff < 0 ? SpriteEffects.FlipHorizontally:SpriteEffects.None;

            if(dead)
                spriteEffects |= SpriteEffects.FlipVertically;

            if (layer == Room.Layer.Player)
                animationGrid.Draw(g, Position, ((int)animationGridFrame) % sprites, spriteEffects);

            g.End();
        }
Beispiel #6
0
        public override void Draw(Graphics g, GameTime gameTime, Room.Layer layer)
        {
            if (layer == Room.Layer.Player)
            {
                g.Begin();
                ropeGrid.Draw(g, new Point(190, -20 + offsetY), diverFreezed?1:0);
                g.End();
            }

            if (layer == Room.Layer.Foreground)
            {
                g.Begin();
                if (collisionWithDiver && diverFreezed && !surface)
                {
                    g.DrawStringShadowed(font,
                                         "Press Space to surface",
                                         new Rectangle(0, 100, 400, 20),
                                         TextAlignment.Center,
                                         Color.White);
                }
                g.End();
            }
        }
Beispiel #7
0
        private void DrawWidgets(Graphics g, GameTime gameTime, Widget w)
        {
            if (!w.IsVisible)
            {
                return;
            }

            g.PushClipRectangle(w.Dimension);

            if (w.IsOpaque)
            {
                g.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Deferred, SaveStateMode.SaveState);
                w.Draw(g, gameTime);
                g.End();
            }

            foreach (Widget c in w.Children)
            {
                DrawWidgets(g, gameTime, c);
            }

            g.PopClipRectangle();
        }
Beispiel #8
0
        public override void Draw(Graphics g, GameTime gameTime, Room.Layer layer)
        {
            if (layer == this.layer)
            {
                Color c = color;

                if (timeToLive > 0)
                {
                    c = new Color(c.R, c.G, c.B, (byte)(color.A * (1.0f - (frame / timeToLive))));
                }

                g.Begin(blend);
                spriteGrid.Draw(g, Dimension, (int)frame, c);
                g.End();
            }
        }
Beispiel #9
0
        public void Draw(Graphics graphics, Diver diver)
        {
            graphics.Begin();

            graphics.End();
        }
Beispiel #10
0
        public override void Draw(Graphics g, GameTime gameTime, Room.Layer layer)
        {
            if (layer == Room.Layer.Player)
            {
                if (Tool1 != null) Tool1.Draw(g, this);
                if (Tool2 != null) Tool2.Draw(g, this);

                g.Begin();
                Point pos = new Point(Position.X - 2, Position.Y);

                if (climbing)
                    ClimbingGrid.Draw(g, new Point(pos.X, pos.Y - (ClimbingGrid.FrameSize.Y - Height)), climbingGridFrame / ClimbAnimationSpeed, spriteEffects);
                else if (isOnGround && Velocity.X != 0)
                    WalkingGrid.Draw(g, new Point(Center.X - WalkingGrid.FrameSize.X / 2, pos.Y - (WalkingGrid.FrameSize.Y - Height)), walkingGridFrame / WalkAnimationSpeed, spriteEffects);
                else if (isOnGround)
                    StandingGrid.Draw(g, new Point(Center.X - StandingGrid.FrameSize.X / 2, pos.Y - (StandingGrid.FrameSize.Y - Height)), standingGridFrame, spriteEffects);
                else
                    JumpingGrid.Draw(g, new Point(Center.X - JumpingGrid.FrameSize.X / 2, pos.Y - (JumpingGrid.FrameSize.Y - Height) + 5), jumpingGridFrame, spriteEffects);
                g.End();
            }

            if (layer == Room.Layer.Foreground)
            {
                g.Begin();
                if (collisionWithDiver && !Enabled)
                {
                    g.DrawStringShadowed(font,
                                        "Press Space to select " + Name,
                                        new Rectangle(0, 100, 400, 20),
                                        TextAlignment.Center,
                                        Color.White);
                }
                g.End();
            }
        }