package framework.rendering;
import java.util.ArrayList;
import java.util.Collection;
import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.Vector2f;
import framework.collision.CollisionComponent;
import framework.component.Component;
import framework.component.ComponentSystem;
import framework.spacial.PositionComponent;
public class CollisionMaskRenderer {
public static void renderCollisionMasks(Graphics g){
Collection<Component> collisCompsCollection = ComponentSystem.getInstance().getComponentsOfType(CollisionComponent.class.getName());
if(collisCompsCollection != null){
ArrayList<Component> collisComps = new ArrayList<Component>(collisCompsCollection);
for(int i = 0; i < collisComps.size(); i++){
Component c = collisComps.get(i);
PositionComponent posComp = (PositionComponent) c.getSiblingByType(PositionComponent.class.getName());
if(posComp != null){
Vector2f pos = posComp.getVector();
if(pos != null){
CollisionComponent collis = (CollisionComponent) c;
if(collis.getMask() != null){
g.setColor(Color.white);
collis.getMask().renderForDebug(g, pos);
}
}
}
}
}
}
}