Revision fb1e9a31
Added by Leszek Koltunski 12 months ago
src/main/java/org/distorted/objectlib/touchcontrol/TouchControl.java | ||
---|---|---|
10 | 10 |
package org.distorted.objectlib.touchcontrol; |
11 | 11 |
|
12 | 12 |
import org.distorted.library.type.Static4D; |
13 |
import org.distorted.objectlib.main.TwistyObject; |
|
13 | 14 |
|
14 | 15 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
15 | 16 |
|
... | ... | |
42 | 43 |
|
43 | 44 |
float mObjectRatio; |
44 | 45 |
|
46 |
private final float[][] mRotationFactor; |
|
47 |
|
|
45 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
46 | 49 |
|
47 |
public TouchControl(float ratio)
|
|
50 |
public TouchControl(TwistyObject object)
|
|
48 | 51 |
{ |
49 |
mObjectRatio = ratio; |
|
52 |
mObjectRatio = (object!=null ? object.getObjectRatio() : 1.0f); |
|
53 |
mRotationFactor = (object!=null ? object.returnRotationFactor() : null); |
|
50 | 54 |
} |
51 | 55 |
|
52 | 56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
130 | 134 |
return minIndex; |
131 | 135 |
} |
132 | 136 |
|
137 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
138 |
|
|
139 |
public float returnRotationFactor(int axis, int row) |
|
140 |
{ |
|
141 |
return mRotationFactor==null ? 1.0f : mRotationFactor[axis][row]; |
|
142 |
} |
|
143 |
|
|
133 | 144 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
134 | 145 |
|
135 | 146 |
public abstract boolean objectTouched(Static4D rotatedTouchPoint, Static4D rotatedCamera); |
... | ... | |
139 | 150 |
public abstract int getTouchedCubitFace(); |
140 | 151 |
public abstract int getTouchedCubit(); |
141 | 152 |
public abstract float[] getTouchedPuzzleCenter(); |
142 |
public abstract float returnRotationFactor(int[] numLayers, int row); |
|
143 | 153 |
} |
Also available in: Unified diff
move the returnRotationFactor() method from touchControl to TwistyObject (where it can be overridden)