Higher FPS! (#19)

This commit is contained in:
gavin
2018-10-05 20:22:11 -04:00
committed by Gitea
parent 0e2b7ea69d
commit 52017e8e30
7 changed files with 160 additions and 49 deletions

View File

@@ -1,14 +1,14 @@
import {getColor, sqrt2} from './utils.js';
import {getColor, invSqrt2, sqrt2} from './utils.js';
import {FLAT, POINTY} from './consts.js';
export default class DrawSquare {
constructor(settings) {
this.settings = Object.assign({}, settings);
this.squareX = [1, 1, -1, -1];
this.squareY = [1, -1, -1, 1];
this.diamondX = [sqrt2, 0, -sqrt2, 0, sqrt2 / 2, -sqrt2 / 2];
this.diamondY = [0, -sqrt2, 0, sqrt2, -sqrt2 / 2, sqrt2 / 2];
this.squareX = [invSqrt2, invSqrt2, -invSqrt2, -invSqrt2];
this.squareY = [invSqrt2, -invSqrt2, -invSqrt2, invSqrt2];
this.diamondX = [1, 0, -1, 0, 0.5, -0.5];
this.diamondY = [0, -1, 0, 1, -0.5, 0.5];
}
fill(context, scale, x, y, cell) {