Revision bdbbb4c5
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objects/TwistyCube.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
package org.distorted.objects; |
21 | 21 |
|
22 |
import static org.distorted.objects.Movement.TYPE_NOT_SPLIT;
|
|
22 |
import static org.distorted.objectlb.Movement.TYPE_NOT_SPLIT;
|
|
23 | 23 |
|
24 | 24 |
import android.content.res.Resources; |
25 | 25 |
|
26 |
import org.distorted.helpers.ObjectShape;
|
|
27 |
import org.distorted.helpers.ObjectSticker;
|
|
28 |
import org.distorted.helpers.ScrambleState;
|
|
26 |
import org.distorted.objectlb.ObjectShape;
|
|
27 |
import org.distorted.objectlb.ObjectSticker;
|
|
28 |
import org.distorted.objectlb.ScrambleState;
|
|
29 | 29 |
import org.distorted.library.main.DistortedEffects; |
30 | 30 |
import org.distorted.library.main.DistortedTexture; |
31 | 31 |
import org.distorted.library.mesh.MeshSquare; |
32 | 32 |
import org.distorted.library.type.Static3D; |
33 | 33 |
import org.distorted.library.type.Static4D; |
34 | 34 |
import org.distorted.main.R; |
35 |
import org.distorted.objectlb.Movement; |
|
36 |
import org.distorted.objectlb.Movement6; |
|
37 |
import org.distorted.objectlb.ObjectList; |
|
38 |
import org.distorted.objectlb.Twisty6; |
|
35 | 39 |
|
36 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
37 | 41 |
|
38 |
class TwistyCube extends Twisty6 |
|
42 |
public class TwistyCube extends Twisty6
|
|
39 | 43 |
{ |
40 | 44 |
static final Static3D[] ROT_AXIS = new Static3D[] |
41 | 45 |
{ |
... | ... | |
59 | 63 |
|
60 | 64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
61 | 65 |
|
62 |
TwistyCube(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh, |
|
63 |
DistortedEffects effects, int[][] moves, Resources res, int scrWidth) |
|
66 |
public TwistyCube(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
|
|
67 |
DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
|
|
64 | 68 |
{ |
65 | 69 |
super(size, size, quat, texture, mesh, effects, moves, ObjectList.CUBE, res, scrWidth); |
66 | 70 |
} |
67 | 71 |
|
68 | 72 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
69 | 73 |
|
70 |
ScrambleState[] getScrambleStates() |
|
74 |
protected ScrambleState[] getScrambleStates()
|
|
71 | 75 |
{ |
72 | 76 |
if( mStates==null ) |
73 | 77 |
{ |
... | ... | |
158 | 162 |
|
159 | 163 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
160 | 164 |
|
161 |
int[] getSolvedQuats(int cubit, int numLayers) |
|
165 |
protected int[] getSolvedQuats(int cubit, int numLayers)
|
|
162 | 166 |
{ |
163 | 167 |
if( mQuats ==null ) initializeQuats(); |
164 | 168 |
int status = retCubitSolvedStatus(cubit,numLayers); |
... | ... | |
167 | 171 |
|
168 | 172 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
169 | 173 |
|
170 |
ObjectShape getObjectShape(int cubit, int numLayers) |
|
174 |
protected ObjectShape getObjectShape(int cubit, int numLayers)
|
|
171 | 175 |
{ |
172 | 176 |
int extraI, extraV, num; |
173 | 177 |
float height; |
... | ... | |
214 | 218 |
|
215 | 219 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
216 | 220 |
|
217 |
Static4D getQuat(int cubit, int numLayers) |
|
221 |
protected Static4D getQuat(int cubit, int numLayers)
|
|
218 | 222 |
{ |
219 | 223 |
if( mQuats ==null ) initializeQuats(); |
220 | 224 |
return mQuats[0]; |
... | ... | |
222 | 226 |
|
223 | 227 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
224 | 228 |
|
225 |
int getNumCubitVariants(int numLayers) |
|
229 |
protected int getNumCubitVariants(int numLayers)
|
|
226 | 230 |
{ |
227 | 231 |
return 1; |
228 | 232 |
} |
229 | 233 |
|
230 | 234 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
231 | 235 |
|
232 |
int getCubitVariant(int cubit, int numLayers) |
|
236 |
protected int getCubitVariant(int cubit, int numLayers)
|
|
233 | 237 |
{ |
234 | 238 |
return 0; |
235 | 239 |
} |
236 | 240 |
|
237 | 241 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
238 | 242 |
|
239 |
ObjectSticker retSticker(int face) |
|
243 |
protected ObjectSticker retSticker(int face)
|
|
240 | 244 |
{ |
241 | 245 |
if( mStickers==null ) |
242 | 246 |
{ |
... | ... | |
253 | 257 |
|
254 | 258 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
255 | 259 |
|
256 |
float[][] getCubitPositions(int numLayers) |
|
260 |
protected float[][] getCubitPositions(int numLayers)
|
|
257 | 261 |
{ |
258 | 262 |
int numCubits = numLayers>1 ? 6*numLayers*numLayers - 12*numLayers + 8 : 1; |
259 | 263 |
float[][] tmp = new float[numCubits][]; |
... | ... | |
274 | 278 |
|
275 | 279 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
276 | 280 |
|
277 |
Static4D[] getQuats() |
|
281 |
protected Static4D[] getQuats()
|
|
278 | 282 |
{ |
279 | 283 |
if( mQuats ==null ) initializeQuats(); |
280 | 284 |
return mQuats; |
... | ... | |
282 | 286 |
|
283 | 287 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
284 | 288 |
|
285 |
float[][] getCuts(int numLayers) |
|
289 |
protected float[][] getCuts(int numLayers)
|
|
286 | 290 |
{ |
287 | 291 |
if( numLayers<2 ) return null; |
288 | 292 |
|
... | ... | |
318 | 322 |
|
319 | 323 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
320 | 324 |
|
321 |
int getSolvedFunctionIndex() |
|
325 |
protected int getSolvedFunctionIndex()
|
|
322 | 326 |
{ |
323 | 327 |
return 0; |
324 | 328 |
} |
325 | 329 |
|
326 | 330 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
327 | 331 |
|
328 |
int getNumStickerTypes(int numLayers) |
|
332 |
protected int getNumStickerTypes(int numLayers)
|
|
329 | 333 |
{ |
330 | 334 |
return 1; |
331 | 335 |
} |
332 | 336 |
|
333 | 337 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
334 | 338 |
|
335 |
int getNumCubitFaces() |
|
339 |
protected int getNumCubitFaces()
|
|
336 | 340 |
{ |
337 | 341 |
return 6; |
338 | 342 |
} |
339 | 343 |
|
340 | 344 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
341 | 345 |
|
342 |
int getFaceColor(int cubit, int cubitface, int numLayers) |
|
346 |
protected int getFaceColor(int cubit, int cubitface, int numLayers)
|
|
343 | 347 |
{ |
344 |
return CUBITS[cubit].mRotationRow[cubitface/2] == (cubitface%2==0 ? (1<<(numLayers-1)):1) ? cubitface : NUM_TEXTURES;
|
|
348 |
return CUBITS[cubit].getRotRow(cubitface/2) == (cubitface%2==0 ? (1<<(numLayers-1)):1) ? cubitface : NUM_TEXTURES;
|
|
345 | 349 |
} |
346 | 350 |
|
347 | 351 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Refactoring: split the 'objects' package into two, 'objects' and 'objectlib'.
The point: we're going to need to move the 'objectlib' stuff into its own library module, and that's because we're going to create a new app module which needs access to it.