package ei.engine.test;


import ei.engine.LWJGLGameWindow;
import ei.engine.effects.Particles;
import ei.engine.math.Vector2f;
import ei.engine.scene.Node;

public class ParticlesTest extends LWJGLGameWindow{
	private ParticlesTestFrame ptf;
	private Particles p;
	private Node rootNode;
	
	public static void main(String[] args){
		new ParticlesTest();
	}

	public ParticlesTest() {
		super("ParticlesTest");
	}
	
	protected void init(){
		rootNode = new Node("InGameNode");
		
		ptf = new ParticlesTestFrame();
		ptf.getJFrame().setVisible(true);
		
		p = new Particles("particle");
		p.setLocation(new Vector2f(LWJGLGameWindow.getWidth()/2,LWJGLGameWindow.getHeight()/2));
		rootNode.add(p);
	}
	
	protected void update() {
		super.update();
		p.life = ptf.life.getValue();
		p.MaxSpeedX = ptf.maxSpeedX.getValue();
		p.MaxSpeedY = ptf.maxSpeedY.getValue();
		p.MaxSpeedZ = ptf.maxSpeedZ.getValue();
		p.pullForceX = ptf.pullForceX.getValue();
		p.pullForceY = ptf.pullForceY.getValue();
		p.pullForceZ = ptf.pullForceZ.getValue();
		p.rainbow = ptf.rainbow.isSelected();
		p.regenerate = ptf.regenerate.isSelected();
		p.size = ptf.size.getValue();
		p.slowdown = ptf.slowdown.getValue();
		p.xspeed = ptf.xspeed.getValue();
		p.yspeed = ptf.yspeed.getValue();
		rootNode.update();
	}
	
	/**
	 * this method shid be overriden
	 */
	protected void render(){
		rootNode.render();
	}
}
