public void Draw() { Queue <VectorT> lines = vectrex.vecx_lines(vectrex.VECTREX_MHZ / 12); if (lines.Count == 0) { lines = new Queue <VectorT>(lastLines); } lastLines = new Queue <VectorT>(lines); draw.starts.Clear(); draw.ends.Clear(); draw.colors.Clear(); List <VectorT> drawnlines = new List <VectorT>(); while (lines.Count > 0) { VectorT vec = lines.Dequeue(); bool drawn = false; foreach (VectorT v in drawnlines) { if (vec.x0 == v.x0 && vec.x1 == v.x1 && vec.y0 == v.y0 && vec.y1 == v.y1 && vec.color == v.color) { drawn = true; break; } } if (!drawn) { drawnlines.Add(vec); Vector2 start = new Vector2(vec.x0 * gfxScl.x + gfxOff.x, vec.y0 * gfxScl.y + gfxOff.y); Vector2 end = new Vector2(vec.x1 * gfxScl.x + gfxOff.x, vec.y1 * gfxScl.y + gfxOff.y); Color color = new Color32(vec.color, vec.color, vec.color, vec.color); color.a = 1; draw.starts.Add(start); draw.ends.Add(end); draw.colors.Add(color); } } }
public Queue <VectorT> vecx_lines(long cyclesBack) { return(lines_last_frame); Queue <VectorT> ret = new Queue <VectorT>(); int cnt = lines.Count; for (int i = 0; i < cnt; ++i) { VectorT vec = lines.Dequeue(); if (fcycles - vec.timecode < cyclesBack) { ret.Enqueue(vec); lines.Enqueue(vec); } } return(ret); }