1 #include "UnloadState.hpp"
3 #include "../app/Environment.hpp"
4 #include "../io/WorldSave.hpp"
5 #include "../world/ChunkLoader.hpp"
11 UnloadState::UnloadState(
14 const WorldSave &save)
18 , progress(env.assets.large_ui_font)
22 , total(chunks.NumLoaded())
24 progress.Position(glm::vec3(0.0f), Gravity::CENTER);
25 progress.Template("Unloading chunks: %d/%d (%d%%)");
29 void UnloadState::OnResume() {
33 total = chunks.NumLoaded();
37 void UnloadState::Handle(const SDL_Event &) {
41 void UnloadState::Update(int dt) {
42 for (std::size_t i = 0; i < per_update && cur != end; ++i, ++cur, ++done) {
43 if (cur->ShouldUpdateSave()) {
50 progress.Update(done, total);
54 void UnloadState::Render(Viewport &viewport) {
55 progress.Render(viewport);