//Draws the image at the specified position public void Draw(ICanvasAnimatedControl sender, CanvasAnimatedDrawEventArgs args, DrawInfo info) { //If the image is set if (image != null) { //Compute the final position to draw at Vector2 drawPosition = position + info.offset; //If the drawing should be centered if (centered) { //Get half of the image's size Vector2 halfSize = new Vector2(image.Size.Width / 2, image.Size.Height / 2); //Move the image back by half of its size drawPosition -= halfSize; } //Draw the image args.DrawingSession.DrawImage(image, (float)drawPosition.x, (float)drawPosition.y); } }
//Draws this game object public override void Draw(ICanvasAnimatedControl sender, CanvasAnimatedDrawEventArgs args, DrawInfo info) { //Draw the image drawableImage.Draw(sender, args, info); //If debug drawing is enabled if (info.debug) { //Draw the debug collider DebugDraw(sender, args, info); } }