Conways-Game-Of-Life/ConwaysGameOfLife/Tile.cpp
Robert Altner e3e9877ec0 Everything has been added.
I cried
2018-03-20 20:52:09 +01:00

35 lines
625 B
C++

#include "stdafx.h"
#include "Tile.h"
Tile::Tile(sf::Vector2f position, sf::Vector2f size)
{
willChangeTo = false;
state = false;
m_tile.setPosition(position);
m_tile.setSize(size);
m_tile.setFillColor(sf::Color::Black);
}
Tile::~Tile()
{
}
// Renders Tile
bool Tile::render(sf::RenderWindow& window)
{
window.draw(m_tile);
return true;
}
// Change state of cell
void Tile::applyStateChange()
{
//if(!state) std::cout << state << ", " << willChangeTo << std::endl;
state = willChangeTo;
if (state == true) m_tile.setFillColor(sf::Color::White);
if (state == false) m_tile.setFillColor(sf::Color::Black);
}