private void AddDelayed(string key, int color, int a, int b, int c, int d) { DelayedDraw draw; draw = new DelayedDraw(key, color, a, b, c, d); // } actions.Add(draw); }
public void Update() { int size = actions.Count; int pos = 0; bool changed = false; while (pos < size) { changed = true; DelayedDraw action = actions[0]; if (action != null) { if (action.key == "DrawCircle") { drawer.DrawCircle(action.color, action.a, action.b, action.c, action.d); } else if (action.key == "DrawLine") { drawer.DrawLine(action.color, action.a, action.b, action.c, action.d); } else if (action.key == "DrawRect") { drawer.DrawRect(action.color, action.a, action.b, action.c, action.d); } } try { actions.RemoveAt(0); } catch (Exception) { } //actionsRecycled.Add(action); pos++; } if (changed) { drawer.Update(); } }