ADD: AssetLoadingProgressEvent, closes #19
All checks were successful
Tests / test (push) Successful in 2m55s
All checks were successful
Tests / test (push) Successful in 2m55s
This commit is contained in:
parent
89e98d0f88
commit
4ed4452dfb
@ -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
|
||||
|
||||
@ -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) {
|
||||
|
||||
13
src/engine/renderer/loader/async/AssetLoadingProgressEvent.h
Normal file
13
src/engine/renderer/loader/async/AssetLoadingProgressEvent.h
Normal 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
|
||||
Loading…
Reference in New Issue
Block a user