public override void Draw(IFlyDrawContext drawContext) { if (this.fixture != null) { drawContext.ShapeRenderer.DrawSolidCircle((CircleShape)this.fixture.Fixture.Shape, this.fixture.PhysicsTransform, this.FinalColor, this.segmentCount); } }
public void Draw(IFlyDrawContext drawContext) { var center = drawContext.ViewSize / 2; UIFonts.Quartz14.Draw(this.Header, center, TextAlign.Center, this.blendEffect.Apply(Xna.Color.Red), drawContext); UIFonts.Quartz10.Draw(this.Text, center + new Vector2(0.0f, UIFonts.Quartz14.LineSpacing + 10), TextAlign.Center, this.blendEffect.Apply(Xna.Color.White), drawContext); }
private void DrawEmpireStats(IFlyDrawContext drawContext) { var empire = this.Player.OwnedBy.Empire; string str = string.Format("{0} Minerals", empire.Minerals.ToString()); this.font.Draw(str, new Vector2(drawContext.ViewWidth - 15, 10), TextAlign.Right, Xna.Color.LightGreen, drawContext); }
private void DrawUnprocessed(IFlyDrawContext drawContext) { this.DrawBackground(drawContext); this.DrawContent(drawContext); this.OutputShapes(drawContext); this.DrawOverlays(drawContext); }
private void DrawOverlays(IFlyDrawContext drawContext) { if (this.userInterface != null) { this.userInterface.Draw(drawContext); } }
public void Draw(IFlyDrawContext drawContext) { if (this.DrawStrategy != null) { this.DrawStrategy.Draw(drawContext); } }
private void DrawSpeed(IFlyDrawContext drawContext) { Vector2 velocity = this.Player.Physics.LinearVelocity; double speed = Math.Round(velocity.Length); this.font.Draw(speed.ToString() + " km/s", new Vector2(55, 10), Xna.Color.LightGreen, drawContext); }
public override void Draw(IFlyDrawContext drawContext) { if (this.fixture != null) { drawContext.ShapeRenderer.DrawShape(this.fixture.Fixture, this.fixture.PhysicsTransform, this.FinalColor); } }
public override void Draw(IFlyDrawContext drawContext) { Xna.Vector2 center = this.Entity.Position.ToXna(); IShapeRenderer renderer = drawContext.ShapeRenderer; renderer.DrawSolidCircleWithoutRotationIndicator(center, this.Radius, Xna.Vector2.One, this.FinalColor); renderer.DrawSolidCircleWithoutRotationIndicator(center, this.Radius * 0.2f, Xna.Vector2.One, this.FinalColor); }
protected override void Draw(Xna.GameTime gameTime) { IFlyDrawContext drawContext = this.graphics.DrawContext; drawContext.GameTime = gameTime; gameStates.Current.Draw(drawContext); base.Draw(gameTime); }
public override void Draw(IFlyDrawContext drawContext) { var renderer = drawContext.ShapeRenderer; renderer.DrawSolidCircleWithoutRotationIndicator(this.Entity.Parent.Position.ToXna(), this.Entity.Radius, Xna.Vector2.One, this.ApplyTinting(Xna.Color.Black)); var end = this.Entity.Position + Vector2.FromAngle(this.Entity.Rotation) * (this.Entity.BulletSpawnDistance * 1.1f); renderer.DrawSegment(this.Entity.Parent.Position.ToXna(), end.ToXna(), this.ApplyTinting(Xna.Color.White)); }
public void Draw(IFlyDrawContext drawContext) { this.device.SetRenderTarget(renderTarget); this.device.BlendState = BlendState.NonPremultiplied; this.device.Clear(Xna.Color.Black); { this.RenderAction(drawContext); } this.device.SetRenderTarget(null); this.bloom.PostProcess(this.renderTarget, null, drawContext); }
protected override void OnDraw(IFlyDrawContext drawContext) { if (this.IsLarge) { const float LargeIndicatorSize = 50; this.DrawRotationIndicator(drawContext, drawContext.ViewWidth / 2 - LargeIndicatorSize, drawContext.ViewHeight / 2 - LargeIndicatorSize, LargeIndicatorSize); } else { this.DrawRotationIndicator(drawContext); } }
protected override void OnDraw(IFlyDrawContext drawContext) { if (selectionContainer.SelectedEntity != null) { var entity = selectionContainer.SelectedEntity; Vector2 position = drawContext.Camera.Project(GetPosition(entity)); position.X = (int)System.Math.Floor(position.X); position.Y = (int)System.Math.Floor(position.Y); string text = GetText(entity); UIFonts.Tahoma10.Draw(text, position, Xna.Color.LightGreen, drawContext); } }
private void DrawSelectionHelpers(IFlyDrawContext flyContext) { var entity = this.selectionContainer.SelectedEntity; if (entity != null) { flyContext.ShapeRenderer.DrawSolidSegment( entity.Transform.Position.ToXna(), (entity.Transform.Position + Vector2.FromAngle(entity.Rotation) * 10.0f).ToXna(), Xna.Color.Gray, 0.05f ); } }
public override void Draw(IFlyDrawContext drawContext) { if (this.fixture != null) { Xna.Color color = this.FinalColor; foreach (Fixture fixture in this.fixture.Fixtures) { FarseerPhysics.Common.Transform transform; fixture.Body.GetTransform(out transform); drawContext.ShapeRenderer.DrawShape(fixture, transform, color); } } }
private void DrawRotationIndicator(IFlyDrawContext drawContext, float StartX = 5, float StartY = 5, float Size = 20) { var physics = this.Player.Physics; var velocity = physics.LinearVelocity; int speed = (int)velocity.Length; float rotation; if (speed == 0) { rotation = -physics.Rotation; } else { var velDir = velocity.Direction; rotation = (float)Math.Atan2(-velDir.Y, velDir.X); } // Upper left: float sizeRatio = Size * Ratio(rotation, -Constants.Pi + Constants.PiOver4); drawContext.Batch.DrawRect(new RectangleF(StartX + Size - sizeRatio, StartY + Size - sizeRatio, sizeRatio, sizeRatio), Xna.Color.LightGreen); // Upper right: sizeRatio = Size * Ratio(rotation, -Constants.PiOver4); drawContext.Batch.DrawRect(new RectangleF(StartX + Size, StartY + Size - sizeRatio, sizeRatio, sizeRatio), Xna.Color.LightGreen); // Lower left: sizeRatio = Size * Ratio(rotation, Constants.Pi - Constants.PiOver4); drawContext.Batch.DrawRect(new RectangleF(StartX + Size - sizeRatio, StartY + Size, sizeRatio, sizeRatio), Xna.Color.LightGreen); // Lower right: sizeRatio = Size * Ratio(rotation, Constants.PiOver4); drawContext.Batch.DrawRect(new RectangleF(StartX + Size, StartY + Size, sizeRatio, sizeRatio), Xna.Color.LightGreen); var center = new Vector2(StartX + Size, StartY + Size); var left = new Vector2(StartX + 2 * Size, StartY + Size); left.Rotate(center, -physics.Rotation); drawContext.Batch.DrawRect(new RectangleF(left, new Vector2(Size / 4, Size / 4)), Xna.Color.Red.WithAlpha(125), 1.0f); }
//public IPhysicsEntity GetPhysicsEntityIn( RectangleF area ) //{ // AABB aabb = new AABB( new XnaF.Vector2( area.Width, area.Height ), area.Position.ToXna() ); // IFlyComponent component = null; // Console.WriteLine( "query" ); // this.physicsWorld.QueryAABB( fixture => { // component = fixture.Body.UserData as ICollideable; // if( component != null ) // { // var bounds = component.Owner.Bounds; // if( bounds.Rectangle.Intersects( area ) ) // { // return false; // } // } // return true; // }, // ref aabb // ); // return component != null ? (component.Owner as IPhysicsEntity) : null; //} public void Draw(IFlyDrawContext drawContext) { HiddenEntities = 0; RectangleF area = drawContext.Camera.Area; for (int i = 0; i < this.entities.Count; ++i) { IFlyEntity entity = this.entities[i]; if (!entity.Bounds.HasBounds || entity.Bounds.Intersects(ref area)) { entity.Draw(drawContext); } else { ++HiddenEntities; } } }
public override void Draw(IFlyDrawContext drawContext) { base.Draw(drawContext); Vector2 normal = Vector2.FromAngle(this.Entity.Rotation); Vector2 perp = normal.Perpendicular; // Turpine A: Vector2 start = this.Entity.Position - normal * 0.25f + (perp * 0.45f); Vector2 end = start - (normal * 0.1f); drawContext.ShapeRenderer.DrawSolidSegment(start.ToXna(), end.ToXna(), this.FinalColor, 0.1f); // Turpine B: start = this.Entity.Position - normal * 0.25f - (perp * 0.45f); end = start - (normal * 0.1f); drawContext.ShapeRenderer.DrawSolidSegment(start.ToXna(), end.ToXna(), this.FinalColor, 0.1f); //// // Cockpit A: //// start = this.Entity.Position + (normal * 0.20f) - (perp * 0.15f); //// end = start + (perp * 0.30f); //// drawContext.ShapeRenderer.DrawSolidSegment( start.ToXna(), end.ToXna(), this.FinalColor, 0.1f ); }
protected override void OnDraw(IFlyDrawContext drawContext) { DrawSpeed(drawContext); DrawEmpireStats(drawContext); DrawControlInfo(drawContext); }
private void DrawControlInfo(IFlyDrawContext drawContext) { this.font.Draw("[Shift -> Boost] [Q -> Quantum Stop] [Esc -> Exit]", new Vector2(15, drawContext.ViewHeight - 70), TextAlign.Left, Xna.Color.LightGreen, drawContext); this.font.Draw("[SPACE -> Bullet] [B -> Tractor Beam] [F10 -> Editor]", new Vector2(15, drawContext.ViewHeight - 50), TextAlign.Left, Xna.Color.LightGreen, drawContext); this.font.Draw("[ALT -> Rocket] [X -> Blackhole]", new Vector2(15, drawContext.ViewHeight - 30), TextAlign.Left, Xna.Color.LightGreen, drawContext); }
private void OutputShapes(IFlyDrawContext drawContext) { var camera = drawContext.Camera; drawContext.ShapeRenderer.RenderOutput(ref camera.Projection, ref camera.View); }
private void DrawContent(IFlyDrawContext drawContext) { this.scene.Draw(drawContext); }
private void DrawBackground(IFlyDrawContext drawContext) { var camera = drawContext.Camera; starfield.Draw(new Xna.Vector2(camera.Scroll.X, -camera.Scroll.Y)); }
protected abstract void OnDraw(IFlyDrawContext drawContext);
public void Draw(IFlyDrawContext drawContext) { this.renderPipeline.RenderAction = this.DrawUnprocessed; this.renderPipeline.Draw(drawContext); }
public abstract void Draw(IFlyDrawContext drawContext);
public override void Draw(IFlyDrawContext drawContext) { var joint = this.Entity.Joint; drawContext.ShapeRenderer.DrawSolidSegment(joint.WorldAnchorA, joint.WorldAnchorB, this.FinalColor, 0.05f); }