Project

General

Profile

« Previous | Next » 

Revision 0501a4b8

Added by Leszek Koltunski about 3 years ago

Transpose the Object Popup

View differences:

src/main/java/org/distorted/objects/ObjectList.java
210 210
  private final int[] mObjectSizes, mMaxLevels, mSmallIconIDs, mMediumIconIDs, mBigIconIDs, mHugeIconIDs, mResourceIDs;
211 211
  private final Class<? extends TwistyObject> mObjectClass;
212 212
  private final Movement mObjectMovementClass;
213
  private final int mColumn, mNumSizes;
213
  private final int mRow, mNumSizes;
214 214
  private final int mFOV;
215 215

  
216 216
  private static final ObjectList[] objects;
......
252 252
  private static void setUpColAndRow()
253 253
    {
254 254
    mIndices = new int[NUM_OBJECTS];
255
    mColCount= 0;
255
    mRowCount= 0;
256 256

  
257 257
    for(int obj=0; obj<NUM_OBJECTS; obj++)
258 258
      {
259
      mIndices[obj] = objects[obj].mColumn;
260
      if( mIndices[obj]>=mColCount ) mColCount = mIndices[obj]+1;
259
      mIndices[obj] = objects[obj].mRow;
260
      if( mIndices[obj]>=mRowCount ) mRowCount = mIndices[obj]+1;
261 261
      }
262 262

  
263
    mRowCount = 0;
263
    mColCount = 0;
264 264

  
265
    for(int col=0; col<mColCount; col++)
265
    for(int row=0; row<mRowCount; row++)
266 266
      {
267
      int numObjects = computeNumObjectsInColumn(col);
268
      if( numObjects>mRowCount ) mRowCount = numObjects;
267
      int numObjects = computeNumObjectsInRow(row);
268
      if( numObjects>mColCount ) mColCount = numObjects;
269 269
      }
270 270
    }
271 271

  
272 272
///////////////////////////////////////////////////////////////////////////////////////////////////
273 273

  
274
  private static int computeNumObjectsInColumn(int column)
274
  private static int computeNumObjectsInRow(int row)
275 275
    {
276 276
    int num=0;
277 277

  
278 278
    for(int object=0; object<NUM_OBJECTS; object++)
279 279
      {
280
      if( objects[object].mColumn == column )
280
      if( objects[object].mRow == row )
281 281
        {
282 282
        num += objects[object].mNumSizes;
283 283
        }
......
492 492

  
493 493
///////////////////////////////////////////////////////////////////////////////////////////////////
494 494

  
495
  ObjectList(int[][] info, Class<? extends TwistyObject> object , Movement movement, int column, int fov)
495
  ObjectList(int[][] info, Class<? extends TwistyObject> object , Movement movement, int row, int fov)
496 496
    {
497 497
    mNumSizes = info.length;
498 498

  
......
517 517

  
518 518
    mObjectClass         = object;
519 519
    mObjectMovementClass = movement;
520
    mColumn              = column;
520
    mRow                 = row;
521 521
    mFOV                 = fov;
522 522
    }
523 523

  

Also available in: Unified diff