diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-09-24 15:22:09 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-09-24 15:22:09 +0200 |
commit | aadcecf2022ec13d15da5d816567779740a37da7 (patch) | |
tree | 1d1c5c448c69deea35d689d89cfd7abdd754e649 /src/control/RPGEdit.cpp | |
parent | ccf859fe805afe8db3aa694df5d26da7778dfc68 (diff) | |
download | rpgedit-aadcecf2022ec13d15da5d816567779740a37da7.tar rpgedit-aadcecf2022ec13d15da5d816567779740a37da7.zip |
Keep mutable entity list in the MapContext only
Diffstat (limited to 'src/control/RPGEdit.cpp')
-rw-r--r-- | src/control/RPGEdit.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/control/RPGEdit.cpp b/src/control/RPGEdit.cpp index 31998b2..e22d8fa 100644 --- a/src/control/RPGEdit.cpp +++ b/src/control/RPGEdit.cpp @@ -74,10 +74,7 @@ void RPGEdit::systemLoop() { { std::unique_lock<std::mutex> lock(modelMutex); - uint64_t time = std::min(timeProvider.now(), handledTime); - - Model::Position pos = ctx->getViewPosition(time); - mapView->render(pos.x, pos.y, time); + ctx->render(std::min(timeProvider.now(), handledTime)); } SDL_RenderPresent(window->getRenderer()); @@ -104,11 +101,11 @@ void RPGEdit::eventLoop() { void RPGEdit::run() { std::shared_ptr<Model::Map> map = Model::Map::load("test"); - ctx = std::make_shared<MapContext>(&eventBus, &inputHandler, map); - window = std::make_shared<View::Window>(); mapView = std::make_shared<View::MapView>(window, map); + ctx = std::make_shared<MapContext>(&eventBus, &inputHandler, mapView.get(), map); + eventThread = std::thread([this] { eventLoop(); }); systemLoop(); |