From 17909d029c6a8872b2fddf4e171d7925bbbe9c5c Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Thu, 29 Feb 2024 19:27:35 +0100 Subject: Initial commit --- Simulation/SimBase_CreateNew.cpp | 49 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Simulation/SimBase_CreateNew.cpp (limited to 'Simulation/SimBase_CreateNew.cpp') 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; +} -- cgit v1.2.1