mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
minor refactor
This commit is contained in:
parent
e7e7bbbe59
commit
d2ace01c07
2 changed files with 7 additions and 9 deletions
|
|
@ -9,18 +9,15 @@
|
|||
|
||||
LevelController::LevelController(EngineSettings& settings, Level* level)
|
||||
: settings(settings), level(level) {
|
||||
blocks = new BlocksController(level, settings.chunks.padding);
|
||||
chunks = new ChunksController(level, settings.chunks.padding);
|
||||
player = new PlayerController(level, settings, blocks);
|
||||
blocks = std::make_unique<BlocksController>(level, settings.chunks.padding);
|
||||
chunks = std::make_unique<ChunksController>(level, settings.chunks.padding);
|
||||
player = std::make_unique<PlayerController>(level, settings, blocks.get());
|
||||
|
||||
scripting::on_world_load(level);
|
||||
}
|
||||
|
||||
LevelController::~LevelController() {
|
||||
scripting::on_world_quit();
|
||||
delete player;
|
||||
delete chunks;
|
||||
delete blocks;
|
||||
}
|
||||
|
||||
void LevelController::update(float delta, bool input, bool pause) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef LOGIC_LEVEL_CONTROLLER_H_
|
||||
#define LOGIC_LEVEL_CONTROLLER_H_
|
||||
|
||||
#include <memory>
|
||||
#include "../settings.h"
|
||||
|
||||
class Level;
|
||||
|
|
@ -13,9 +14,9 @@ class LevelController {
|
|||
EngineSettings& settings;
|
||||
Level* level;
|
||||
// Sub-controllers
|
||||
BlocksController* blocks;
|
||||
ChunksController* chunks;
|
||||
PlayerController* player;
|
||||
std::unique_ptr<BlocksController> blocks;
|
||||
std::unique_ptr<ChunksController> chunks;
|
||||
std::unique_ptr<PlayerController> player;
|
||||
public:
|
||||
LevelController(EngineSettings& settings, Level* level);
|
||||
~LevelController();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue