RSTestViewpublic class RSTestView extends android.renderscript.RSSurfaceView
Fields Summary |
---|
private android.content.Context | mCtx | private android.renderscript.RenderScriptGL | mRS | private RSTestCore | mRender |
Constructors Summary |
---|
public RSTestView(android.content.Context context)
super(context);
mCtx = context;
//setFocusable(true);
|
Methods Summary |
---|
protected void | onDetachedFromWindow()
if(mRS != null) {
mRender.cleanup();
mRS = null;
destroyRenderScriptGL();
}
| public boolean | onKeyDown(int keyCode, android.view.KeyEvent event)
return super.onKeyDown(keyCode, event);
| public boolean | onTouchEvent(android.view.MotionEvent ev)
boolean ret = false;
int act = ev.getAction();
if (act == ev.ACTION_DOWN) {
mRender.onActionDown((int)ev.getX(), (int)ev.getY());
ret = true;
}
else if (act == ev.ACTION_MOVE) {
mRender.onActionMove((int)ev.getX(), (int)ev.getY());
ret = true;
}
return ret;
| public void | surfaceChanged(android.view.SurfaceHolder holder, int format, int w, int h)
super.surfaceChanged(holder, format, w, h);
if (mRS == null) {
RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
mRS = createRenderScriptGL(sc);
mRS.setSurface(holder, w, h);
mRender = new RSTestCore(mCtx);
mRender.init(mRS, getResources(), w, h);
}
|
|