Revision eaf46415
Added by Leszek Koltunski about 4 years ago
| src/main/java/org/distorted/helpers/MovesAndLockController.java | ||
|---|---|---|
| 32 | 32 |
import org.distorted.objectlib.helpers.BlockController; |
| 33 | 33 |
import org.distorted.objectlib.helpers.MovesFinished; |
| 34 | 34 |
import org.distorted.objectlib.helpers.TwistyActivity; |
| 35 |
import org.distorted.objectlib.helpers.TwistyPreRender;
|
|
| 35 |
import org.distorted.objectlib.main.ObjectPreRender;
|
|
| 36 | 36 |
|
| 37 | 37 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 38 | 38 |
|
| ... | ... | |
| 55 | 55 |
|
| 56 | 56 |
private final ArrayList<Move> mMoves; |
| 57 | 57 |
private boolean mCanPrevMove; |
| 58 |
private TwistyPreRender mPre;
|
|
| 58 |
private ObjectPreRender mPre;
|
|
| 59 | 59 |
private ImageButton mPrevButton, mLockButton; |
| 60 | 60 |
private long mLockTime; |
| 61 | 61 |
private Timer mTimer; |
| ... | ... | |
| 149 | 149 |
if( angle!=0 ) |
| 150 | 150 |
{
|
| 151 | 151 |
mCanPrevMove = false; |
| 152 |
mPre = act.getTwistyPreRender();
|
|
| 152 |
mPre = act.getPreRender(); |
|
| 153 | 153 |
mPre.blockTouch(BlockController.MOVES_PLACE_0); |
| 154 | 154 |
mPre.addRotation(this, axis, row, -angle, duration); |
| 155 | 155 |
} |
| src/main/java/org/distorted/main/RubikActivity.java | ||
|---|---|---|
| 39 | 39 |
import org.distorted.library.main.DistortedScreen; |
| 40 | 40 |
import org.distorted.library.type.Static4D; |
| 41 | 41 |
|
| 42 |
import org.distorted.objectlib.main.ObjectPreRender; |
|
| 42 | 43 |
import org.distorted.objectlib.main.TwistyObject; |
| 43 | 44 |
import org.distorted.objectlib.main.ObjectType; |
| 44 | 45 |
import org.distorted.objectlib.helpers.BlockController; |
| 45 |
import org.distorted.objectlib.helpers.TwistyPreRender; |
|
| 46 | 46 |
|
| 47 | 47 |
import org.distorted.dialogs.RubikDialogError; |
| 48 | 48 |
import org.distorted.dialogs.RubikDialogPrivacy; |
| ... | ... | |
| 405 | 405 |
public TwistyObject getObject() |
| 406 | 406 |
{
|
| 407 | 407 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
| 408 |
RubikPreRender pre = view.getPreRender();
|
|
| 408 |
ObjectPreRender pre = view.getPreRender();
|
|
| 409 | 409 |
return pre.getObject(); |
| 410 | 410 |
} |
| 411 | 411 |
|
| ... | ... | |
| 420 | 420 |
|
| 421 | 421 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 422 | 422 |
|
| 423 |
public RubikPreRender getPreRender() |
|
| 424 |
{
|
|
| 425 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
|
| 426 |
return view.getPreRender(); |
|
| 427 |
} |
|
| 428 |
|
|
| 429 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 430 |
|
|
| 431 |
public TwistyPreRender getTwistyPreRender() |
|
| 423 |
public ObjectPreRender getPreRender() |
|
| 432 | 424 |
{
|
| 433 | 425 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
| 434 | 426 |
return view.getPreRender(); |
| ... | ... | |
| 460 | 452 |
public void changeObject(ObjectType newObject, boolean reportChange) |
| 461 | 453 |
{
|
| 462 | 454 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
| 463 |
RubikPreRender pre = view.getPreRender();
|
|
| 455 |
ObjectPreRender pre = view.getPreRender();
|
|
| 464 | 456 |
|
| 465 | 457 |
if( reportChange ) |
| 466 | 458 |
{
|
| ... | ... | |
| 518 | 510 |
public void setupObject(ObjectType object, int[][] moves) |
| 519 | 511 |
{
|
| 520 | 512 |
RubikSurfaceView view = findViewById(R.id.rubikSurfaceView); |
| 521 |
RubikPreRender pre = view.getPreRender();
|
|
| 513 |
ObjectPreRender pre = view.getPreRender();
|
|
| 522 | 514 |
pre.setupObject(object,moves); |
| 523 | 515 |
} |
| 524 | 516 |
|
| ... | ... | |
| 612 | 604 |
{
|
| 613 | 605 |
setLock(); |
| 614 | 606 |
|
| 615 |
TwistyPreRender pre = getPreRender();
|
|
| 607 |
ObjectPreRender pre = getPreRender();
|
|
| 616 | 608 |
pre.blockEverything(place); |
| 617 | 609 |
|
| 618 | 610 |
RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass(); |
| ... | ... | |
| 625 | 617 |
{
|
| 626 | 618 |
unsetLock(); |
| 627 | 619 |
|
| 628 |
TwistyPreRender pre = getPreRender();
|
|
| 620 |
ObjectPreRender pre = getPreRender();
|
|
| 629 | 621 |
pre.unblockEverything(); |
| 630 | 622 |
|
| 631 | 623 |
RubikScreenPlay play = (RubikScreenPlay) ScreenList.PLAY.getScreenClass(); |
| src/main/java/org/distorted/main/RubikPreRender.java | ||
|---|---|---|
| 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 2 |
// Copyright 2020 Leszek Koltunski // |
|
| 3 |
// // |
|
| 4 |
// This file is part of Magic Cube. // |
|
| 5 |
// // |
|
| 6 |
// Magic Cube is free software: you can redistribute it and/or modify // |
|
| 7 |
// it under the terms of the GNU General Public License as published by // |
|
| 8 |
// the Free Software Foundation, either version 2 of the License, or // |
|
| 9 |
// (at your option) any later version. // |
|
| 10 |
// // |
|
| 11 |
// Magic Cube is distributed in the hope that it will be useful, // |
|
| 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|
| 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|
| 14 |
// GNU General Public License for more details. // |
|
| 15 |
// // |
|
| 16 |
// You should have received a copy of the GNU General Public License // |
|
| 17 |
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. // |
|
| 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 19 |
|
|
| 20 |
package org.distorted.main; |
|
| 21 |
|
|
| 22 |
import android.content.Context; |
|
| 23 |
import android.content.SharedPreferences; |
|
| 24 |
import android.content.res.Resources; |
|
| 25 |
|
|
| 26 |
import org.distorted.objectlib.helpers.ObjectStateActioner; |
|
| 27 |
import org.distorted.objectlib.main.TwistyObject; |
|
| 28 |
import org.distorted.objectlib.main.ObjectType; |
|
| 29 |
import org.distorted.objectlib.effects.BaseEffect; |
|
| 30 |
import org.distorted.objectlib.effects.EffectController; |
|
| 31 |
import org.distorted.objectlib.effects.scramble.ScrambleEffect; |
|
| 32 |
import org.distorted.objectlib.helpers.BlockController; |
|
| 33 |
import org.distorted.objectlib.helpers.MovesFinished; |
|
| 34 |
import org.distorted.objectlib.helpers.TwistyPreRender; |
|
| 35 |
|
|
| 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 37 |
|
|
| 38 |
public class RubikPreRender implements EffectController, TwistyPreRender |
|
| 39 |
{
|
|
| 40 |
private final RubikSurfaceView mView; |
|
| 41 |
private boolean mFinishRotation, mRemoveRotation, mRemovePatternRotation, mAddRotation, |
|
| 42 |
mSetQuat, mChangeObject, mSetupObject, mSolveObject, mScrambleObject, |
|
| 43 |
mInitializeObject, mSetTextureMap, mResetAllTextureMaps, mSolve; |
|
| 44 |
private boolean mUIBlocked, mTouchBlocked; |
|
| 45 |
private boolean mIsSolved; |
|
| 46 |
private ObjectType mNextObject; |
|
| 47 |
private long mRotationFinishedID; |
|
| 48 |
private final long[] mEffectID; |
|
| 49 |
private int mScreenWidth; |
|
| 50 |
private SharedPreferences mPreferences; |
|
| 51 |
private int[][] mNextMoves; |
|
| 52 |
private TwistyObject mOldObject, mNewObject; |
|
| 53 |
private int mScrambleObjectNum; |
|
| 54 |
private int mAddRotationAxis, mAddRotationRowBitmap, mAddRotationAngle; |
|
| 55 |
private long mAddRotationDuration; |
|
| 56 |
private MovesFinished mAddActionListener; |
|
| 57 |
private long mAddRotationID, mRemoveRotationID; |
|
| 58 |
private int mCubit, mFace, mNewColor; |
|
| 59 |
private int mNearestAngle; |
|
| 60 |
private long mDebugStartTime; |
|
| 61 |
private final BlockController mBlockController; |
|
| 62 |
private final ObjectStateActioner mActioner; |
|
| 63 |
private String mDebug; |
|
| 64 |
|
|
| 65 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 66 |
|
|
| 67 |
RubikPreRender(RubikSurfaceView view, ObjectStateActioner actioner) |
|
| 68 |
{
|
|
| 69 |
mView = view; |
|
| 70 |
mActioner = actioner; |
|
| 71 |
|
|
| 72 |
mFinishRotation = false; |
|
| 73 |
mRemoveRotation = false; |
|
| 74 |
mRemovePatternRotation= false; |
|
| 75 |
mAddRotation = false; |
|
| 76 |
mSetQuat = false; |
|
| 77 |
mChangeObject = false; |
|
| 78 |
mSetupObject = false; |
|
| 79 |
mSolveObject = false; |
|
| 80 |
mSolve = false; |
|
| 81 |
mScrambleObject = false; |
|
| 82 |
|
|
| 83 |
mOldObject = null; |
|
| 84 |
mNewObject = null; |
|
| 85 |
|
|
| 86 |
mDebug = ""; |
|
| 87 |
|
|
| 88 |
mScreenWidth = 0; |
|
| 89 |
mScrambleObjectNum = 0; |
|
| 90 |
|
|
| 91 |
mEffectID = new long[BaseEffect.Type.LENGTH]; |
|
| 92 |
|
|
| 93 |
RubikActivity act = (RubikActivity)mView.getContext(); |
|
| 94 |
mBlockController = new BlockController(act); |
|
| 95 |
unblockEverything(); |
|
| 96 |
} |
|
| 97 |
|
|
| 98 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 99 |
|
|
| 100 |
private void createObjectNow(ObjectType object, int[][] moves) |
|
| 101 |
{
|
|
| 102 |
boolean firstTime = (mNewObject==null); |
|
| 103 |
|
|
| 104 |
if( mOldObject!=null ) mOldObject.releaseResources(); |
|
| 105 |
mOldObject = mNewObject; |
|
| 106 |
|
|
| 107 |
Context con = mView.getContext(); |
|
| 108 |
Resources res = con.getResources(); |
|
| 109 |
|
|
| 110 |
mNewObject = object.create(mView.getQuat(), moves, res, mScreenWidth); |
|
| 111 |
|
|
| 112 |
if( mNewObject!=null ) |
|
| 113 |
{
|
|
| 114 |
mView.setMovement(mNewObject.getMovement()); |
|
| 115 |
if( firstTime ) mNewObject.restorePreferences(mPreferences); |
|
| 116 |
mIsSolved = mNewObject.isSolved(); |
|
| 117 |
} |
|
| 118 |
} |
|
| 119 |
|
|
| 120 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 121 |
// do all 'adjustable' effects (SizeChange, Solve, Scramble) |
|
| 122 |
|
|
| 123 |
private void doEffectNow(BaseEffect.Type type) |
|
| 124 |
{
|
|
| 125 |
try |
|
| 126 |
{
|
|
| 127 |
int index = type.ordinal(); |
|
| 128 |
mEffectID[index] = type.startEffect(mView.getRenderer().getScreen(),this); |
|
| 129 |
} |
|
| 130 |
catch( Exception ex ) |
|
| 131 |
{
|
|
| 132 |
android.util.Log.e("renderer", "exception starting effect: "+ex.getMessage());
|
|
| 133 |
unblockEverything(); |
|
| 134 |
} |
|
| 135 |
} |
|
| 136 |
|
|
| 137 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 138 |
|
|
| 139 |
private void removeRotationNow() |
|
| 140 |
{
|
|
| 141 |
mRemoveRotation=false; |
|
| 142 |
mNewObject.removeRotationNow(); |
|
| 143 |
|
|
| 144 |
boolean solved = mNewObject.isSolved(); |
|
| 145 |
|
|
| 146 |
if( solved && !mIsSolved ) |
|
| 147 |
{
|
|
| 148 |
mActioner.onSolved(); |
|
| 149 |
unblockEverything(); |
|
| 150 |
doEffectNow( BaseEffect.Type.WIN ); |
|
| 151 |
} |
|
| 152 |
else |
|
| 153 |
{
|
|
| 154 |
unblockEverything(); |
|
| 155 |
} |
|
| 156 |
|
|
| 157 |
mIsSolved = solved; |
|
| 158 |
} |
|
| 159 |
|
|
| 160 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 161 |
|
|
| 162 |
private void removeRotation() |
|
| 163 |
{
|
|
| 164 |
mRemoveRotation = true; |
|
| 165 |
} |
|
| 166 |
|
|
| 167 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 168 |
|
|
| 169 |
private void removePatternRotation() |
|
| 170 |
{
|
|
| 171 |
mRemovePatternRotation = true; |
|
| 172 |
} |
|
| 173 |
|
|
| 174 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 175 |
|
|
| 176 |
private void removePatternRotationNow() |
|
| 177 |
{
|
|
| 178 |
mRemovePatternRotation=false; |
|
| 179 |
mNewObject.removeRotationNow(); |
|
| 180 |
mAddActionListener.onActionFinished(mRemoveRotationID); |
|
| 181 |
} |
|
| 182 |
|
|
| 183 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 184 |
|
|
| 185 |
private void addRotationNow() |
|
| 186 |
{
|
|
| 187 |
mAddRotation = false; |
|
| 188 |
mAddRotationID = mNewObject.addNewRotation( mAddRotationAxis, mAddRotationRowBitmap, |
|
| 189 |
mAddRotationAngle, mAddRotationDuration, this); |
|
| 190 |
|
|
| 191 |
if( mAddRotationID==0 ) // failed to add effect - should never happen |
|
| 192 |
{
|
|
| 193 |
unblockEverything(); |
|
| 194 |
} |
|
| 195 |
} |
|
| 196 |
|
|
| 197 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 198 |
|
|
| 199 |
private void finishRotationNow() |
|
| 200 |
{
|
|
| 201 |
mFinishRotation = false; |
|
| 202 |
blockEverything(BlockController.RUBIK_PLACE_0); |
|
| 203 |
mRotationFinishedID = mNewObject.finishRotationNow(this, mNearestAngle); |
|
| 204 |
|
|
| 205 |
if( mRotationFinishedID==0 ) // failed to add effect - should never happen |
|
| 206 |
{
|
|
| 207 |
unblockEverything(); |
|
| 208 |
} |
|
| 209 |
} |
|
| 210 |
|
|
| 211 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 212 |
|
|
| 213 |
private void changeObjectNow() |
|
| 214 |
{
|
|
| 215 |
mChangeObject = false; |
|
| 216 |
|
|
| 217 |
if ( mNewObject==null || mNewObject.getObjectType()!=mNextObject ) |
|
| 218 |
{
|
|
| 219 |
blockEverything(BlockController.RUBIK_PLACE_1); |
|
| 220 |
createObjectNow(mNextObject, null); |
|
| 221 |
doEffectNow( BaseEffect.Type.SIZECHANGE ); |
|
| 222 |
} |
|
| 223 |
} |
|
| 224 |
|
|
| 225 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 226 |
|
|
| 227 |
private void setupObjectNow() |
|
| 228 |
{
|
|
| 229 |
mSetupObject = false; |
|
| 230 |
|
|
| 231 |
if ( mNewObject==null || mNewObject.getObjectType()!=mNextObject) |
|
| 232 |
{
|
|
| 233 |
blockEverything(BlockController.RUBIK_PLACE_2); |
|
| 234 |
createObjectNow(mNextObject, mNextMoves); |
|
| 235 |
doEffectNow( BaseEffect.Type.SIZECHANGE ); |
|
| 236 |
} |
|
| 237 |
else |
|
| 238 |
{
|
|
| 239 |
mNewObject.initializeObject(mNextMoves); |
|
| 240 |
} |
|
| 241 |
} |
|
| 242 |
|
|
| 243 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 244 |
|
|
| 245 |
private void scrambleObjectNow() |
|
| 246 |
{
|
|
| 247 |
mScrambleObject = false; |
|
| 248 |
mIsSolved = false; |
|
| 249 |
blockEverything(BlockController.RUBIK_PLACE_3); |
|
| 250 |
doEffectNow( BaseEffect.Type.SCRAMBLE ); |
|
| 251 |
} |
|
| 252 |
|
|
| 253 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 254 |
|
|
| 255 |
private void solveObjectNow() |
|
| 256 |
{
|
|
| 257 |
mSolveObject = false; |
|
| 258 |
blockEverything(BlockController.RUBIK_PLACE_4); |
|
| 259 |
doEffectNow( BaseEffect.Type.SOLVE ); |
|
| 260 |
} |
|
| 261 |
|
|
| 262 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 263 |
|
|
| 264 |
private void solveNow() |
|
| 265 |
{
|
|
| 266 |
mSolve = false; |
|
| 267 |
mNewObject.solve(); |
|
| 268 |
} |
|
| 269 |
|
|
| 270 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 271 |
|
|
| 272 |
private void initializeObjectNow() |
|
| 273 |
{
|
|
| 274 |
mInitializeObject = false; |
|
| 275 |
mNewObject.initializeObject(mNextMoves); |
|
| 276 |
} |
|
| 277 |
|
|
| 278 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 279 |
|
|
| 280 |
private void setTextureMapNow() |
|
| 281 |
{
|
|
| 282 |
mSetTextureMap = false; |
|
| 283 |
|
|
| 284 |
if( mNewObject!=null ) mNewObject.setTextureMap(mCubit,mFace,mNewColor); |
|
| 285 |
} |
|
| 286 |
|
|
| 287 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 288 |
|
|
| 289 |
private void resetAllTextureMapsNow() |
|
| 290 |
{
|
|
| 291 |
mResetAllTextureMaps = false; |
|
| 292 |
if( mNewObject!=null ) mNewObject.resetAllTextureMaps(); |
|
| 293 |
} |
|
| 294 |
|
|
| 295 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 296 |
|
|
| 297 |
private void setQuatNow() |
|
| 298 |
{
|
|
| 299 |
mSetQuat = false; |
|
| 300 |
mView.setQuat(); |
|
| 301 |
} |
|
| 302 |
|
|
| 303 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 304 |
// |
|
| 305 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 306 |
|
|
| 307 |
void rememberMove(int axis, int row, int angle) |
|
| 308 |
{
|
|
| 309 |
mDebug += (" (m "+axis+" "+(1<<row)+" "+angle+" "+(System.currentTimeMillis()-mDebugStartTime)+")");
|
|
| 310 |
} |
|
| 311 |
|
|
| 312 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 313 |
|
|
| 314 |
void setScreenSize(int width) |
|
| 315 |
{
|
|
| 316 |
if( mNewObject!=null ) |
|
| 317 |
{
|
|
| 318 |
mNewObject.createTexture(); |
|
| 319 |
mNewObject.recomputeScaleFactor(width); |
|
| 320 |
} |
|
| 321 |
mScreenWidth = width; |
|
| 322 |
} |
|
| 323 |
|
|
| 324 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 325 |
|
|
| 326 |
void savePreferences(SharedPreferences.Editor editor) |
|
| 327 |
{
|
|
| 328 |
if( mNewObject!=null ) |
|
| 329 |
{
|
|
| 330 |
mNewObject.savePreferences(editor); |
|
| 331 |
} |
|
| 332 |
} |
|
| 333 |
|
|
| 334 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 335 |
|
|
| 336 |
void restorePreferences(SharedPreferences preferences) |
|
| 337 |
{
|
|
| 338 |
mPreferences = preferences; |
|
| 339 |
} |
|
| 340 |
|
|
| 341 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 342 |
|
|
| 343 |
void finishRotation(int nearestAngle) |
|
| 344 |
{
|
|
| 345 |
mNearestAngle = nearestAngle; |
|
| 346 |
mFinishRotation = true; |
|
| 347 |
} |
|
| 348 |
|
|
| 349 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 350 |
|
|
| 351 |
void changeObject(ObjectType object) |
|
| 352 |
{
|
|
| 353 |
mChangeObject = true; |
|
| 354 |
mNextObject = object; |
|
| 355 |
} |
|
| 356 |
|
|
| 357 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 358 |
|
|
| 359 |
void setupObject(ObjectType object, int[][] moves) |
|
| 360 |
{
|
|
| 361 |
mSetupObject= true; |
|
| 362 |
mNextObject = object; |
|
| 363 |
mNextMoves = moves; |
|
| 364 |
} |
|
| 365 |
|
|
| 366 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 367 |
|
|
| 368 |
void setTextureMap(int cubit, int face, int newColor) |
|
| 369 |
{
|
|
| 370 |
mSetTextureMap = true; |
|
| 371 |
|
|
| 372 |
mCubit = cubit; |
|
| 373 |
mFace = face; |
|
| 374 |
mNewColor = newColor; |
|
| 375 |
} |
|
| 376 |
|
|
| 377 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 378 |
|
|
| 379 |
public boolean isTouchBlocked() |
|
| 380 |
{
|
|
| 381 |
return mTouchBlocked; |
|
| 382 |
} |
|
| 383 |
|
|
| 384 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 385 |
|
|
| 386 |
public boolean isUINotBlocked() |
|
| 387 |
{
|
|
| 388 |
return !mUIBlocked; |
|
| 389 |
} |
|
| 390 |
|
|
| 391 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 392 |
|
|
| 393 |
public void blockEverything(int place) |
|
| 394 |
{
|
|
| 395 |
mUIBlocked = true; |
|
| 396 |
mTouchBlocked= true; |
|
| 397 |
mBlockController.touchBlocked(place); |
|
| 398 |
mBlockController.uiBlocked(place); |
|
| 399 |
} |
|
| 400 |
|
|
| 401 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 402 |
|
|
| 403 |
public void blockTouch(int place) |
|
| 404 |
{
|
|
| 405 |
mTouchBlocked= true; |
|
| 406 |
mBlockController.touchBlocked(place); |
|
| 407 |
} |
|
| 408 |
|
|
| 409 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 410 |
|
|
| 411 |
public void unblockEverything() |
|
| 412 |
{
|
|
| 413 |
mUIBlocked = false; |
|
| 414 |
mTouchBlocked= false; |
|
| 415 |
mBlockController.touchUnblocked(); |
|
| 416 |
mBlockController.uiUnblocked(); |
|
| 417 |
} |
|
| 418 |
|
|
| 419 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 420 |
|
|
| 421 |
public void unblockTouch() |
|
| 422 |
{
|
|
| 423 |
mTouchBlocked= false; |
|
| 424 |
mBlockController.touchUnblocked(); |
|
| 425 |
} |
|
| 426 |
|
|
| 427 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 428 |
|
|
| 429 |
public void unblockUI() |
|
| 430 |
{
|
|
| 431 |
mUIBlocked= false; |
|
| 432 |
mBlockController.uiUnblocked(); |
|
| 433 |
} |
|
| 434 |
|
|
| 435 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 436 |
|
|
| 437 |
void setQuatOnNextRender() |
|
| 438 |
{
|
|
| 439 |
mSetQuat = true; |
|
| 440 |
} |
|
| 441 |
|
|
| 442 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 443 |
|
|
| 444 |
void preRender() |
|
| 445 |
{
|
|
| 446 |
if( mSolve ) solveNow(); |
|
| 447 |
if( mSetQuat ) setQuatNow(); |
|
| 448 |
if( mFinishRotation ) finishRotationNow(); |
|
| 449 |
if( mRemoveRotation ) removeRotationNow(); |
|
| 450 |
if( mRemovePatternRotation ) removePatternRotationNow(); |
|
| 451 |
if( mChangeObject ) changeObjectNow(); |
|
| 452 |
if( mSetupObject ) setupObjectNow(); |
|
| 453 |
if( mSolveObject ) solveObjectNow(); |
|
| 454 |
if( mScrambleObject ) scrambleObjectNow(); |
|
| 455 |
if( mAddRotation ) addRotationNow(); |
|
| 456 |
if( mInitializeObject ) initializeObjectNow(); |
|
| 457 |
if( mResetAllTextureMaps ) resetAllTextureMapsNow(); |
|
| 458 |
if( mSetTextureMap ) setTextureMapNow(); |
|
| 459 |
} |
|
| 460 |
|
|
| 461 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 462 |
// PUBLIC API |
|
| 463 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 464 |
|
|
| 465 |
public void addRotation(MovesFinished listener, int axis, int rowBitmap, int angle, long duration) |
|
| 466 |
{
|
|
| 467 |
mAddRotation = true; |
|
| 468 |
|
|
| 469 |
mAddActionListener = listener; |
|
| 470 |
mAddRotationAxis = axis; |
|
| 471 |
mAddRotationRowBitmap = rowBitmap; |
|
| 472 |
mAddRotationAngle = angle; |
|
| 473 |
mAddRotationDuration = duration; |
|
| 474 |
|
|
| 475 |
if( listener instanceof ScrambleEffect ) |
|
| 476 |
{
|
|
| 477 |
mDebug += (" (a "+axis+" "+rowBitmap+" "+angle+" "+(System.currentTimeMillis()-mDebugStartTime)+")");
|
|
| 478 |
} |
|
| 479 |
} |
|
| 480 |
|
|
| 481 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 482 |
|
|
| 483 |
public void initializeObject(int[][] moves) |
|
| 484 |
{
|
|
| 485 |
mInitializeObject = true; |
|
| 486 |
mNextMoves = moves; |
|
| 487 |
} |
|
| 488 |
|
|
| 489 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 490 |
|
|
| 491 |
public void scrambleObject(int num) |
|
| 492 |
{
|
|
| 493 |
if( !mUIBlocked ) |
|
| 494 |
{
|
|
| 495 |
mScrambleObject = true; |
|
| 496 |
mScrambleObjectNum = num; |
|
| 497 |
mDebug = ""; |
|
| 498 |
mDebugStartTime = System.currentTimeMillis(); |
|
| 499 |
} |
|
| 500 |
} |
|
| 501 |
|
|
| 502 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 503 |
// this starts the Solve Effect |
|
| 504 |
|
|
| 505 |
public void solveObject() |
|
| 506 |
{
|
|
| 507 |
if( !mUIBlocked ) |
|
| 508 |
{
|
|
| 509 |
mSolveObject = true; |
|
| 510 |
} |
|
| 511 |
} |
|
| 512 |
|
|
| 513 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 514 |
// this only sets the cubits state to solved |
|
| 515 |
|
|
| 516 |
public void solve() |
|
| 517 |
{
|
|
| 518 |
mSolve = true; |
|
| 519 |
} |
|
| 520 |
|
|
| 521 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 522 |
|
|
| 523 |
public void resetAllTextureMaps() |
|
| 524 |
{
|
|
| 525 |
mResetAllTextureMaps = true; |
|
| 526 |
} |
|
| 527 |
|
|
| 528 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 529 |
|
|
| 530 |
public TwistyObject getObject() |
|
| 531 |
{
|
|
| 532 |
return mNewObject; |
|
| 533 |
} |
|
| 534 |
|
|
| 535 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 536 |
|
|
| 537 |
public TwistyObject getOldObject() |
|
| 538 |
{
|
|
| 539 |
return mOldObject; |
|
| 540 |
} |
|
| 541 |
|
|
| 542 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 543 |
|
|
| 544 |
public int getNumScrambles() |
|
| 545 |
{
|
|
| 546 |
return mScrambleObjectNum; |
|
| 547 |
} |
|
| 548 |
|
|
| 549 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 550 |
|
|
| 551 |
public void effectFinished(final long effectID) |
|
| 552 |
{
|
|
| 553 |
if( effectID == mRotationFinishedID ) |
|
| 554 |
{
|
|
| 555 |
mRotationFinishedID = 0; |
|
| 556 |
removeRotation(); |
|
| 557 |
} |
|
| 558 |
else if( effectID == mAddRotationID ) |
|
| 559 |
{
|
|
| 560 |
mAddRotationID = 0; |
|
| 561 |
mRemoveRotationID = effectID; |
|
| 562 |
removePatternRotation(); |
|
| 563 |
} |
|
| 564 |
else |
|
| 565 |
{
|
|
| 566 |
for(int i=0; i<BaseEffect.Type.LENGTH; i++) |
|
| 567 |
{
|
|
| 568 |
if( effectID == mEffectID[i] ) |
|
| 569 |
{
|
|
| 570 |
if( i!=BaseEffect.Type.WIN.ordinal() ) |
|
| 571 |
{
|
|
| 572 |
unblockEverything(); |
|
| 573 |
} |
|
| 574 |
|
|
| 575 |
if( i==BaseEffect.Type.SCRAMBLE.ordinal() ) |
|
| 576 |
{
|
|
| 577 |
RubikActivity act = (RubikActivity)mView.getContext(); |
|
| 578 |
mActioner.onScrambleEffectFinished(act); |
|
| 579 |
} |
|
| 580 |
|
|
| 581 |
if( i==BaseEffect.Type.WIN.ordinal() ) |
|
| 582 |
{
|
|
| 583 |
RubikActivity act = (RubikActivity)mView.getContext(); |
|
| 584 |
mActioner.onWinEffectFinished(act,mDebug,mScrambleObjectNum); |
|
| 585 |
} |
|
| 586 |
|
|
| 587 |
break; |
|
| 588 |
} |
|
| 589 |
} |
|
| 590 |
} |
|
| 591 |
} |
|
| 592 |
} |
|
| src/main/java/org/distorted/main/RubikSurfaceView.java | ||
|---|---|---|
| 30 | 30 |
|
| 31 | 31 |
import com.google.firebase.crashlytics.FirebaseCrashlytics; |
| 32 | 32 |
|
| 33 |
import org.distorted.library.main.DistortedScreen; |
|
| 33 | 34 |
import org.distorted.library.type.Static2D; |
| 34 | 35 |
import org.distorted.library.type.Static4D; |
| 35 | 36 |
import org.distorted.library.main.QuatHelper; |
| 36 | 37 |
|
| 38 |
import org.distorted.objectlib.helpers.ObjectSurfaceView; |
|
| 39 |
import org.distorted.objectlib.helpers.TwistyActivity; |
|
| 40 |
import org.distorted.objectlib.main.ObjectPreRender; |
|
| 37 | 41 |
import org.distorted.objectlib.main.TwistyObject; |
| 38 | 42 |
import org.distorted.objectlib.main.Movement; |
| 39 | 43 |
|
| ... | ... | |
| 46 | 50 |
|
| 47 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 48 | 52 |
|
| 49 |
public class RubikSurfaceView extends GLSurfaceView |
|
| 53 |
public class RubikSurfaceView extends GLSurfaceView implements ObjectSurfaceView
|
|
| 50 | 54 |
{
|
| 51 | 55 |
public static final int NUM_SPEED_PROBES = 10; |
| 52 | 56 |
public static final int INVALID_POINTER_ID = -1; |
| ... | ... | |
| 64 | 68 |
private final Static4D CAMERA_POINT = new Static4D(0, 0, 0, 0); |
| 65 | 69 |
|
| 66 | 70 |
private RubikRenderer mRenderer; |
| 67 |
private RubikPreRender mPreRender; |
|
| 68 |
private RubikObjectStateActioner mActioner; |
|
| 71 |
private ObjectPreRender mPreRender; |
|
| 69 | 72 |
private Movement mMovement; |
| 70 | 73 |
private boolean mDragging, mBeginningRotation, mContinuingRotation; |
| 71 | 74 |
private int mScreenWidth, mScreenHeight, mScreenMin; |
| ... | ... | |
| 116 | 119 |
|
| 117 | 120 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 118 | 121 |
|
| 119 |
RubikPreRender getPreRender()
|
|
| 122 |
ObjectPreRender getPreRender()
|
|
| 120 | 123 |
{
|
| 121 | 124 |
return mPreRender; |
| 122 | 125 |
} |
| 123 | 126 |
|
| 124 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 125 |
|
|
| 126 |
void setQuat() |
|
| 127 |
{
|
|
| 128 |
mQuat.set(mTemp); |
|
| 129 |
} |
|
| 130 |
|
|
| 131 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 132 |
|
|
| 133 |
Static4D getQuat() |
|
| 134 |
{
|
|
| 135 |
return mQuat; |
|
| 136 |
} |
|
| 137 |
|
|
| 138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 139 |
|
|
| 140 |
void setMovement(Movement movement) |
|
| 141 |
{
|
|
| 142 |
mMovement = movement; |
|
| 143 |
} |
|
| 144 |
|
|
| 145 | 127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 146 | 128 |
// cast the 3D axis we are currently rotating along (which is already casted to the surface of the |
| 147 | 129 |
// currently touched face AND converted into a 4D vector - fourth 0) to a 2D in-screen-surface axis |
| ... | ... | |
| 237 | 219 |
Static4D rotatedTouchPoint= QuatHelper.rotateVectorByInvertedQuat(touchPoint, mQuat); |
| 238 | 220 |
Static4D rotatedCamera= QuatHelper.rotateVectorByInvertedQuat(CAMERA_POINT, mQuat); |
| 239 | 221 |
|
| 240 |
if( mMovement!=null && mMovement.faceTouched(rotatedTouchPoint,rotatedCamera,object.getObjectRatio() ) ) |
|
| 222 |
if( object!=null && mMovement!=null && mMovement.faceTouched(rotatedTouchPoint,rotatedCamera,object.getObjectRatio() ) )
|
|
| 241 | 223 |
{
|
| 242 | 224 |
mDragging = false; |
| 243 | 225 |
mContinuingRotation = false; |
| ... | ... | |
| 535 | 517 |
mFirstIndex =0; |
| 536 | 518 |
mLastIndex =0; |
| 537 | 519 |
|
| 538 |
mActioner = new RubikObjectStateActioner(); |
|
| 539 | 520 |
mRenderer = new RubikRenderer(this); |
| 540 |
mPreRender = new RubikPreRender(this,mActioner);
|
|
| 521 |
mPreRender = new ObjectPreRender(this,new RubikObjectStateActioner());
|
|
| 541 | 522 |
|
| 542 | 523 |
RubikActivity act = (RubikActivity)context; |
| 543 | 524 |
DisplayMetrics dm = new DisplayMetrics(); |
| ... | ... | |
| 573 | 554 |
} |
| 574 | 555 |
} |
| 575 | 556 |
|
| 557 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 558 |
|
|
| 559 |
public void setQuat() |
|
| 560 |
{
|
|
| 561 |
mQuat.set(mTemp); |
|
| 562 |
} |
|
| 563 |
|
|
| 564 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 565 |
|
|
| 566 |
public Static4D getQuat() |
|
| 567 |
{
|
|
| 568 |
return mQuat; |
|
| 569 |
} |
|
| 570 |
|
|
| 571 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 572 |
|
|
| 573 |
public void setMovement(Movement movement) |
|
| 574 |
{
|
|
| 575 |
mMovement = movement; |
|
| 576 |
} |
|
| 577 |
|
|
| 578 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 579 |
|
|
| 580 |
public TwistyActivity getActivity() |
|
| 581 |
{
|
|
| 582 |
return (TwistyActivity)getContext(); |
|
| 583 |
} |
|
| 584 |
|
|
| 585 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 586 |
|
|
| 587 |
public DistortedScreen getScreen() |
|
| 588 |
{
|
|
| 589 |
return mRenderer.getScreen(); |
|
| 590 |
} |
|
| 591 |
|
|
| 576 | 592 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 577 | 593 |
|
| 578 | 594 |
public void prepareDown() |
| src/main/java/org/distorted/patterns/RubikPattern.java | ||
|---|---|---|
| 23 | 23 |
import java.util.List; |
| 24 | 24 |
|
| 25 | 25 |
import org.distorted.objectlib.helpers.MovesFinished; |
| 26 |
import org.distorted.main.RubikPreRender;
|
|
| 26 |
import org.distorted.objectlib.main.ObjectPreRender;
|
|
| 27 | 27 |
|
| 28 | 28 |
import static org.distorted.patterns.RubikPatternList.NUM_OBJECTS; |
| 29 | 29 |
|
| ... | ... | |
| 151 | 151 |
|
| 152 | 152 |
///////////////////////////////////////////////////////////// |
| 153 | 153 |
|
| 154 |
void makeMove(RubikPreRender pre, int pattern)
|
|
| 154 |
void makeMove(ObjectPreRender pre, int pattern)
|
|
| 155 | 155 |
{
|
| 156 | 156 |
if( !mInitialized ) initialize(); |
| 157 | 157 |
|
| ... | ... | |
| 164 | 164 |
|
| 165 | 165 |
///////////////////////////////////////////////////////////// |
| 166 | 166 |
|
| 167 |
void backMove(RubikPreRender pre, int pattern)
|
|
| 167 |
void backMove(ObjectPreRender pre, int pattern)
|
|
| 168 | 168 |
{
|
| 169 | 169 |
if( !mInitialized ) initialize(); |
| 170 | 170 |
|
| ... | ... | |
| 317 | 317 |
|
| 318 | 318 |
///////////////////////////////////////////////////////////// |
| 319 | 319 |
|
| 320 |
void makeMove(RubikPreRender pre)
|
|
| 320 |
void makeMove(ObjectPreRender pre)
|
|
| 321 | 321 |
{
|
| 322 | 322 |
if( !mInitialized ) initialize(); |
| 323 | 323 |
|
| ... | ... | |
| 358 | 358 |
|
| 359 | 359 |
///////////////////////////////////////////////////////////// |
| 360 | 360 |
|
| 361 |
void backMove(RubikPreRender pre)
|
|
| 361 |
void backMove(ObjectPreRender pre)
|
|
| 362 | 362 |
{
|
| 363 | 363 |
if( !mInitialized ) initialize(); |
| 364 | 364 |
|
| ... | ... | |
| 576 | 576 |
|
| 577 | 577 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 578 | 578 |
|
| 579 |
public void makeMove(RubikPreRender pre, int tab, int cat, int pat)
|
|
| 579 |
public void makeMove(ObjectPreRender pre, int tab, int cat, int pat)
|
|
| 580 | 580 |
{
|
| 581 | 581 |
Category c = getCategory(tab,cat); |
| 582 | 582 |
if( c!=null ) c.makeMove(pre,pat); |
| ... | ... | |
| 584 | 584 |
|
| 585 | 585 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 586 | 586 |
|
| 587 |
public void backMove(RubikPreRender pre, int tab, int cat, int pat)
|
|
| 587 |
public void backMove(ObjectPreRender pre, int tab, int cat, int pat)
|
|
| 588 | 588 |
{
|
| 589 | 589 |
Category c = getCategory(tab,cat); |
| 590 | 590 |
if( c!=null ) c.backMove(pre,pat); |
| src/main/java/org/distorted/screens/RubikScreenPattern.java | ||
|---|---|---|
| 36 | 36 |
import org.distorted.dialogs.RubikDialogPattern; |
| 37 | 37 |
import org.distorted.helpers.TransparentImageButton; |
| 38 | 38 |
import org.distorted.main.RubikActivity; |
| 39 |
import org.distorted.main.RubikPreRender;
|
|
| 39 |
import org.distorted.objectlib.main.ObjectPreRender;
|
|
| 40 | 40 |
import org.distorted.patterns.RubikPattern; |
| 41 | 41 |
import org.distorted.patterns.RubikPatternList; |
| 42 | 42 |
|
| ... | ... | |
| 179 | 179 |
public void onClick(View v) |
| 180 | 180 |
{
|
| 181 | 181 |
RubikPattern pattern = RubikPattern.getInstance(); |
| 182 |
RubikPreRender pre = act.getPreRender();
|
|
| 182 |
ObjectPreRender pre = act.getPreRender();
|
|
| 183 | 183 |
pattern.backMove( pre, mPatternOrdinal, mCategory, mPattern); |
| 184 | 184 |
int currMove = pattern.getCurMove(mPatternOrdinal, mCategory, mPattern); |
| 185 | 185 |
mMovesText.setText(act.getString(R.string.mo_placeholder,currMove,mNumMoves)); |
| ... | ... | |
| 200 | 200 |
public void onClick(View v) |
| 201 | 201 |
{
|
| 202 | 202 |
RubikPattern pattern = RubikPattern.getInstance(); |
| 203 |
RubikPreRender pre = act.getPreRender();
|
|
| 203 |
ObjectPreRender pre = act.getPreRender();
|
|
| 204 | 204 |
pattern.makeMove( pre, mPatternOrdinal, mCategory, mPattern); |
| 205 | 205 |
int currMove = pattern.getCurMove(mPatternOrdinal, mCategory, mPattern); |
| 206 | 206 |
mMovesText.setText(act.getString(R.string.mo_placeholder,currMove,mNumMoves)); |
| src/main/java/org/distorted/screens/RubikScreenPlay.java | ||
|---|---|---|
| 39 | 39 |
|
| 40 | 40 |
import org.distorted.main.R; |
| 41 | 41 |
import org.distorted.main.RubikActivity; |
| 42 |
import org.distorted.main.RubikPreRender;
|
|
| 42 |
import org.distorted.objectlib.main.ObjectPreRender;
|
|
| 43 | 43 |
import org.distorted.dialogs.RubikDialogAbout; |
| 44 | 44 |
import org.distorted.dialogs.RubikDialogPattern; |
| 45 | 45 |
import org.distorted.dialogs.RubikDialogScores; |
| ... | ... | |
| 550 | 550 |
@Override |
| 551 | 551 |
public void onClick(View v) |
| 552 | 552 |
{
|
| 553 |
RubikPreRender pre = act.getPreRender();
|
|
| 553 |
ObjectPreRender pre = act.getPreRender();
|
|
| 554 | 554 |
|
| 555 | 555 |
if(pre.isUINotBlocked()) |
| 556 | 556 |
{
|
| src/main/java/org/distorted/screens/RubikScreenSolution.java | ||
|---|---|---|
| 34 | 34 |
import org.distorted.helpers.TransparentImageButton; |
| 35 | 35 |
import org.distorted.main.R; |
| 36 | 36 |
import org.distorted.main.RubikActivity; |
| 37 |
import org.distorted.main.RubikPreRender;
|
|
| 37 |
import org.distorted.objectlib.main.ObjectPreRender;
|
|
| 38 | 38 |
import org.distorted.patterns.RubikPattern; |
| 39 | 39 |
|
| 40 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 121 | 121 |
@Override |
| 122 | 122 |
public void onClick(View v) |
| 123 | 123 |
{
|
| 124 |
RubikPreRender pre = act.getPreRender();
|
|
| 124 |
ObjectPreRender pre = act.getPreRender();
|
|
| 125 | 125 |
backMove(pre); |
| 126 | 126 |
mMovesText.setText(act.getString(R.string.mo_placeholder,mCurrMove,mNumMoves)); |
| 127 | 127 |
} |
| ... | ... | |
| 140 | 140 |
@Override |
| 141 | 141 |
public void onClick(View v) |
| 142 | 142 |
{
|
| 143 |
RubikPreRender pre = act.getPreRender();
|
|
| 143 |
ObjectPreRender pre = act.getPreRender();
|
|
| 144 | 144 |
makeMove(pre); |
| 145 | 145 |
mMovesText.setText(act.getString(R.string.mo_placeholder,mCurrMove,mNumMoves)); |
| 146 | 146 |
} |
| ... | ... | |
| 187 | 187 |
|
| 188 | 188 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 189 | 189 |
|
| 190 |
private void makeMove(RubikPreRender pre)
|
|
| 190 |
private void makeMove(ObjectPreRender pre)
|
|
| 191 | 191 |
{
|
| 192 | 192 |
if( mCanRotate ) |
| 193 | 193 |
{
|
| ... | ... | |
| 226 | 226 |
|
| 227 | 227 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 228 | 228 |
|
| 229 |
private void backMove(RubikPreRender pre)
|
|
| 229 |
private void backMove(ObjectPreRender pre)
|
|
| 230 | 230 |
{
|
| 231 | 231 |
if( mCanRotate ) |
| 232 | 232 |
{
|
| src/main/java/org/distorted/screens/RubikScreenSolver.java | ||
|---|---|---|
| 40 | 40 |
import org.distorted.helpers.TransparentImageButton; |
| 41 | 41 |
import org.distorted.main.R; |
| 42 | 42 |
import org.distorted.main.RubikActivity; |
| 43 |
import org.distorted.main.RubikPreRender;
|
|
| 43 |
import org.distorted.objectlib.main.ObjectPreRender;
|
|
| 44 | 44 |
import org.distorted.solvers.ImplementedSolversList; |
| 45 | 45 |
import org.distorted.solvers.SolverMain; |
| 46 | 46 |
|
| ... | ... | |
| 237 | 237 |
@Override |
| 238 | 238 |
public void onClick(View v) |
| 239 | 239 |
{
|
| 240 |
RubikPreRender pre = act.getPreRender();
|
|
| 240 |
ObjectPreRender pre = act.getPreRender();
|
|
| 241 | 241 |
pre.resetAllTextureMaps(); |
| 242 | 242 |
ScreenList.goBack(act); |
| 243 | 243 |
} |
| src/main/java/org/distorted/tutorials/TutorialActivity.java | ||
|---|---|---|
| 19 | 19 |
|
| 20 | 20 |
package org.distorted.tutorials; |
| 21 | 21 |
|
| 22 |
import android.content.SharedPreferences; |
|
| 22 | 23 |
import android.os.Build; |
| 23 | 24 |
import android.os.Bundle; |
| 25 |
import android.preference.PreferenceManager; |
|
| 24 | 26 |
import android.util.DisplayMetrics; |
| 25 | 27 |
import android.view.View; |
| 26 | 28 |
import android.view.ViewGroup; |
| ... | ... | |
| 32 | 34 |
|
| 33 | 35 |
import org.distorted.library.main.DistortedLibrary; |
| 34 | 36 |
|
| 37 |
import org.distorted.main.RubikSurfaceView; |
|
| 38 |
import org.distorted.network.RubikScores; |
|
| 39 |
import org.distorted.objectlib.effects.BaseEffect; |
|
| 40 |
import org.distorted.objectlib.main.ObjectPreRender; |
|
| 35 | 41 |
import org.distorted.objectlib.main.ObjectType; |
| 36 | 42 |
import org.distorted.objectlib.main.TwistyObject; |
| 37 |
|
|
| 38 |
import org.distorted.dialogs.RubikDialogError; |
|
| 39 | 43 |
import org.distorted.objectlib.helpers.BlockController; |
| 40 | 44 |
import org.distorted.objectlib.helpers.TwistyActivity; |
| 41 |
import org.distorted.objectlib.helpers.TwistyPreRender; |
|
| 45 |
|
|
| 42 | 46 |
import org.distorted.main.R; |
| 47 |
import org.distorted.dialogs.RubikDialogError; |
|
| 43 | 48 |
import org.distorted.screens.ScreenList; |
| 44 | 49 |
|
| 45 | 50 |
import static org.distorted.main.RubikRenderer.BRIGHTNESS; |
| ... | ... | |
| 205 | 210 |
TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView); |
| 206 | 211 |
view.onResume(); |
| 207 | 212 |
view.initialize(); |
| 213 |
restorePreferences(); |
|
| 208 | 214 |
|
| 209 | 215 |
if( mWebView!=null ) mWebView.onResume(); |
| 210 | 216 |
|
| ... | ... | |
| 224 | 230 |
DistortedLibrary.onDestroy(1); |
| 225 | 231 |
} |
| 226 | 232 |
|
| 233 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 234 |
|
|
| 235 |
private void restorePreferences() |
|
| 236 |
{
|
|
| 237 |
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); |
|
| 238 |
TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView); |
|
| 239 |
view.getPreRender().restorePreferences(preferences); |
|
| 240 |
} |
|
| 241 |
|
|
| 227 | 242 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 228 | 243 |
|
| 229 | 244 |
void OpenGLError() |
| ... | ... | |
| 253 | 268 |
public TwistyObject getObject() |
| 254 | 269 |
{
|
| 255 | 270 |
TutorialSurfaceView view = findViewById(R.id.rubikSurfaceView); |
| 256 |
TutorialPreRender pre = view.getPreRender();
|
|
| 271 |
ObjectPreRender pre = view.getPreRender();
|
|
| 257 | 272 |
return pre.getObject(); |
| 258 | 273 |
} |
| 259 | 274 |
|
| ... | ... | |
| 273 | 288 |
|
| 274 | 289 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 275 | 290 |
|
| 276 |
public TutorialPreRender getPreRender() |
|
| 277 |
{
|
|
| 278 |
TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView); |
|
| 279 |
return view.getPreRender(); |
|
| 280 |
} |
|
| 281 |
|
|
| 282 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 283 |
|
|
| 284 |
public TwistyPreRender getTwistyPreRender() |
|
| 291 |
public ObjectPreRender getPreRender() |
|
| 285 | 292 |
{
|
| 286 | 293 |
TutorialSurfaceView view = findViewById(R.id.tutorialSurfaceView); |
| 287 | 294 |
return view.getPreRender(); |
| src/main/java/org/distorted/tutorials/TutorialPreRender.java | ||
|---|---|---|
| 1 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 2 |
// Copyright 2020 Leszek Koltunski // |
|
| 3 |
// // |
|
| 4 |
// This file is part of Magic Cube. // |
|
| 5 |
// // |
|
| 6 |
// Magic Cube is free software: you can redistribute it and/or modify // |
|
| 7 |
// it under the terms of the GNU General Public License as published by // |
|
| 8 |
// the Free Software Foundation, either version 2 of the License, or // |
|
| 9 |
// (at your option) any later version. // |
|
| 10 |
// // |
|
| 11 |
// Magic Cube is distributed in the hope that it will be useful, // |
|
| 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|
| 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|
| 14 |
// GNU General Public License for more details. // |
|
| 15 |
// // |
|
| 16 |
// You should have received a copy of the GNU General Public License // |
|
| 17 |
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. // |
|
| 18 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 19 |
|
|
| 20 |
package org.distorted.tutorials; |
|
| 21 |
|
|
| 22 |
import android.content.Context; |
|
| 23 |
import android.content.res.Resources; |
|
| 24 |
|
|
| 25 |
import org.distorted.objectlib.helpers.ObjectStateActioner; |
|
| 26 |
import org.distorted.objectlib.main.ObjectType; |
|
| 27 |
import org.distorted.objectlib.main.TwistyObject; |
|
| 28 |
import org.distorted.objectlib.helpers.BlockController; |
|
| 29 |
import org.distorted.objectlib.helpers.MovesFinished; |
|
| 30 |
import org.distorted.objectlib.helpers.TwistyPreRender; |
|
| 31 |
import org.distorted.objectlib.effects.BaseEffect; |
|
| 32 |
import org.distorted.objectlib.effects.EffectController; |
|
| 33 |
|
|
| 34 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 35 |
|
|
| 36 |
public class TutorialPreRender implements EffectController, TwistyPreRender |
|
| 37 |
{
|
|
| 38 |
private MovesFinished mAddActionListener; |
|
| 39 |
private final TutorialSurfaceView mView; |
|
| 40 |
private boolean mFinishRotation, mRemoveRotation, mAddRotation, |
|
| 41 |
mSetQuat, mChangeObject, mSetupObject, mSolveObject, mScrambleObject, |
|
| 42 |
mInitializeObject, mRemovePatternRotation, mSolve; |
|
| 43 |
private boolean mUIBlocked, mTouchBlocked; |
|
| 44 |
private boolean mIsSolved; |
|
| 45 |
private ObjectType mNextObject; |
|
| 46 |
private long mRotationFinishedID; |
|
| 47 |
private int mScreenWidth; |
|
| 48 |
private TwistyObject mOldObject, mNewObject; |
|
| 49 |
private int mAddRotationAxis, mAddRotationRowBitmap, mAddRotationAngle; |
|
| 50 |
private long mAddRotationDuration; |
|
| 51 |
private long mAddRotationID, mRemoveRotationID; |
|
| 52 |
private int mNearestAngle; |
|
| 53 |
private int mScrambleObjectNum; |
|
| 54 |
private final BlockController mBlockController; |
|
| 55 |
private final ObjectStateActioner mActioner; |
|
| 56 |
|
|
| 57 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 58 |
|
|
| 59 |
TutorialPreRender(TutorialSurfaceView view, ObjectStateActioner actioner) |
|
| 60 |
{
|
|
| 61 |
mView = view; |
|
| 62 |
mActioner = actioner; |
|
| 63 |
|
|
| 64 |
mFinishRotation = false; |
|
| 65 |
mRemoveRotation = false; |
|
| 66 |
mAddRotation = false; |
|
| 67 |
mSetQuat = false; |
|
| 68 |
mChangeObject = false; |
|
| 69 |
mSetupObject = false; |
|
| 70 |
mSolveObject = false; |
|
| 71 |
mSolve = false; |
|
| 72 |
mScrambleObject = false; |
|
| 73 |
|
|
| 74 |
mOldObject = null; |
|
| 75 |
mNewObject = null; |
|
| 76 |
|
|
| 77 |
mScreenWidth = 0; |
|
| 78 |
mScrambleObjectNum = 0; |
|
| 79 |
|
|
| 80 |
mRemovePatternRotation= false; |
|
| 81 |
|
|
| 82 |
TutorialActivity act = (TutorialActivity)mView.getContext(); |
|
| 83 |
mBlockController = new BlockController(act); |
|
| 84 |
unblockEverything(); |
|
| 85 |
} |
|
| 86 |
|
|
| 87 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 88 |
|
|
| 89 |
private void createObjectNow(ObjectType object) |
|
| 90 |
{
|
|
| 91 |
if( mOldObject!=null ) mOldObject.releaseResources(); |
|
| 92 |
mOldObject = mNewObject; |
|
| 93 |
|
|
| 94 |
Context con = mView.getContext(); |
|
| 95 |
Resources res = con.getResources(); |
|
| 96 |
|
|
| 97 |
mNewObject = object.create(mView.getQuat(), null, res, mScreenWidth); |
|
| 98 |
|
|
| 99 |
if( mNewObject!=null ) |
|
| 100 |
{
|
|
| 101 |
mView.setMovement(mNewObject.getMovement()); |
|
| 102 |
mIsSolved = mNewObject.isSolved(); |
|
| 103 |
} |
|
| 104 |
} |
|
| 105 |
|
|
| 106 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 107 |
|
|
| 108 |
private void doEffectNow(BaseEffect.Type type) |
|
| 109 |
{
|
|
| 110 |
try |
|
| 111 |
{
|
|
| 112 |
type.startEffect(mView.getRenderer().getScreen(),this); |
|
| 113 |
} |
|
| 114 |
catch( Exception ex ) |
|
| 115 |
{
|
|
| 116 |
android.util.Log.e("renderer", "exception starting effect: "+ex.getMessage());
|
|
| 117 |
unblockEverything(); |
|
| 118 |
} |
|
| 119 |
} |
|
| 120 |
|
|
| 121 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 122 |
|
|
| 123 |
private void removePatternRotation() |
|
| 124 |
{
|
|
| 125 |
mRemovePatternRotation = true; |
|
| 126 |
} |
|
| 127 |
|
|
| 128 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 129 |
|
|
| 130 |
private void removePatternRotationNow() |
|
| 131 |
{
|
|
| 132 |
mRemovePatternRotation=false; |
|
| 133 |
mNewObject.removeRotationNow(); |
|
| 134 |
mAddActionListener.onActionFinished(mRemoveRotationID); |
|
| 135 |
} |
|
| 136 |
|
|
| 137 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 138 |
|
|
| 139 |
private void removeRotationNow() |
|
| 140 |
{
|
|
| 141 |
mRemoveRotation=false; |
|
| 142 |
mNewObject.removeRotationNow(); |
|
| 143 |
|
|
| 144 |
boolean solved = mNewObject.isSolved(); |
|
| 145 |
unblockEverything(); |
|
| 146 |
if( solved && !mIsSolved ) doEffectNow( BaseEffect.Type.WIN ); |
|
| 147 |
|
|
| 148 |
mIsSolved = solved; |
|
| 149 |
} |
|
| 150 |
|
|
| 151 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 152 |
|
|
| 153 |
private void removeRotation() |
|
| 154 |
{
|
|
| 155 |
mRemoveRotation = true; |
|
| 156 |
} |
|
| 157 |
|
|
| 158 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 159 |
|
|
| 160 |
private void addRotationNow() |
|
| 161 |
{
|
|
| 162 |
mAddRotation = false; |
|
| 163 |
mAddRotationID = mNewObject.addNewRotation( mAddRotationAxis, mAddRotationRowBitmap, |
|
| 164 |
mAddRotationAngle, mAddRotationDuration, this); |
|
| 165 |
|
|
| 166 |
if( mAddRotationID==0 ) // failed to add effect - should never happen |
|
| 167 |
{
|
|
| 168 |
unblockEverything(); |
|
| 169 |
} |
|
| 170 |
} |
|
| 171 |
|
|
| 172 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 173 |
|
|
| 174 |
private void finishRotationNow() |
|
| 175 |
{
|
|
| 176 |
mFinishRotation = false; |
|
| 177 |
blockEverything(BlockController.TUTORIAL_PLACE_0); |
|
| 178 |
mRotationFinishedID = mNewObject.finishRotationNow(this, mNearestAngle); |
|
| 179 |
|
|
| 180 |
if( mRotationFinishedID==0 ) // failed to add effect - should never happen |
|
| 181 |
{
|
|
| 182 |
unblockEverything(); |
|
| 183 |
} |
|
| 184 |
} |
|
| 185 |
|
|
| 186 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 187 |
|
|
| 188 |
private void changeObjectNow() |
|
| 189 |
{
|
|
| 190 |
mChangeObject = false; |
|
| 191 |
|
|
| 192 |
if ( mNewObject==null || mNewObject.getObjectType()!=mNextObject) |
|
| 193 |
{
|
|
| 194 |
blockEverything(BlockController.TUTORIAL_PLACE_1); |
|
| 195 |
createObjectNow(mNextObject); |
|
| 196 |
doEffectNow( BaseEffect.Type.SIZECHANGE ); |
|
| 197 |
} |
|
| 198 |
} |
|
| 199 |
|
|
| 200 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 201 |
|
|
| 202 |
private void setupObjectNow() |
|
| 203 |
{
|
|
| 204 |
mSetupObject = false; |
|
| 205 |
|
|
| 206 |
if ( mNewObject==null || mNewObject.getObjectType()!=mNextObject) |
|
| 207 |
{
|
|
| 208 |
blockEverything(BlockController.TUTORIAL_PLACE_2); |
|
| 209 |
createObjectNow(mNextObject); |
|
| 210 |
doEffectNow( BaseEffect.Type.SIZECHANGE ); |
|
| 211 |
} |
|
| 212 |
else |
|
| 213 |
{
|
|
| 214 |
mNewObject.initializeObject(null); |
|
| 215 |
} |
|
| 216 |
} |
|
| 217 |
|
|
| 218 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 219 |
|
|
| 220 |
private void scrambleObjectNow() |
|
| 221 |
{
|
|
| 222 |
mScrambleObject = false; |
|
| 223 |
mIsSolved = false; |
|
| 224 |
blockEverything(BlockController.TUTORIAL_PLACE_3); |
|
| 225 |
doEffectNow( BaseEffect.Type.SCRAMBLE ); |
|
| 226 |
} |
|
| 227 |
|
|
| 228 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 229 |
|
|
| 230 |
private void solveObjectNow() |
|
| 231 |
{
|
|
| 232 |
mSolveObject = false; |
|
| 233 |
blockEverything(BlockController.TUTORIAL_PLACE_4); |
|
| 234 |
doEffectNow( BaseEffect.Type.SOLVE ); |
|
| 235 |
} |
|
| 236 |
|
|
| 237 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 238 |
|
|
| 239 |
private void solveNow() |
|
| 240 |
{
|
|
| 241 |
mSolve = false; |
|
| 242 |
mNewObject.solve(); |
|
| 243 |
} |
|
| 244 |
|
|
| 245 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 246 |
|
|
| 247 |
private void initializeObjectNow() |
|
| 248 |
{
|
|
| 249 |
mInitializeObject = false; |
|
| 250 |
mNewObject.initializeObject(null); |
|
| 251 |
} |
|
| 252 |
|
|
| 253 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 254 |
|
|
| 255 |
private void setQuatNow() |
|
| 256 |
{
|
|
| 257 |
mSetQuat = false; |
|
| 258 |
mView.setQuat(); |
|
| 259 |
} |
|
| 260 |
|
|
| 261 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 262 |
// |
|
| 263 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 264 |
|
|
| 265 |
void setScreenSize(int width) |
|
| 266 |
{
|
|
| 267 |
if( mNewObject!=null ) |
|
| 268 |
{
|
|
| 269 |
mNewObject.createTexture(); |
|
| 270 |
mNewObject.recomputeScaleFactor(width); |
|
| 271 |
} |
|
| 272 |
|
|
| 273 |
mScreenWidth = width; |
|
| 274 |
} |
|
| 275 |
|
|
| 276 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 277 |
|
|
| 278 |
void finishRotation(int nearestAngle) |
|
| 279 |
{
|
|
| 280 |
mNearestAngle = nearestAngle; |
|
| 281 |
mFinishRotation = true; |
|
| 282 |
} |
|
| 283 |
|
|
| 284 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 285 |
|
|
| 286 |
void changeObject(ObjectType object) |
|
| 287 |
{
|
|
| 288 |
mChangeObject = true; |
|
| 289 |
mNextObject = object; |
|
| 290 |
} |
|
| 291 |
|
|
| 292 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 293 |
|
|
| 294 |
void setQuatOnNextRender() |
|
| 295 |
{
|
|
| 296 |
mSetQuat = true; |
|
| 297 |
} |
|
| 298 |
|
|
| 299 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 300 |
|
|
| 301 |
void preRender() |
|
| 302 |
{
|
|
| 303 |
if( mSolve ) solveNow(); |
|
| 304 |
if( mSetQuat ) setQuatNow(); |
|
| 305 |
if( mFinishRotation ) finishRotationNow(); |
|
| 306 |
if( mRemoveRotation ) removeRotationNow(); |
|
| 307 |
if( mChangeObject ) changeObjectNow(); |
|
| 308 |
if( mSetupObject ) setupObjectNow(); |
|
| 309 |
if( mSolveObject ) solveObjectNow(); |
|
| 310 |
if( mScrambleObject ) scrambleObjectNow(); |
|
| 311 |
if( mAddRotation ) addRotationNow(); |
|
| 312 |
if( mInitializeObject ) initializeObjectNow(); |
|
| 313 |
if( mRemovePatternRotation ) removePatternRotationNow(); |
|
| 314 |
} |
|
| 315 |
|
|
| 316 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 317 |
// PUBLIC API |
|
| 318 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 319 |
|
|
| 320 |
public boolean isTouchBlocked() |
|
| 321 |
{
|
|
| 322 |
return mTouchBlocked; |
|
| 323 |
} |
|
| 324 |
|
|
| 325 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 326 |
|
|
| 327 |
public boolean isUINotBlocked() |
|
| 328 |
{
|
|
| 329 |
return !mUIBlocked; |
|
| 330 |
} |
|
| 331 |
|
|
| 332 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 333 |
|
|
| 334 |
public void blockEverything(int place) |
|
| 335 |
{
|
|
| 336 |
mUIBlocked = true; |
|
| 337 |
mTouchBlocked= true; |
|
| 338 |
mBlockController.touchBlocked(place); |
|
| 339 |
mBlockController.uiBlocked(place); |
|
| 340 |
} |
|
| 341 |
|
|
| 342 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 343 |
|
|
| 344 |
public void blockTouch(int place) |
|
| 345 |
{
|
|
| 346 |
mTouchBlocked= true; |
|
| 347 |
mBlockController.touchBlocked(place); |
|
| 348 |
} |
|
| 349 |
|
|
| 350 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 351 |
|
|
| 352 |
public void unblockEverything() |
|
| 353 |
{
|
|
| 354 |
mUIBlocked = false; |
|
| 355 |
mTouchBlocked= false; |
|
| 356 |
mBlockController.touchUnblocked(); |
|
| 357 |
mBlockController.uiUnblocked(); |
|
| 358 |
} |
|
| 359 |
|
|
| 360 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 361 |
|
|
| 362 |
public void unblockTouch() |
|
| 363 |
{
|
|
| 364 |
mTouchBlocked= false; |
|
| 365 |
mBlockController.touchUnblocked(); |
|
| 366 |
} |
|
| 367 |
|
|
| 368 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 369 |
|
|
| 370 |
public void unblockUI() |
|
Also available in: Unified diff
Move PreRender to objectlib.
This code is now shared betweeen the Rubik and Tutorial activities.