Revision 5a4d4fba
Added by Leszek Koltunski almost 4 years ago
src/main/java/org/distorted/states/RubikStateSolving.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
import org.distorted.main.R; |
32 | 32 |
import org.distorted.main.RubikActivity; |
33 |
import org.distorted.main.RubikPostRender;
|
|
33 |
import org.distorted.main.RubikPreRender;
|
|
34 | 34 |
import org.distorted.objects.RubikObject; |
35 | 35 |
import org.distorted.objects.RubikObjectList; |
36 | 36 |
import org.distorted.scores.RubikScores; |
... | ... | |
41 | 41 |
|
42 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
43 | 43 |
|
44 |
public class RubikStateSolving extends RubikStateAbstract implements RubikPostRender.ActionFinishedListener
|
|
44 |
public class RubikStateSolving extends RubikStateAbstract implements RubikPreRender.ActionFinishedListener
|
|
45 | 45 |
{ |
46 | 46 |
private static final int DURATION_MILLIS = 750; |
47 | 47 |
|
... | ... | |
152 | 152 |
@Override |
153 | 153 |
public void onClick(View v) |
154 | 154 |
{ |
155 |
RubikPostRender post = act.getPostRender();
|
|
156 |
backMove(post);
|
|
155 |
RubikPreRender pre = act.getPreRender();
|
|
156 |
backMove(pre);
|
|
157 | 157 |
} |
158 | 158 |
}); |
159 | 159 |
} |
160 | 160 |
|
161 | 161 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
162 | 162 |
|
163 |
private void backMove(RubikPostRender post)
|
|
163 |
private void backMove(RubikPreRender pre)
|
|
164 | 164 |
{ |
165 | 165 |
if( mCanPrevMove ) |
166 | 166 |
{ |
... | ... | |
169 | 169 |
if( numMoves>0 ) |
170 | 170 |
{ |
171 | 171 |
Move move = mMoves.remove(numMoves-1); |
172 |
RubikObject object = post.getObject();
|
|
172 |
RubikObject object = pre.getObject();
|
|
173 | 173 |
|
174 | 174 |
int axis = move.mAxis; |
175 | 175 |
int row = (1<<move.mRow); |
... | ... | |
179 | 179 |
if( angle!=0 ) |
180 | 180 |
{ |
181 | 181 |
mCanPrevMove = false; |
182 |
post.addRotation(this, axis, row, -angle, numRot*DURATION_MILLIS);
|
|
182 |
pre.addRotation(this, axis, row, -angle, numRot*DURATION_MILLIS);
|
|
183 | 183 |
|
184 | 184 |
if( numMoves==1 ) |
185 | 185 |
{ |
Also available in: Unified diff
Convert the PostRender to a PreRender, called before we render.
This makes more sense as this way things are prepared for the very first render.