diff --git a/Source/Cellular-Automata.vcxproj b/Source/Cellular-Automata.vcxproj
index 7d0307c..cdc438d 100644
--- a/Source/Cellular-Automata.vcxproj
+++ b/Source/Cellular-Automata.vcxproj
@@ -107,10 +107,13 @@
true
_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
+ C:\SFML-2.5.0\include;%(AdditionalIncludeDirectories)
Console
true
+ C:\SFML-2.5.0\lib;%(AdditionalLibraryDirectories)
+ sfml-graphics-d.lib;sfml-window-d.lib;sfml-audio-d.lib;sfml-network-d.lib;sfml-system-d.lib;%(AdditionalDependencies)
@@ -144,12 +147,15 @@
true
NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
+ C:\SFML-2.5.0\include;%(AdditionalIncludeDirectories)
Console
true
true
true
+ C:\SFML-2.5.0\lib;%(AdditionalLibraryDirectories)
+ sfml-graphics.lib;sfml-window.lib;sfml-audio.lib;sfml-network.lib;sfml-system.lib;%(AdditionalDependencies)
diff --git a/Source/Custom/custom.cpp b/Source/Custom/custom.cpp
index 99621c1..0d9ccc4 100644
--- a/Source/Custom/custom.cpp
+++ b/Source/Custom/custom.cpp
@@ -60,7 +60,7 @@ void Custom::init()
{
information.resize(2);
- // Loop through cells and set them to on or off randomly.
+ // Loop through cells and set them to off.
for (int i = 0; i < cellCount; i++)
{
population.push_back(off);
@@ -90,6 +90,8 @@ void Custom::update()
int neighbours;
+ populationSize = 0;
+
// Loop through all cells and change their state in the next generation based on neighbours.
for (int i = 0; i < cellCount; i++)
{
@@ -108,6 +110,7 @@ void Custom::update()
if (neighbours == survival[j])
{
new_population[i] = on;
+ populationSize++;
}
}
@@ -123,8 +126,10 @@ void Custom::update()
if (neighbours == birth[j])
{
new_population[i] = on;
+ populationSize++;
}
}
+
break;
}
}
diff --git a/Source/application.cpp b/Source/application.cpp
index 61b5aad..19cb162 100644
--- a/Source/application.cpp
+++ b/Source/application.cpp
@@ -23,7 +23,7 @@ void Application::initGUI()
text.setFillColor(sf::Color::White);
text.setOutlineColor(sf::Color::Black);
text.setOutlineThickness(1);
- text.setPosition(0, i * 32);
+ text.setPosition(float(0), float(i * 32));
texts.push_back(text);
}
@@ -80,7 +80,7 @@ void Application::setQuadColour(sf::Color colour, int index)
// Cycles the state of a cell at specific coordinates.
void Application::cycleCell(sf::Vector2f coordinates)
{
- cellularAutomaton->cycleCell(coordinates.x, coordinates.y);
+ cellularAutomaton->cycleCell(int(coordinates.x), int(coordinates.y));
}
// Checks and handles events.
@@ -157,6 +157,7 @@ void Application::pollEvents()
case sf::Keyboard::Escape:
{
window.close();
+ break;
}
default:
@@ -164,6 +165,8 @@ void Application::pollEvents()
break;
}
}
+
+ break;
}
// Non repeating mouse input,
@@ -184,6 +187,8 @@ void Application::pollEvents()
cycleCell(worldPos);
}
}
+
+ break;
}
default:
diff --git a/Source/application.h b/Source/application.h
index d9725ee..6e92236 100644
--- a/Source/application.h
+++ b/Source/application.h
@@ -91,12 +91,13 @@ class Application
void run()
{
std::cout << "Controls:\n"
- << "Q/E - Zoom\n"
- << "WASD - Pan camera\n"
- << "R - Reset camera\n"
- << "Z/X - Change simulation speed\n"
- << "Space - Pause\n"
- << "Esc - Exit\n"
+ << "Q/E - Zoom\n"
+ << "WASD - Pan camera\n"
+ << "R - Reset camera\n"
+ << "Z/X - Change simulation speed\n"
+ << "Mouse Left - Cycle cell state\n"
+ << "Space - Pause\n"
+ << "Esc - Exit\n"
<< "__________________________________________________\n\n";
init();
@@ -158,7 +159,7 @@ class Application
window.setView(window.getDefaultView());
- for (int i = 0; i < texts.size(); i++)
+ for (int i = 0; i < signed(texts.size()); i++)
{
window.draw(texts[i]);
}
diff --git a/Source/main.cpp b/Source/main.cpp
index d0b873c..5394096 100644
Binary files a/Source/main.cpp and b/Source/main.cpp differ