/** * 小數運算演示Canvas * @author Jagie * */ public class FloatCanvas extends Canvas implements Runnable { //用于統計屏幕刷新次數 int paintCount; //屏幕寬度,高度。定點數 int w_FP, h_FP; //當前點坐標,前一點坐標,定點數 int curX_FP, curY_FP, lastX_FP, lastY_FP; //速率 public static final int RATE = 5;
public FloatCanvas() { w_FP = MathFP.toFP(this.getWidth()); h_FP = MathFP.toFP(this.getHeight()); //開始點處于屏幕的左下角 lastX_FP = MathFP.toFP(0); lastY_FP = h_FP; new Thread(this).start(); }