/*
 * ForceField.h
 *
 *  Created on: 2009-07-12
 *      Author: wasyl
 */

#ifndef FORCEFIELD_H_
#define FORCEFIELD_H_

#include <allegro5/allegro.h>
#include "../prep/misc/Vector2D.h"
#include "../prep/ent/Entity.h"
#include "../prep/res/Sheet.h"


class ForceField : public Entity
{
protected:
	bool mVertical;

public:
	ForceField(bool vertical);
	~ForceField();

	int *indices()
	{
		static int ind[] = {ID("entt"), ID("rndr"), ID("dyna"), ID("posi"), 0};
		return ind;
	}

	int order(int index)
	{
		if (index == ID("rndr"))
			return 70;
		else
			return (int)this;
	}

	void update(double dt);
	void render();

	Entity *clone() { return new ForceField(mVertical); };
	const char *code() { return "ff"; };
	std::string edString() { return SPrintF::format("forcefield(%s)", mVertical ? "v" : "h"); }

	void load(FILE *f);
	void save(FILE *f);
};
#endif /* FORCEFIELD_H_ */
