Commit 90bd4031 authored by Christian Winter's avatar Christian Winter

two canvases workign

parent dec1f183
......@@ -18,8 +18,8 @@
Math.round(p.y / this.height) * this.height);
}
drawGrid() {
let bounds = Application.currentView.camera.getVisibleBounds();
getLines(view) {
let bounds = view.camera.getVisibleBounds();
let min = new Vector2(bounds.left, bounds.top);
let max = new Vector2(bounds.right, bounds.bottom);
let sMin = this.getNearestPointFor(min);
......@@ -33,34 +33,20 @@
for (let x = startX; x <= max.x; x += this.width)
if (x == 0)
axisLines.push(new Line(new Vector2(x, min.y), new Vector2(x, max.y)));
axisLines.push(new Line(new Vector2(x, min.y), new Vector2(x, max.y), Settings.emblemRed, this.axisThickness));
else if (x % (this.width * this.bigGridNumber) != 0)
gridLines.push(new Line(new Vector2(x, min.y), new Vector2(x, max.y)));
gridLines.push(new Line(new Vector2(x, min.y), new Vector2(x, max.y), this.gridLineColor, this.thickness));
else
bigGridLines.push(new Line(new Vector2(x, min.y), new Vector2(x, max.y)));
bigGridLines.push(new Line(new Vector2(x, min.y), new Vector2(x, max.y), this.bigGridLineColor, this.thickness * 2));
for (let y = startY; y <= max.y; y += this.height)
if (y == 0)
axisLines.push(new Line(new Vector2(min.x, y), new Vector2(max.x, y)));
axisLines.push(new Line(new Vector2(min.x, y), new Vector2(max.x, y), Settings.emblemRed, this.axisThickness));
else if (y % (this.height * this.bigGridNumber) != 0)
gridLines.push(new Line(new Vector2(min.x, y), new Vector2(max.x, y)));
gridLines.push(new Line(new Vector2(min.x, y), new Vector2(max.x, y), this.gridLineColor, this.thickness));
else
bigGridLines.push(new Line(new Vector2(min.x, y), new Vector2(max.x, y)));
bigGridLines.push(new Line(new Vector2(min.x, y), new Vector2(max.x, y), this.bigGridLineColor, this.thickness * 2));
if (gridLines.length > 0) {
for (let line of gridLines)
Renderer.batchLine(line, true);
Renderer.renderBatchedLines(this.thickness, this.gridLineColor, false, true);
}
if (bigGridLines.length > 0) {
for (let line of bigGridLines)
Renderer.batchLine(line, true);
Renderer.renderBatchedLines(this.thickness * 2, this.bigGridLineColor, false, true);
}
if (axisLines.length > 0) {
for (let line of axisLines)
Renderer.batchLine(line, true);
Renderer.renderBatchedLines(this.axisThickness, Settings.emblemRed, false, true);
}
return axisLines.concat(gridLines).concat(bigGridLines);
}
}
\ No newline at end of file
......@@ -40,10 +40,7 @@ class Input {
break;
}
// WIP new structure --> always false
if (MouseHandler.canvasFocused)
Logic.currentState.keyDown(e.keyCode);
Logic.currentState.keyDown(e.keyCode);
Application.currentView.keyDown(e.keyCode);
if (!MouseHandler.canvasFocused) {
......@@ -79,11 +76,8 @@ class Input {
switch (e.keyCode) {
default:
// WIP new structure --> always false
if (MouseHandler.canvasFocused)
Logic.currentState.keyUp(e.keyCode);
Application.currentView.keyDown(e.keyCode);
Logic.currentState.keyUp(e.keyCode);
Application.currentView.keyUp(e.keyCode);
break;
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment