fix(canvas): emit should call with view as this

fix(sample): 贪吃蛇重力感应版: some typo and bugs
This commit is contained in:
hyb1996
2018-03-31 12:25:38 +08:00
parent 7a4eb33245
commit 32f9fd3359
5 changed files with 40 additions and 41 deletions

View File

@@ -77,7 +77,7 @@ public class ScriptCanvasView extends SurfaceView implements SurfaceHolder.Callb
canvas = holder.lockCanvas();
scriptCanvas.setCanvas(canvas);
scriptCanvas.drawColor(Color.WHITE);
emit("draw", scriptCanvas, this);
emit("draw", scriptCanvas, ScriptCanvasView.this);
holder.unlockCanvasAndPost(canvas);
canvas = null;
long dt = mTimePerDraw - (SystemClock.uptimeMillis() - time);