public override void Draw(SpriteBatch sb) { base.Draw(sb); ShapeRenderer.Rect(sb, Color, GetDrawPosition(), BoundingBox * 2); ShapeRenderer.Rect(sb, Color, (int)Position.X, (int)Position.Y, (int)BoundingBox.X, (int)BoundingBox.Y); Looking = Looking.Forward; float rotation = 0; if (LookingDown) { rotation = (float)Math.PI; } if (LookingUp) { } if (Facing == Facing.Right) { ShapeRenderer.Rect(sb, Color.DarkBlue, GetDrawPosition() + new Vector2(BoundingBox.X * 2, 0), new Vector2(30, 10)); } if (Facing == Facing.Left) { ShapeRenderer.Rect(sb, Color.DarkBlue, GetDrawPosition() - new Vector2(30, 0), new Vector2(30, 10)); } //ShapeRenderer.Rect(sb, Color.DarkBlue, GetDrawPosition(), new Vector2(20, 8), rotation); TextRenderer.Print(sb, Health.ToString(), GetDrawPosition(), Color.Green); }
public void Draw(GraphicsDevice gdev, SpriteBatch spriteBatch) { spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, Camera.WorldSpaceMatrix); DrawGrid(spriteBatch); Map.Draw(spriteBatch); foreach (LevelGeometry geom in SelectedObjects) { ShapeRenderer.OutlineRect(spriteBatch, new Color(0.0f, 0.0f, 1.0f), geom.Position, geom.Size); } foreach (LevelGeometry geom in Map.Geometry) { Rectangle rect = new Rectangle(geom.Position.ToPoint(), geom.Size.ToPoint()); if (rect.Contains(Camera.ScreenToWorldCoordinates(MousePosition))) { ShapeRenderer.OutlineRect(spriteBatch, new Color(0.5f, 0.5f, 1.0f), geom.Position, geom.Size); } } ShapeRenderer.Rect(spriteBatch, Color.Red, Camera.Position, new Vector2(3, 3)); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Deferred); var value = Camera.ScreenToWorldCoordinates(MousePosition); string debugText = String.Format("mouz: {0} {1} {2} {3} {4} {5}", MousePosition.X, MousePosition.Y, value.X, value.Y, Camera.ViewportWidth, Camera.ViewportHeight ); TextRenderer.Print(spriteBatch, debugText, Vector2.Zero, Color.White); spriteBatch.End(); }
private void DrawOverflowBox() { SpriteBatch.Begin(); ShapeRenderer.Rect(SpriteBatch, Color.Black, new Vector2(0, 0), new Vector2(Camera.ViewportOffset.X, Window.ClientBounds.Height)); ShapeRenderer.Rect(SpriteBatch, Color.Black, new Vector2(Window.ClientBounds.Width - Camera.ViewportOffset.X, 0), new Vector2(Camera.ViewportOffset.X, Window.ClientBounds.Height)); ShapeRenderer.Rect(SpriteBatch, Color.Black, new Vector2(0, 0), new Vector2(Window.ClientBounds.Width, Camera.ViewportOffset.Y)); ShapeRenderer.Rect(SpriteBatch, Color.Black, new Vector2(0, Window.ClientBounds.Height - Camera.ViewportOffset.Y), new Vector2(Window.ClientBounds.Width, Camera.ViewportOffset.Y)); SpriteBatch.End(); }
public void Draw(SpriteBatch spriteBatch, GraphicsDevice gdev) { TPLeft.Draw(spriteBatch); TPRight.Draw(spriteBatch); TPJump.Draw(spriteBatch); TPShoot.Draw(spriteBatch); TPShootUp.Draw(spriteBatch); TPShootDown.Draw(spriteBatch); foreach (TouchLocation touch in TouchPanel.GetState()) { ShapeRenderer.Rect(spriteBatch, Color.Green, touch.Position, new Vector2(4, 4)); } }
protected virtual void DrawGameLayer() { if (Client.IsConnected) { foreach (LevelGeometry geom in World.levelGeometries) { geom.Draw(SpriteBatch); } // entity list ShapeRenderer.Rect(SpriteBatch, new Color(0.5f, 0.5f, 0.5f), new Vector2(), new Vector2()); foreach (var entity in World.entities) { if (entity is IRenderComponent drawableEntity) { drawableEntity.Draw(SpriteBatch); } } } }
public override void Draw(SpriteBatch sb) { base.Draw(sb); ShapeRenderer.Rect(sb, Color.Red, Position, BoundingBox); }
public void Draw(SpriteBatch spriteBatch) { Color color = IsTouched ? Color.White : Color.DarkGray; ShapeRenderer.Rect(spriteBatch, color, new Vector2(Rect.X, Rect.Y), new Vector2(Rect.Width, Rect.Height)); }