world: Use context at contruction to simplify it's call
This commit is contained in:
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user