protected T Draw(double delta_time) { while (!canvas.IsReady) { Thread.Yield(); } graph_producer.Produce( delta_time: delta_time, canvas: canvas, point_drawer: point_drawer, information: control_panel.GetStateShot()); return(canvas.Output()); }
protected void Draw(double delta_time) { ICanvas <T> canvas; if (free_canvas.TryDequeue(out canvas)) { if (!canvas.IsReady) { free_canvas.Enqueue(canvas_constructor.NewInstance()); } } else { canvas = canvas_constructor.NewInstance(); } IPointDrawer point_drawer; if (!free_point_drawer.TryDequeue(out point_drawer)) { point_drawer = point_drawer_constructor.NewInstance(); } while (!canvas.IsReady) { Thread.Yield(); } graph_producer.Produce( delta_time: delta_time, canvas: canvas, point_drawer: point_drawer, information: control_panel.GetStateShot()); T new_graph = canvas.Output(); buffer.Enqueue(new_graph); free_canvas.Enqueue(canvas); free_point_drawer.Enqueue(point_drawer); }