1 #include "UnloadState.hpp"
3 #include "Environment.hpp"
4 #include "../io/WorldSave.hpp"
5 #include "../world/ChunkLoader.hpp"
10 UnloadState::UnloadState(
13 const WorldSave &save)
17 , progress(env.assets.large_ui_font)
21 , total(chunks.NumLoaded())
23 progress.Position(glm::vec3(0.0f), Gravity::CENTER);
24 progress.Template("Unloading chunks: %d/%d (%d%%)");
28 void UnloadState::OnResume() {
32 total = chunks.NumLoaded();
36 void UnloadState::Handle(const SDL_Event &) {
40 void UnloadState::Update(int dt) {
41 for (std::size_t i = 0; i < per_update && cur != end; ++i, ++cur, ++done) {
42 if (cur->ShouldUpdateSave()) {
49 progress.Update(done, total);
53 void UnloadState::Render(Viewport &viewport) {
54 progress.Render(viewport);