Add item markers
This commit is contained in:
parent
b27bd7bba2
commit
3eb74e44aa
8 changed files with 41 additions and 12 deletions
|
@ -11,6 +11,7 @@ const TAU = consts.TAU;
|
|||
export let canvas, context, tempCanvas, tempContext;
|
||||
export let perspective;
|
||||
export let trace = false;
|
||||
export let markers = false;
|
||||
|
||||
export function init() {
|
||||
canvas = document.querySelector('#main');
|
||||
|
@ -74,6 +75,11 @@ export function toggleTrace() {
|
|||
return trace;
|
||||
}
|
||||
|
||||
export function toggleMarkers() {
|
||||
markers = !markers;
|
||||
return markers;
|
||||
}
|
||||
|
||||
export function changeZoom(delta) {
|
||||
perspective.zoomDelta(delta);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,17 @@ function renderParticle(particle) {
|
|||
function renderEntity(entity) {
|
||||
context.save();
|
||||
context.translate(...entity.com);
|
||||
if (graphics.perspective.zoom < 2 && graphics.markers) {
|
||||
context.globalAlpha = 0.7 / graphics.perspective.zoom;
|
||||
context.beginPath();
|
||||
context.arc(0, 0, 4, 0, 2 * Math.PI);
|
||||
context.lineWidth = 1;
|
||||
context.strokeStyle = '#31911b';
|
||||
if (entity.type === 'fuelcan')
|
||||
context.strokeStyle = '#af4021';
|
||||
context.stroke();
|
||||
context.globalAlpha = 1;
|
||||
}
|
||||
context.rotate(entity.r);
|
||||
context.drawImage(entity.image, -0.5, -0.5, 1, 1);
|
||||
context.restore();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue