Revision c7c83fb7
Added by Leszek Koltunski almost 3 years ago
src/main/java/org/distorted/objects/TwistyObject.java | ||
---|---|---|
91 | 91 |
final int NUM_CUBITS; |
92 | 92 |
final int NUM_AXIS; |
93 | 93 |
|
94 |
private static float mInitScreenRatio; |
|
95 |
private static float mObjectScreenRatio = 1.0f; |
|
96 | 94 |
private static final float[] mTmp1 = new float[4]; |
97 | 95 |
private static final float[] mTmp2 = new float[4]; |
98 | 96 |
|
... | ... | |
115 | 113 |
private final float mCameraDist; |
116 | 114 |
private final Static1D mRotationAngleStatic, mRotationAngleMiddle, mRotationAngleFinal; |
117 | 115 |
private final DistortedTexture mTexture; |
116 |
private final float mInitScreenRatio; |
|
117 |
private float mObjectScreenRatio; |
|
118 | 118 |
private int mNumTexRows, mNumTexCols; |
119 | 119 |
private int mRotRowBitmap; |
120 | 120 |
private int mRotAxis; |
... | ... | |
137 | 137 |
mOrigPos = getCubitPositions(mNumLayers); |
138 | 138 |
mAxis = getRotationAxis(); |
139 | 139 |
mInitScreenRatio = getScreenRatio(); |
140 |
mObjectScreenRatio = 1.0f; |
|
140 | 141 |
mNumCubitFaces = getNumCubitFaces(); |
141 | 142 |
|
142 | 143 |
mCuts = getCuts(mNumLayers); |
... | ... | |
298 | 299 |
|
299 | 300 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
300 | 301 |
|
301 |
static float getObjectRatio()
|
|
302 |
public float getObjectRatio()
|
|
302 | 303 |
{ |
303 | 304 |
return mObjectScreenRatio*mInitScreenRatio; |
304 | 305 |
} |
Also available in: Unified diff
TwistyObject's ObejctScreenRatio and InitScreenRatio shouldn't be static. Make them non-static.
Otherwise, if the current object is, say, a cube (initSR=0.5), we fire up tutorials and start a tutorial for something with vastly different ObjectScreenRatio (Jing- initSR=1.64), then come back to the Main Activity - so there's a cube on the screen again - the ratios stay at their Jing values, which screws up detection of rotations.