#ifndef SCENE_H #define SCENE_H #include "SFML/Graphics.hpp" class Scene { public: Scene() { } void AddCell(sf::Vector2f position, std::string genCode, float health, float feedness, float generAge, bool isAlive, bool canDivide, float radius, sf::Color color) { cells.push_back(new Cell(position ,genCode ,health, feedness, generAge, isAlive, canDivide, radius, color)); } void DeleteCell(sf::Vector2f pos) { for (int i = 0; i < cells.size(); i++) if (cells[i]->position==pos) { delete cells[i]; cells.erase (cells.begin()+i); } } void SaveInFile(std::string file_name) { std::ofstream fout(file_name); for (int i = 0; iposition.x<<" "<position.y<<" "; fout<genCode<<" "; fout<health<<" "; fout<feedness<<" "; fout<generAge<<" "; fout<isAlive<<" "; fout<canDivide<<" "; fout<<(unsigned int)cells[i]->color.r<<" "<<(unsigned int)cells[i]->color.g<<" "<<(unsigned int)cells[i]->color.b<<" "<<(unsigned int)cells[i]->color.a<<" "; fout<radius<>xx) { fin>>yy; fin>>gn; fin>>hl; fin>>fd; fin>>ga; fin>>ia; fin>>cd; fin>>r; fin>>g; fin>>b; fin>>a; fin>>rd; cl = sf::Color(r, g, b, a); AddCell(sf::Vector2f(xx, yy), gn, hl, fd, ga, ia, cd, rd, cl); } fin.close(); } int GetCellCount() { return cells.size(); } Cell* GetCell(int i) { if(i>=0 && i cells; friend class Graphics; friend class GameLogic; }; #endif // SCENE_H