From be4972b75b9717bd090a61bb0f46e92fed30eb3e Mon Sep 17 00:00:00 2001 From: dmoon Date: Wed, 28 Dec 2016 11:25:00 +0800 Subject: [PATCH] default performance --- .../BackgroundCanvas/BackgroundCanvas.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Client/BackgroundCanvas/BackgroundCanvas.java b/src/Client/BackgroundCanvas/BackgroundCanvas.java index 003c11e..113dc9f 100644 --- a/src/Client/BackgroundCanvas/BackgroundCanvas.java +++ b/src/Client/BackgroundCanvas/BackgroundCanvas.java @@ -51,19 +51,19 @@ public void initTimer() { return; } - int movePixel = 4; -// if (Math.abs(newCanvasX - oldCanvasX) > 60 || Math.abs(newCanvasY - oldCanvasY) > 60) { -// timer.setDelay(5); -// } else if (Math.abs(newCanvasX - oldCanvasX) > 48 || Math.abs(newCanvasY - oldCanvasY) > 48) { -// timer.setDelay(15); -// } else { -// timer.setDelay(16); -// } + int movePixel = 1; + if (Math.abs(newCanvasX - oldCanvasX) > 60 || Math.abs(newCanvasY - oldCanvasY) > 60) { + timer.setDelay(1); + } else if (Math.abs(newCanvasX - oldCanvasX) > 48 || Math.abs(newCanvasY - oldCanvasY) > 48) { + timer.setDelay(2); + } else { + timer.setDelay(3); + } if (newCanvasX - oldCanvasX > 0) { - moveCanvas(movePixel ,0); + moveCanvas(movePixel, 0); } else if (newCanvasX - oldCanvasX < 0) { - moveCanvas(movePixel * -1 ,0); + moveCanvas(movePixel * -1, 0); } else if (newCanvasY - oldCanvasY > 0) { moveCanvas(0, movePixel); } else if (newCanvasY - oldCanvasY < 0) { @@ -78,7 +78,7 @@ public void initTimer() { }; - timer = new Timer(16, move); + timer = new Timer(3, move); timer.setRepeats(true); timer.setCoalesce(true); timer.start();