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(); } }
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(); }
public override void Draw(Graphics g, Microsoft.Xna.Framework.GameTime gameTime) { if (area != null) { area.Draw(g, Size); } }
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(); } }
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(); }
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(); }
public override void Draw(Graphics g, GameTime gameTime) { Box area = null; if (HasMouse) { area = AreaHover; } if (IsPressed) { area = AreaPressed; } if (area == null) { area = AreaDefault; } DrawButton(g, area, gameTime); }
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(); } } }
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(); } }
public abstract void Draw(Graphics g, GameTime gameTime);
public void Draw(Graphics graphics, Diver diver) { graphics.Begin(); graphics.End(); }
public void Draw(Graphics g, GameTime gameTime) { DrawWidgets(g, gameTime, Top); }
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(); }
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(); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { graphics = new Graphics(GraphicsDevice); renderTarget = new RenderTarget2D(GraphicsDevice, 512, 512, 0, SurfaceFormat.Color, MultiSampleType.None, 1); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); White = new Texture2D(GraphicsDevice, 4, 4, 1, TextureUsage.Tiled, SurfaceFormat.Color); White.SetData(new uint[] { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }); font = Content.Load<SpriteFont>("Font"); guiManager.Top = new Container(); guiManager.Top.Size = new Point(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height); guiManager.Top.Font = font; BorderBox areaDefault = new BorderBox(White, true, Color.Gray, Color.Black, 2); BorderBox areaPressed = new BorderBox(White, true, Color.Black, Color.White, 2); BorderBox areaHover = new BorderBox(White, true, Color.LightGray, Color.Black, 2); Button b = new Button("Click me!", areaDefault, areaPressed, areaHover); b.X = 10; b.Y = 10; guiManager.Top.Add(b); b.AutoResize(); audioClip = new AudioClip(Content.RootDirectory + "/" + "clip.wav"); b.Clicked += new Button.ClickedHandler(PlaySound); waterEffect = DefaultContent.Load<Effect>("water"); sea = new Sea("sea", 2, 2, 1, 0); // TODO: use this.Content to load your game content Console.WriteLine(GraphicsDevice.GraphicsDeviceCapabilities.MaxPixelShaderProfile); }
public abstract void Draw(Graphics g, Rectangle dest);
public abstract void Draw(Graphics g, GameTime gameTime, Room.Layer layer);
public void Draw(Graphics g, Point size) { Draw(g, new Rectangle(0, 0, size.X, size.Y)); }
protected virtual void DrawButton(Graphics g, Box area, GameTime gameTime) { area.Draw(g, Size); g.DrawString(InheritedFont, Caption, new Rectangle(1, 1, Width, Height), TextAlignment, Color.Black); g.DrawString(InheritedFont, Caption, new Rectangle(0, 0, Width, Height), TextAlignment, Color.White); /* g.DrawString(InheritedFont, "Top\nLeft", new Rectangle(0, 0, Width, Height), TextAlignment.TopLeft, Color.Red); g.DrawString(InheritedFont, "TopCenter", new Rectangle(0, 0, Width, Height), TextAlignment.TopCenter, Color.Green); g.DrawString(InheritedFont, "TopRight", new Rectangle(0, 0, Width, Height), TextAlignment.TopRight, Color.Blue); g.DrawString(InheritedFont, "CenterLeft", new Rectangle(0, 0, Width, Height), TextAlignment.CenterLeft, Color.BlueViolet); g.DrawString(InheritedFont, "Center\nCent\tererer\nRecente\tr", new Rectangle(0, 0, Width, Height), TextAlignment.Center, Color.Yellow); g.DrawString(InheritedFont, "CenterRight", new Rectangle(0, 0, Width, Height), TextAlignment.CenterRight, Color.Orange); g.DrawString(InheritedFont, "BottomLeft", new Rectangle(0, 0, Width, Height), TextAlignment.BottomLeft, Color.NavajoWhite); g.DrawString(InheritedFont, "BottomCenter", new Rectangle(0, 0, Width, Height), TextAlignment.BottomCenter, Color.Purple); g.DrawString(InheritedFont, "Bottom\nRight", new Rectangle(0, 0, Width, Height), TextAlignment.BottomRight, Color.Sienna);*/ }