world: Use context at contruction to simplify it's call

This commit is contained in:
2026-01-12 15:44:04 +01:00
parent 95a7d6ea9a
commit c00c430382
4 changed files with 11 additions and 10 deletions

View File

@@ -12,9 +12,13 @@
// Constructor and destructor
World::World(int width, int height) : _width(width), _height(height) {
World::World(gol::ctx &context) {
_width = context.config_json["screen_width"].get<int>() /
context.config_json["cell_size"].get<int>();
_height = context.config_json["screen_height"].get<int>() /
context.config_json["cell_size"].get<int>();
// create world data
this->_data = new std::vector<bool>(width * height, false);
this->_data = new std::vector<bool>(_width * _height, false);
}
World::~World() { delete this->_data; }