Example #1
0
AnimationManager::AnimationManager(const sf::Texture & _texture,int _columnAmount,int _rowAmount,Vector2D &_position, Vector2D _scale)
{
	debug = false;
	texture = _texture;
	width = texture.getSize().x;
	height = texture.getSize().y;
	cellWidth = width/_columnAmount;
	cellHeight = height/_rowAmount;
	selectedRow = 0;
	selectedColumn = 0;
	columnAmount = _columnAmount;
	rowAmount = _rowAmount;
	position = _position;
	isLooping = false;
	isDead = false;
	willDie = false;
	cellOrigin = Vector2D(cellWidth/2,cellHeight/2);
	for(int i = 0; i < rowAmount;i ++)
	{
		animation temp;
		temp.index = i;
		for(int j = 0 ; j < columnAmount; j++)
		{
			temp.RectangleList.push_back(sf::IntRect(cellWidth * j,cellHeight * i,cellWidth,cellHeight));
		}
		animationList.push_back(temp);
	}
	texture.setSmooth(true);
	sf::Sprite t(texture);
	outputSprite.setOrigin(cellOrigin.toSFMLVector());
	outputSprite.setTexture(texture,true);
	outputSprite.setPosition(position.toSFMLVector());
	outputSprite.setScale(_scale.toSFMLVector());
}
Example #2
0
PulsingText::PulsingText(std::string _text, Vector2D _position, float min, float fluxSpeed) :
m_minAlpha(min),
text(_text),
m_position(_position),
m_maxAlpha(255),
m_fluxSpeed(fluxSpeed),
m_currentAlpha(255)
{
	font = &GameConstants::COOL_FONT;
	m_text.setFont(*font);
	m_text.setString(_text);
	m_text.setPosition(_position.toSFMLVector());
	c.r = 135;
	c.g = 206;
	c.b = 250;
	c.a = m_currentAlpha;
}
Example #3
0
Circle::Circle(Vector2D centre, float radius) : m_radius(radius), m_centre(centre)
{
	circle = sf::CircleShape(m_radius);
	circle.setPosition(centre.toSFMLVector());
}