Project

General

Profile

« Previous | Next » 

Revision 7ba38dd4

Added by Leszek Koltunski over 2 years ago

Major change: separate the notion of a TwistyObject and its Node. Now,

1) the Node stays when we change objects (this makes transitions faster)
2) it's possible to just create an Object without adding it to the Screen (now app needs to explicitly create the Node and add it to its Screen itself)

View differences:

src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
24 24
import android.app.Activity;
25 25
import android.content.SharedPreferences;
26 26

  
27
import org.distorted.library.main.DistortedFramebuffer;
28 27
import org.distorted.library.message.EffectListener;
29 28

  
30 29
import org.distorted.library.type.Static3D;
......
55 54
  private boolean mUIBlocked, mTouchBlocked, mIsSolved;
56 55
  private long mRotationFinishedID;
57 56
  private final long[] mEffectID;
58
  private int mScreenWidth, mScreenHeight;
59 57
  private int[][] mNextMoves;
60 58
  private int mScrambleObjectNum;
61 59
  private int mAddRotationAxis, mAddRotationRowBitmap, mAddRotationAngle;
......
88 86
    mNewObject = null;
89 87

  
90 88
    mDebug = "";
91

  
92
    mScreenWidth  = 0;
93
    mScreenHeight = 0;
94 89
    mScrambleObjectNum = 0;
95 90

  
96 91
    mEffectID = new long[BaseEffect.Type.LENGTH];
......
109 104
    mOldObject = mNewObject;
110 105
    Static3D move = new Static3D(mMoveX,mMoveY,0);
111 106

  
112
    mNewObject = object.create( mController.getQuat(), move, mAct.get().getResources(), mScreenWidth, mScreenHeight);
107
    mNewObject = object.create( mController.getQuat(), move, mAct.get().getResources());
113 108

  
114 109
    if( mNewObject!=null )
115 110
      {
......
127 122
    try
128 123
      {
129 124
      int index = type.ordinal();
130
      DistortedFramebuffer frame = mController.getInterface().getFramebuffer();
131
      mEffectID[index] = type.startEffect(frame,this);
125
      mEffectID[index] = type.startEffect(this);
132 126
      }
133 127
    catch( Exception ex )
134 128
      {
......
374 368
// PUBLIC API
375 369
///////////////////////////////////////////////////////////////////////////////////////////////////
376 370

  
377
  public void setScreenSize(int width, int height)
371
  public void setScreenSize()
378 372
    {
379
    if( mNewObject!=null )
380
      {
381
      mNewObject.createTexture();
382
      mNewObject.recomputeScaleFactor(width,height);
383
      }
384
    mScreenWidth = width;
385
    mScreenHeight= height;
373
    if( mNewObject!=null ) mNewObject.createTexture();
386 374
    }
387 375

  
388 376
///////////////////////////////////////////////////////////////////////////////////////////////////
......
570 558
    return mNewObject;
571 559
    }
572 560

  
561
///////////////////////////////////////////////////////////////////////////////////////////////////
562

  
563
  public TwistyObjectNode getObjectNode()
564
    {
565
    return mController.getNode();
566
    }
567

  
573 568
///////////////////////////////////////////////////////////////////////////////////////////////////
574 569

  
575 570
  public void effectFinished(final long effectID)

Also available in: Unified diff