/// <summary> /// Constructor to create a new instance of our game. /// </summary> public GameEngine() { // Tell the program to load all files relative to the "Content" directory. content = new ContentManager(Services); content.RootDirectory = "Content"; canvas = new GameCanvas(this); }
public override void Draw(GameCanvas g) { foreach (BoxObject link in bodies) { link.Draw(g); } }
/// <summary> /// Draws the physics object. /// </summary> /// <remarks> /// This is sufficient for most complex objects. /// </remarks> /// <param name="canvas">Drawing context</param> public override void Draw(GameCanvas canvas) { // Just pass the drawing to the individual objects. foreach (BoxObject obj in bodies) { obj.Draw(canvas); } }
public void Draw(GameCanvas g) { for (int i = 0; i < points.Count - 1; i++) { g.DrawLine(points[i], points[i + 1], Color.Red); } box.Draw(g); box2.Draw(g); }
public override void Draw(GameCanvas g) { SpriteEffects flip = facingRight ? SpriteEffects.None : SpriteEffects.FlipHorizontally; // Determine what to draw, then do it if (isGrounded && body.LinearVelocity.Length() > 0.1f) { texture = walking; g.DrawSprite(texture, Color.White, Position, scale, rotation, frame, MAX_FRAME, flip); } else { texture = standing; if (body.LinearVelocity.Y < 0.0f) texture = jumping; if (body.LinearVelocity.Y > 0.0f) texture = falling; g.DrawSprite(texture, Color.White, Position, scale, rotation, flip); } }
/// <summary> /// Draws the physics object. /// </summary> /// <param name="canvas">Drawing context</param> public virtual void Draw(GameCanvas g) { g.DrawSprite(texture, Color.White, Position, scale, rotation); }
/// <summary> /// Draws the physics object. /// </summary> /// <param name="canvas">Drawing context</param> public abstract void Draw(GameCanvas canvas);