package nz.ac.massey.javaecs.examples.Systems;

import java.util.BitSet;

import nz.ac.massey.javaecs.ECSSystem;
import nz.ac.massey.javaecs.Engine;
import nz.ac.massey.javaecs.Entity;
import nz.ac.massey.javaecs.examples.Components.LogUpdate;
import nz.ac.massey.javaecs.examples.Components.Vec2D;

public class LogUpdateSystem extends ECSSystem{
    Engine gameEngine;

    public LogUpdateSystem(Engine gameEngine){
        this.gameEngine = gameEngine;
        // Set registrations
        registrationSet = new BitSet();
        registrationSet.set(gameEngine.getComponentIndex(LogUpdate.class));
    }
    @Override
    public void init() {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void update() {
        for (Entity entity : entities) {
            Vec2D pos = (Vec2D)gameEngine.getComponentData(entity, Vec2D.class);
            System.out.println(String.format("X: %.6g, Y: %.6g", pos.x, pos.y));
        }
        
    }    
}
