/// <summary> /// This draws all the objects /// </summary> public void Draw() { BeginDrawing(); ClearBackground(Color.WHITE); DrawText(fps.ToString(), 10, 10, 20, Color.RED); //This draws the tank. tankObject.Draw(); //This draws a box around the tank to show where the corners of the tank are. DrawLine((int)tankHitBoxPoint[0].GlobalTransform.m7, (int)tankHitBoxPoint[0].GlobalTransform.m8, (int)tankHitBoxPoint[1].GlobalTransform.m7, (int)tankHitBoxPoint[1].GlobalTransform.m8, Color.PURPLE); DrawLine((int)tankHitBoxPoint[1].GlobalTransform.m7, (int)tankHitBoxPoint[1].GlobalTransform.m8, (int)tankHitBoxPoint[2].GlobalTransform.m7, (int)tankHitBoxPoint[2].GlobalTransform.m8, Color.PURPLE); DrawLine((int)tankHitBoxPoint[2].GlobalTransform.m7, (int)tankHitBoxPoint[2].GlobalTransform.m8, (int)tankHitBoxPoint[3].GlobalTransform.m7, (int)tankHitBoxPoint[3].GlobalTransform.m8, Color.PURPLE); DrawLine((int)tankHitBoxPoint[3].GlobalTransform.m7, (int)tankHitBoxPoint[3].GlobalTransform.m8, (int)tankHitBoxPoint[0].GlobalTransform.m7, (int)tankHitBoxPoint[0].GlobalTransform.m8, Color.PURPLE); //This converts the tankHitBoxPoint SceneObjects to Vector2's so they can be used in the Fit function. List <Vector2> points = new List <Vector2>() { new Vector2(tankHitBoxPoint[0].GlobalTransform.m7, tankHitBoxPoint[0].GlobalTransform.m8), new Vector2(tankHitBoxPoint[1].GlobalTransform.m7, tankHitBoxPoint[1].GlobalTransform.m8), new Vector2(tankHitBoxPoint[2].GlobalTransform.m7, tankHitBoxPoint[2].GlobalTransform.m8), new Vector2(tankHitBoxPoint[3].GlobalTransform.m7, tankHitBoxPoint[3].GlobalTransform.m8) }; //This Fits the bounding box around the given points. tankObject.BoundingBox(points); //And this draws the bounding box. DrawLine((int)tankObject.boundingBox.min.x, (int)tankObject.boundingBox.min.y, (int)tankObject.boundingBox.max.x, (int)tankObject.boundingBox.min.y, tankBoxColor); DrawLine((int)tankObject.boundingBox.max.x, (int)tankObject.boundingBox.min.y, (int)tankObject.boundingBox.max.x, (int)tankObject.boundingBox.max.y, tankBoxColor); DrawLine((int)tankObject.boundingBox.max.x, (int)tankObject.boundingBox.max.y, (int)tankObject.boundingBox.min.x, (int)tankObject.boundingBox.max.y, tankBoxColor); DrawLine((int)tankObject.boundingBox.min.x, (int)tankObject.boundingBox.max.y, (int)tankObject.boundingBox.min.x, (int)tankObject.boundingBox.min.y, tankBoxColor); //This draws the wall. DrawRectangle((int)wall[0].x, (int)wall[0].y, (int)(wall[1].x - wall[0].x), (int)(wall[1].y - wall[0].y), Color.BROWN); //This draws the AABB around the wall. DrawRectangleLines((int)wall[0].x, (int)wall[0].y, (int)(wall[1].x - wall[0].x), (int)(wall[1].y - wall[0].y), wallBoxColor); EndDrawing(); }