package ecs.systems;

import ecs.components.*;
import ecs.core.System;
import res.display.FrameBuffer;

using Std;
using res.graphics.Painter;

class DebugDrawSystem extends System {
	public function new() {
		super(Spatial);

		updatable = false;
	}

	override function render(frameBuffer:FrameBuffer) {
		for (entity in entities) {
			final spatial = entity.get(Spatial);
			final triggerRadius = entity.get(TriggerRadius);

			if (triggerRadius != null)
				frameBuffer.circle(spatial.x.int(), spatial.y.int(), triggerRadius.radius.int(), 3);

			final collision = entity.get(CollisionCircle);

			if (collision != null)
				frameBuffer.circle(spatial.x.int(), spatial.y.int(), collision.radius.int(), 13);
		}
	}
}
