Revision af225332
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/examples/effects2d/Effects2DRenderer.java | ||
---|---|---|
32 | 32 |
import org.distorted.library.DistortedBitmap; |
33 | 33 |
import org.distorted.library.Distorted; |
34 | 34 |
import org.distorted.library.EffectTypes; |
35 |
import org.distorted.library.message.EffectListener; |
|
36 |
import org.distorted.library.message.EffectMessage; |
|
35 | 37 |
import org.distorted.library.type.Static3D; |
36 | 38 |
|
37 | 39 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
38 | 40 |
|
39 |
public class Effects2DRenderer implements GLSurfaceView.Renderer |
|
41 |
public class Effects2DRenderer implements GLSurfaceView.Renderer, EffectListener
|
|
40 | 42 |
{ |
41 | 43 |
public static final int NUMLINES = 10; |
42 | 44 |
public static final int BWID = 300; |
... | ... | |
81 | 83 |
} |
82 | 84 |
|
83 | 85 |
mBackground.setBitmap(bitmap); |
84 |
|
|
86 |
mBackground.addEventListener(this); |
|
87 |
|
|
85 | 88 |
try |
86 | 89 |
{ |
87 | 90 |
Distorted.onSurfaceCreated(mView.getContext()); |
... | ... | |
109 | 112 |
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); |
110 | 113 |
mBackground.draw(System.currentTimeMillis()); |
111 | 114 |
} |
115 |
|
|
116 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
117 |
// the library sending messages to us |
|
118 |
|
|
119 |
public void effectMessage(final EffectMessage em, final long effectID, final int effectName, final long bitmapID, final String message) |
|
120 |
{ |
|
121 |
Effects2DActivity act = (Effects2DActivity)mView.getContext(); |
|
122 |
|
|
123 |
switch(em) |
|
124 |
{ |
|
125 |
case EFFECT_REMOVED : act.effectRemoved(effectID) ; break; |
|
126 |
case EFFECT_FINISHED: act.effectFinished(effectID); break; |
|
127 |
default : break; |
|
128 |
} |
|
129 |
} |
|
112 | 130 |
} |
Also available in: Unified diff
More progress with Effects2D app.