45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
// Copyright (c) 2022 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#pragma once
|
|
#include "state/StateEvent.hpp"
|
|
|
|
namespace Dawn {
|
|
class AssetManager;
|
|
|
|
class Asset {
|
|
public:
|
|
const std::string name;
|
|
bool_t loaded = false;
|
|
Event<> eventLoaded;
|
|
StateEvent<> event2Loaded;
|
|
|
|
/**
|
|
* Create an abstract Asset object.
|
|
*
|
|
* @param name Name of the asset.
|
|
*/
|
|
Asset(const std::string name);
|
|
|
|
/**
|
|
* Virtual function that will be called by the asset manager on a
|
|
* synchronous basis. This will only trigger if the blocks are false and
|
|
* the loaded is also false.
|
|
*/
|
|
virtual void updateSync() = 0;
|
|
|
|
/**
|
|
* Virtual function called by the asset manager asynchronously every tick.
|
|
* This will only trigger if blocks are false and the loaded state is also
|
|
* false.
|
|
*/
|
|
virtual void updateAsync() = 0;
|
|
|
|
/**
|
|
* Dispose the asset item.
|
|
*/
|
|
virtual ~Asset();
|
|
};
|
|
} |