ADD: AssetLoadingProgressEvent, closes #19
All checks were successful
Tests / test (push) Successful in 2m55s

This commit is contained in:
Sebastian Böckelmann 2026-04-21 09:30:34 +02:00
parent 89e98d0f88
commit 4ed4452dfb
3 changed files with 19 additions and 0 deletions

View File

@ -310,6 +310,7 @@ if(BUILD_GAME)
src/engine/renderer/loader/async/RawStagedModelData.h
src/engine/renderer/loader/async/AssetLoader.cpp
src/engine/renderer/loader/async/AssetLoader.h
src/engine/renderer/loader/async/AssetLoadingProgressEvent.h
)
target_compile_options(Dicewars_Siedler PRIVATE
-Wall

View File

@ -6,10 +6,12 @@
#include <fstream>
#include "AssetLoadingProgressEvent.h"
#include "json.hpp"
#include "../AssetManager.h"
#include "../OBJLoader.h"
#include "../TextureLoader.h"
#include "../../../core/events/EventBus.h"
namespace fs = std::filesystem;
@ -157,6 +159,9 @@ void AssetLoader::processUploadQueue(int maxPerFrame) {
}, intermediateAsset);
++loaded;
}
const LoadingProgress progress = getProgress();
EventBus::getInstance().emit(AssetLoadingProgressEvent(progress.fraction(), progress.isDone()));
}
std::vector<IntermediateAsset> AssetLoader::determineUploadQueue(const int maxPerFrame) {

View File

@ -0,0 +1,13 @@
//
// Created by sebastian on 21.04.26.
//
#ifndef ASSETLOADINGPROGRESSEVENT_H
#define ASSETLOADINGPROGRESSEVENT_H
class AssetLoadingProgressEvent {
public:
float progress;
bool complete;
};
#endif //ASSETLOADINGPROGRESSEVENT_H