/** * 小数运算演示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(); }