1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-25 03:42:48 +01:00

Remove BackgroundLoader.hpp

This commit is contained in:
Daniel Evans 2016-09-11 22:19:38 +01:00
parent 62ad6b8628
commit 9b45a31834
4 changed files with 0 additions and 66 deletions

View File

@ -61,7 +61,6 @@ set(RWENGINE_SOURCES
src/items/InventoryItem.hpp
src/items/WeaponItem.cpp
src/items/WeaponItem.hpp
src/loaders/BackgroundLoader.hpp
src/loaders/DataLoader.cpp
src/loaders/DataLoader.hpp
src/loaders/GenericDATLoader.cpp

View File

@ -11,7 +11,6 @@
#include <script/SCMFile.hpp>
#include <core/Logger.hpp>
#include <loaders/BackgroundLoader.hpp>
#include <loaders/GenericDATLoader.hpp>
#include <loaders/LoaderGXT.hpp>
#include <platform/FileIndex.hpp>

View File

@ -1,38 +0,0 @@
#pragma once
#include <data/ResourceHandle.hpp>
#include <job/WorkContext.hpp>
#include <platform/FileIndex.hpp>
/**
* Implementation of a worker that loads a resource in the background.
*/
template <class T, class L>
class BackgroundLoaderJob : public WorkJob {
public:
typedef typename ResourceHandle<T>::Ref TypeRef;
BackgroundLoaderJob(WorkContext* context, FileIndex* index,
const std::string& file, const TypeRef& ref)
: WorkJob(context), index(index), filename(file), resourceRef(ref) {
}
void work() {
data = index->openFile(filename);
}
void complete() {
if (data) {
L loader;
resourceRef->resource = loader.loadFromMemory(data);
resourceRef->state = RW::Loaded;
}
}
private:
FileIndex* index;
std::string filename;
FileHandle data;
TypeRef resourceRef;
};

View File

@ -1,7 +1,6 @@
#include <boost/test/unit_test.hpp>
#include <data/Model.hpp>
#include <job/WorkContext.hpp>
#include <loaders/BackgroundLoader.hpp>
#include "test_globals.hpp"
BOOST_AUTO_TEST_SUITE(LoaderDFFTests)
@ -38,31 +37,6 @@ BOOST_AUTO_TEST_CASE(test_load_dff) {
}
}
BOOST_AUTO_TEST_CASE(test_loader_job) {
{
WorkContext ctx;
ResourceHandle<Model>::Ref modelRef{
new ResourceHandle<Model>("landstal.dff")};
auto index = &Global::get().e->data->index;
auto job = new BackgroundLoaderJob<Model, LoaderDFF>{
&ctx, index, "landstal.dff", modelRef};
ctx.queueJob(job);
while (modelRef->state == RW::Loading) {
ctx.update();
std::this_thread::yield();
}
BOOST_REQUIRE(modelRef->resource != nullptr);
BOOST_CHECK(modelRef->resource->frames.size() > 0);
delete modelRef->resource;
}
}
#endif
BOOST_AUTO_TEST_SUITE_END()