Revision 962b8ff6
Added by Leszek Koltunski 2 months ago
src/main/java/org/distorted/objectlib/main/TwistyObject.java | ||
---|---|---|
146 | 146 |
private int mNumAxis; |
147 | 147 |
private boolean mThereAreDeciders; |
148 | 148 |
private TwistyLayerRotations mRotation; |
149 |
private int[] mColorTable; |
|
149 | 150 |
|
150 | 151 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
151 | 152 |
|
... | ... | |
226 | 227 |
mNumCuts[i] = (mCuts==null || mCuts[i]==null ? 0 : mCuts[i].length); |
227 | 228 |
} |
228 | 229 |
|
230 |
recreateFaceColors(); |
|
229 | 231 |
mMinimalCubiesInRow = getMinimalCubiesInRow(); |
230 | 232 |
mNumCubits = mOrigPos.length; |
231 |
mNumFaceColors = getNumFaceColors(); |
|
233 |
|
|
232 | 234 |
mBelongs = new boolean[mNumCubits]; |
233 | 235 |
|
234 | 236 |
int scramblingType = getScrambleType(); |
... | ... | |
281 | 283 |
mNode = new DistortedNode(mTexture,mEffects,mMesh); |
282 | 284 |
} |
283 | 285 |
|
286 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
287 |
|
|
288 |
public void recreateFaceColors() |
|
289 |
{ |
|
290 |
int[] tmp = getColorTable(); |
|
291 |
mNumFaceColors = tmp.length; |
|
292 |
mColorTable = new int[mNumFaceColors]; |
|
293 |
for(int i=0; i<mNumFaceColors; i++) mColorTable[i] = tmp[i]; |
|
294 |
} |
|
295 |
|
|
284 | 296 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
285 | 297 |
// in degrees so that everything can be treated modulo 360 |
286 | 298 |
|
... | ... | |
1239 | 1251 |
// figure out the whole face to which (cubit,face) belongs, repaint all (cubit,face) pairs to |
1240 | 1252 |
// the new color. |
1241 | 1253 |
|
1242 |
void repaintPuzzleFace(int cubit, int face, int color, float borders, float corners)
|
|
1254 |
void repaintPuzzleFace(int cubit, int face, int newColor, float borders, float corners)
|
|
1243 | 1255 |
{ |
1244 | 1256 |
int oldColorIndex = getCubitFaceColor(cubit,face); |
1245 |
int oldColor = getColor(oldColorIndex);
|
|
1257 |
int oldColor = mColorTable[oldColorIndex];
|
|
1246 | 1258 |
|
1247 |
if( oldColor!=color )
|
|
1259 |
if( oldColor!=newColor )
|
|
1248 | 1260 |
{ |
1249 |
changeColorInTexture(borders,corners,oldColor,color); |
|
1261 |
changeColorInTexture(borders,corners,oldColor,newColor); |
|
1262 |
mColorTable[oldColorIndex] = newColor; |
|
1250 | 1263 |
setTexture(); |
1251 | 1264 |
} |
1252 | 1265 |
} |
... | ... | |
1650 | 1663 |
if( texture<mNumTextures-mNumOverrides ) |
1651 | 1664 |
{ |
1652 | 1665 |
ObjectSticker sticker = retSticker(texture/mNumFaceColors); |
1653 |
int color = getColor(texture%mNumFaceColors);
|
|
1666 |
int color = mColorTable[texture%mNumFaceColors];
|
|
1654 | 1667 |
factory.drawRoundedPolygons(canvas, paint, col*mTexHeight, (mNumTexRows-row)*mTexHeight, color, mTexHeight, sticker,borders,corners); |
1655 | 1668 |
} |
1656 | 1669 |
else if( texture>mNumTextures-mNumOverrides && texture<=mNumTextures ) |
... | ... | |
1678 | 1691 |
{ |
1679 | 1692 |
if( texture<mNumTextures-mNumOverrides ) |
1680 | 1693 |
{ |
1681 |
int color = getColor(texture%mNumFaceColors);
|
|
1694 |
int color = mColorTable[texture%mNumFaceColors];
|
|
1682 | 1695 |
|
1683 | 1696 |
if( color==oldColor ) |
1684 | 1697 |
{ |
... | ... | |
2063 | 2076 |
public abstract int getNumCubitVariants(int[] numLayers); |
2064 | 2077 |
public abstract float[][] getCubitPositions(int[] numLayers); |
2065 | 2078 |
public abstract Static4D getCubitQuats(int cubit, int[] numLayers); |
2066 |
public abstract int getNumFaceColors(); |
|
2067 | 2079 |
public abstract float getScreenRatio(); |
2068 |
public abstract int getColor(int face);
|
|
2080 |
public abstract int[] getColorTable();
|
|
2069 | 2081 |
public abstract String getShortName(); |
2070 | 2082 |
|
2071 | 2083 |
// not only for JSON |
Also available in: Unified diff
progress with configurable stickers