void MapTransitionAnimation::step() const
	{
		amount += (direction ? 1 : -1) / (getAnimationFPS() * getAnimationDuration());
		if (amount > 1.0f) amount = 1.0f;
		else if (amount < 0.0f) amount = 0.0f;
		fill.setUniform("amount", amount);
		stripes.setUniform("amount", amount);
	}
unsigned sampleAnimation(const std::string &tname, const std::string &aname, float timePassed, float speed, bool loop)
{
	unsigned index = (timePassed / getAnimationDuration(tname,aname)) 
											* (getAnimationLength(tname,aname));
	if (loop)
		index %= getAnimationLength(tname, aname);
	else if (index == getAnimationLength(tname, aname))
		index--;

	return getFrame(tname, aname, index);
}
void Player::update()
{
	fireDelay -= sfw::getDeltaTime();
	// example of switching between animations
	if (sfw::getKey(' ') && fireDelay < 0)
	{
		fireDelay = rateOfFire;
		gs()->makeBullet(x, y, 0, 300, 4.f); // Now we can use this to draw stuff!

		
	}

	if (animTimer > getAnimationDuration(textureName, animationName))
	{
		animTimer = 0;
		animationName = "BOOM";
	}

	float sdt = sfw::getDeltaTime() * speed;
	if (sfw::getKey('W')) y += sdt; // Euler integration
	if (sfw::getKey('S')) y -= sdt;
	if (sfw::getKey('A')) x -= sdt;
	if (sfw::getKey('D')) x += sdt;
}