Project

General

Profile

« Previous | Next » 

Revision 8d5a8e06

Added by Leszek Koltunski about 5 years ago

Simplify the way applications can get notifications when an effect finishes.

Now, instead of the 'DistortedEffects.(de)registerForNotifications()' 2 APIs, we call a single 'Effect.notifyWhenFinished()'.

View differences:

src/main/java/org/distorted/examples/rubik/RubikCube.java
63 63
    private DistortedEffects[][][] mEffects;
64 64
    private Static3D[][][] mRotationAxis;
65 65
    private Dynamic1D[][][] mRotationAngle;
66
    private MatrixEffectRotate[][][] mRotate;
66 67
    private DistortedTexture mTexture;
67 68
    private int mSize;
68 69

  
......
79 80
      mEffects        = new DistortedEffects[mSize][mSize][mSize];
80 81
      mRotationAxis   = new Static3D[mSize][mSize][mSize];
81 82
      mRotationAngle  = new Dynamic1D[mSize][mSize][mSize];
83
      mRotate         = new MatrixEffectRotate[mSize][mSize][mSize];
82 84

  
83 85
      Static3D[][][] cubeVectors = new Static3D[mSize][mSize][mSize];
84 86

  
......
134 136

  
135 137
              mRotationAngle[x][y][z].add(new Static1D(0.0f));
136 138
              mRotationAngle[x][y][z].add(new Static1D(0.0f));
139
              mRotate[x][y][z] = new MatrixEffectRotate( mRotationAngle[x][y][z], mRotationAxis[x][y][z], center);
137 140

  
138 141
              mEffects[x][y][z] = new DistortedEffects();
139 142
              mEffects[x][y][z].apply(sinkEffect);
140 143
              mEffects[x][y][z].apply(moveEffect);
141 144
              mEffects[x][y][z].apply(scaleEffect);
142 145
              mEffects[x][y][z].apply(quatEffect);
143
              mEffects[x][y][z].apply( new MatrixEffectRotate( mRotationAngle[x][y][z], mRotationAxis[x][y][z], center));
146
              mEffects[x][y][z].apply( mRotate[x][y][z] );
144 147
              mEffects[x][y][z].apply( new MatrixEffectMove(cubeVectors[x][y][z]) );
145 148
              }
146 149
            }
......
224 227
               if( first )
225 228
                 {
226 229
                 first = false;
227
                 mEffects[x][y][z].registerForMessages(listener);
230
                 mRotate[x][y][z].notifyWhenFinished(listener);
228 231
                 }
229 232
               }
230 233
             }

Also available in: Unified diff