public void SortByPosX(int aScanline, int aObjHeight) { int totalSelected = 0; int idx = 0; m_objAttrsSorted.Clear(); // Select the first 10 visible sprites while (idx < 40) { ObjAttributes obj = GetObjAttributes(idx); int yPos = obj.PosY - 16; if (aScanline >= yPos && aScanline < (yPos + aObjHeight)) { m_objAttrsSorted.Add(obj); ++totalSelected; if (totalSelected == 10) { break; } } ++idx; } // Sort by pos X m_objAttrsSorted.Sort(); }
//byte[] m_mem; public OAM( ) { m_objAttrs = new ObjAttributes[40]; m_objAttrsSorted = new List <ObjAttributes>(m_objAttrs.Length); for (int i = 0; i < m_objAttrs.Length; ++i) { m_objAttrs[i] = new ObjAttributes(i); m_objAttrsSorted.Add(m_objAttrs[i]); } //m_mem = new byte[40 * 4]; }