Project

General

Profile

« Previous | Next » 

Revision 43a4ccff

Added by Leszek Koltunski over 2 years ago

simplify sticker/color map.

View differences:

src/main/java/org/distorted/objectlib/main/TwistyObject.java
1127 1127
    paint.setColor(COLOR_BLACK);
1128 1128
    canvas.drawRect(0, 0, mNumTexCols*TEXTURE_HEIGHT, mNumTexRows*TEXTURE_HEIGHT, paint);
1129 1129

  
1130
    int face = 0;
1130
    int texture = 0;
1131 1131
    FactorySticker factory = FactorySticker.getInstance();
1132 1132

  
1133 1133
    for(int row=0; row<mNumTexRows; row++)
1134 1134
      for(int col=0; col<mNumTexCols; col++)
1135 1135
        {
1136
        if( face>=NUM_TEXTURES ) break;
1137
        int sIndex = getStickerIndex(face);
1138
        ObjectSticker sticker = retSticker(sIndex);
1139
        factory.drawRoundedPolygon(canvas, paint, col*TEXTURE_HEIGHT, row*TEXTURE_HEIGHT, getColor(face%NUM_FACE_COLORS), sticker);
1140
        face++;
1136
        if( texture>=NUM_TEXTURES ) break;
1137
        ObjectSticker sticker = retSticker(texture/NUM_FACE_COLORS);
1138
        int color = getColor(texture%NUM_FACE_COLORS);
1139
        factory.drawRoundedPolygon(canvas, paint, col*TEXTURE_HEIGHT, row*TEXTURE_HEIGHT, color, sticker);
1140
        texture++;
1141 1141
        }
1142 1142

  
1143 1143
    if( !mTexture.setTexture(bitmap) )
......
1385 1385
  protected abstract int getFaceColor(int cubit, int cubitface, int[] numLayers);
1386 1386
  protected abstract int getResource(int[] numLayers);
1387 1387
  protected abstract ObjectType intGetObjectType(int[] numLayers);
1388
  protected abstract int getStickerIndex(int face);
1389 1388

  
1390 1389
  // for JSON only
1391 1390
  public abstract int getSolvedFunctionIndex();

Also available in: Unified diff