erratic-gate/src/modules/simulation/helpers/renderGate.ts
2019-07-15 14:45:52 +03:00

13 lines
425 B
TypeScript

import { Gate } from '../classes/Gate'
import { drawRotatedSquare } from './drawRotatedSquare'
import { MouseManager } from '../classes/MouseManager'
export const renderGate = (ctx: CanvasRenderingContext2D, gate: Gate) => {
let mode = 0
if (gate.transform.rotation > 0) mode = 1
else if (gate.transform.rotation < 0) mode = -1
ctx.fillStyle = gate.color
drawRotatedSquare(ctx, gate.transform, mode)
}