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/effectqueue/EffectQueueRenderer.java
40 40
import org.distorted.library.mesh.MeshFlat;
41 41
import org.distorted.library.main.DistortedTexture;
42 42
import org.distorted.library.message.EffectListener;
43
import org.distorted.library.message.EffectMessage;
44 43
import org.distorted.library.type.Static3D;
45 44

  
46 45
///////////////////////////////////////////////////////////////////////////////////////////////////
......
82 81
    mTexture = new DistortedTexture(texWidth,texHeight);
83 82
    mEffects = new DistortedEffects();
84 83
    mEffects.apply(scaleEffect);
85
    mEffects.registerForMessages(this);
86 84

  
87 85
    mScreen = new DistortedScreen();
88 86
    }
......
148 146
    }
149 147

  
150 148
///////////////////////////////////////////////////////////////////////////////////////////////////
151
// the library sending messages to us. This is running on a library 'MessageSender' thread.
152 149

  
153
  public void effectMessage(final EffectMessage em, final long effectID, final long objectID)
150
  public void effectFinished(final long effectID)
154 151
    {
155 152
    EffectQueueActivity act = (EffectQueueActivity)mView.getContext();
156

  
157
    switch(em)
158
      {
159
      case EFFECT_REMOVED : act.effectRemoved(effectID) ; break;
160
      case EFFECT_FINISHED: act.effectFinished(effectID); break;
161
      default             : break;
162
      }
153
    act.effectFinished(effectID);
163 154
    }
164 155
  }

Also available in: Unified diff