public static SolidRun FirstSolidRun(IEnumerable <SpriteByte> open) { bool trigger = false; SpriteByte first = default(SpriteByte); SpriteByte last = default(SpriteByte); foreach (var item in open) { if (item.Mask == 0x00 && !trigger) { first = item; trigger = true; } if ((item.Mask != 0x00 || (item.Offset - last.Offset) > 1) && trigger) { return(new SolidRun(first, last)); } last = item; } // If we get to the end and are still solid, great if (last.Mask == 0x00 && trigger) { return(new SolidRun(first, last)); } return(null); }
private bool AreEquivalent(SpriteByte left, SpriteByte right) { // Return true if the two bytes are in an equivalence class return // The have to be adjacent (((right.Offset - left.Offset) == 1) && ( // First case: Both bytes are solid ((left.Mask == 0x00) && (right.Mask == 0x00)) || // Second case: Both bytes are masked ((left.Mask != 0x00) && (right.Mask != 0x00)) )); }
public EIGHT_BIT_STORE(SpriteByte data) { this.data = data; }
public SolidRun(SpriteByte first, SpriteByte last) { this.first = first; this.last = last; }