Project

General

Profile

« Previous | Next » 

Revision 6f5eb9b3

Added by Leszek Koltunski 2 months ago

progress with configurable stickers

View differences:

src/main/java/org/distorted/objectlib/main/TwistyObject.java
147 147
  private boolean mThereAreDeciders;
148 148
  private TwistyLayerRotations mRotation;
149 149
  private int[] mColorTable;
150
  private float mTextureBorderMultiplier, mTextureCornerMultiplier;
150 151

  
151 152
///////////////////////////////////////////////////////////////////////////////////////////////////
152 153

  
......
228 229
      }
229 230

  
230 231
    recreateFaceColors();
232
    mTextureBorderMultiplier = 1.0f;
233
    mTextureCornerMultiplier = 1.0f;
234

  
231 235
    mMinimalCubiesInRow = getMinimalCubiesInRow();
232 236
    mNumCubits = mOrigPos.length;
233 237

  
......
1251 1255
// figure out the whole face to which (cubit,face) belongs, repaint all (cubit,face) pairs to
1252 1256
// the new color.
1253 1257

  
1254
  void repaintPuzzleFace(int cubit, int face, int newColor, float borders, float corners)
1258
  void repaintPuzzleFace(int cubit, int face, int newColor)
1255 1259
    {
1256 1260
    int oldColorIndex = getCubitFaceColor(cubit,face);
1257 1261
    int oldColor = mColorTable[oldColorIndex];
1258 1262

  
1259 1263
    if( oldColor!=newColor )
1260 1264
      {
1261
      changeColorInTexture(borders,corners,oldColor,newColor);
1265
      changeColorInTexture(oldColor,newColor);
1262 1266
      mColorTable[oldColorIndex] = newColor;
1263 1267
      setTexture();
1264 1268
      }
......
1654 1658
    paint.setColor(getInternalColor());
1655 1659
    canvas.drawRect(0, 0, mNumTexCols*mTexHeight, mNumTexRows*mTexHeight, paint);
1656 1660

  
1661
    mTextureBorderMultiplier = borders;
1662
    mTextureCornerMultiplier = corners;
1663

  
1657 1664
    int texture = 0;
1658 1665
    FactorySticker factory = FactorySticker.getInstance();
1659 1666

  
......
1664 1671
          {
1665 1672
          ObjectSticker sticker = retSticker(texture/mNumFaceColors);
1666 1673
          int color = mColorTable[texture%mNumFaceColors];
1667
          factory.drawRoundedPolygons(canvas, paint, col*mTexHeight, (mNumTexRows-row)*mTexHeight, color, mTexHeight, sticker,borders,corners);
1674
          factory.drawRoundedPolygons( canvas, paint, col*mTexHeight, (mNumTexRows-row)*mTexHeight, color,
1675
                                       mTexHeight, sticker,mTextureBorderMultiplier,mTextureCornerMultiplier);
1668 1676
          }
1669 1677
        else if( texture>mNumTextures-mNumOverrides && texture<=mNumTextures )
1670 1678
          {
......
1678 1686

  
1679 1687
///////////////////////////////////////////////////////////////////////////////////////////////////
1680 1688

  
1681
  void changeColorInTexture(float borders, float corners, int oldColor, int newColor)
1689
  private void changeColorInTexture(int oldColor, int newColor)
1682 1690
    {
1683 1691
    Paint paint = new Paint();
1684 1692
    Canvas canvas = new Canvas(mBitmap);
......
1696 1704
          if( color==oldColor )
1697 1705
            {
1698 1706
            ObjectSticker sticker = retSticker(texture/mNumFaceColors);
1699
            factory.drawRoundedPolygons(canvas, paint, col*mTexHeight, (mNumTexRows-row)*mTexHeight, newColor, mTexHeight, sticker,borders,corners);
1707
            factory.drawRoundedPolygons( canvas, paint, col*mTexHeight, (mNumTexRows-row)*mTexHeight,
1708
                                         newColor, mTexHeight, sticker,mTextureBorderMultiplier,mTextureCornerMultiplier);
1700 1709
            }
1701 1710
          }
1702 1711

  

Also available in: Unified diff