aboutsummaryrefslogtreecommitdiff
path: root/Simulation/SimBase_CreateNew.cpp
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2024-02-29 19:27:35 +0100
committerPaul Oliver <contact@pauloliver.dev>2024-02-29 19:27:49 +0100
commit17909d029c6a8872b2fddf4e171d7925bbbe9c5c (patch)
treecbb08af84cd68d24acc362d593a2048b0fa79689 /Simulation/SimBase_CreateNew.cpp
Initial commitHEADmaster
Diffstat (limited to 'Simulation/SimBase_CreateNew.cpp')
-rw-r--r--Simulation/SimBase_CreateNew.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/Simulation/SimBase_CreateNew.cpp b/Simulation/SimBase_CreateNew.cpp
new file mode 100644
index 0000000..de752aa
--- /dev/null
+++ b/Simulation/SimBase_CreateNew.cpp
@@ -0,0 +1,49 @@
+#include "SimBase.hpp"
+
+bool SimBase::createNew(const Params &usrPrms)
+{
+ prms = usrPrms;
+
+ seedRand();
+
+ sf::VideoMode vmd = sf::VideoMode(prms.WIN_WIDTH, prms.WIN_HEIGHT);
+ sf::ContextSettings ctx = sf::ContextSettings(0, 0, prms.ANTIALIAS, 2, 0);
+ window.create(vmd, "Neural Guppies - 0.1 beta", sf::Style::Default, ctx);
+ window.setVerticalSyncEnabled(vSync);
+
+ sf::Image icon;
+ icon.loadFromFile("gfx/icon.png");
+ window.setIcon(32, 32, icon.getPixelsPtr());
+
+ prepareGraphics();
+
+ camera.create(this);
+ tank.create(this);
+
+ zappers.resize(prms.zapperQtty);
+ for (auto &i : zappers)
+ {
+ i.startup(this);
+ i.create();
+ }
+
+ pellets.resize(prms.pelletQtty);
+ for (auto &i : pellets)
+ {
+ i.startup(this);
+ }
+ if (!prms.startScarce)
+ {
+ for (auto &i : pellets)
+ {
+ i.create();
+ }
+ }
+
+ if (!startSpecs())
+ {
+ return false;
+ }
+
+ return true;
+}