// methods for being displayed I guess
- getCanvasCoords(xorig, yorig, scale, ispoint=true) {
+ getCanvasCoords(xorig, yorig, scale) {
// x,y is origin place, scale is how much to multiply unit dist by
var xi = 0;
var yi = 0;
// ispoint determines ^ or _ for how they look on top
- if(ispoint) {
- xi = scale * (Math.sqrt(3)*this.q+Math.sqrt(3)*this.r/2);
- yi = scale * (this.r*3/2);
- }
+ /*if(ispoint) {*/
+ xi = scale * (Math.sqrt(3)*this.q+Math.sqrt(3)*this.r/2);
+ yi = scale * (this.r*3/2);
+ /*}
else {
xi = scale * (this.q*3/2);
yi = scale * (Math.sqrt(3)*this.q/2+Math.sqrt(3)*this.r);
- }
+ }*/
return {x: xi+xorig, y: yi+yorig}
}
c.addEventListener('mousemove', radius_hover);
// tf are those arguments globals are there for a reason
- ctx.save();
- ctx.fillStyle="rgba(0.4,0.4,0.4,0.1)"
- ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height);
- ctx.restore();
}
rotateThingy = function(evt) {
c.removeEventListener('mousemove', radius_hover);
copyHandler = function(e) {
c.onclick = e=>copyhex(e);
c.addEventListener('mousemove', radius_hover);
- ctx.save();
- ctx.fillStyle="rgba(0.4,0.4,0.4,0.1)"
- ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height);
- ctx.restore();
}
copyhex = function(evt) {
function drawGrid(grid, ctx, cx, cy, scale) {
ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height);
for(var i of grid.cells) {
- coords = i.getCanvasCoords(cx, cy, scale, true);
+ coords = i.getCanvasCoords(cx, cy, scale);
drawState(ctx, i.state, coords.x, coords.y, scale);
}
}