载入中...
搜索中...
未找到

Resource is a game object that is managed by the ResourceManager. It can be loaded from a file or generated at runtime. If the resource is loaded from file, a monitor will be created to watch the file changes. When the file is modified, the resource will be reloaded. If the resource is generated at runtime, it can depend on a few other resources and the ResourceManager will update the resource when the dependencies are changed. 更多...

#include <Resource.h>

类 eve::Resource 继承关系图:
eve::Object eve::font::FontData eve::image::ImageData eve::model3d::ModelData eve::sound::SoundData

Public 成员函数

virtual ~Resource ()
 
std::string getUri () const
 
std::vector< eve::ref< Resource > > getDependencies () const
 
virtual void addDependency (eve::ref< Resource > resource)
 
virtual void adopt (eve::Resource &replacement)=0
 Replace this instance's contents with replacement's. The ResourceManager keeps instance identity stable across reloads, so existing holders (raw pointers, refs, script instances) keep a valid object. Subclasses move the payload out of replacement, which is drained and destroyed by the caller afterwards. replacement must be the same concrete type as this.
 
- Public 成员函数 继承自 eve::Object
 Object ()
 
void setUpdate (Object *update)
 Update the current object with a replacement. You don't need to care about the reference to the old object since it will be automatically updated in the ref smart pointer.
 

Protected 成员函数

 Resource (std::string uri)
 
void setUri (std::string value)
 Set the resource URI (the cache key). Used by ResourceManager.
 
- Protected 成员函数 继承自 eve::Object
virtual ~Object ()
 
bool isDirty () const
 
ObjectgetUpdate () const
 
void ref ()
 
void unref ()
 

Protected 属性

std::string uri
 
std::vector< eve::ref< Resource > > dependencies
 
- Protected 属性 继承自 eve::Object
Objectupdate
 
unsigned ref_count = 0
 

友元

class ResourceManager
 

详细描述

Resource is a game object that is managed by the ResourceManager. It can be loaded from a file or generated at runtime. If the resource is loaded from file, a monitor will be created to watch the file changes. When the file is modified, the resource will be reloaded. If the resource is generated at runtime, it can depend on a few other resources and the ResourceManager will update the resource when the dependencies are changed.

Resource ID format:

The ResourceManager cache keys file-backed resources by their normalized VFS path, optionally with ?param=value suffixes for parameters that change the decoded asset (e.g. a font's pixel size). See ResourceManager::makeKey.

在文件 Resource.h35 行定义.

构造及析构函数说明

◆ ~Resource()

virtual eve::Resource::~Resource ( )
inlinevirtual

在文件 Resource.h37 行定义.

◆ Resource()

eve::Resource::Resource ( std::string  uri)
inlineprotected

在文件 Resource.h55 行定义.

成员函数说明

◆ addDependency()

virtual void eve::Resource::addDependency ( eve::ref< Resource resource)
inlinevirtual

在文件 Resource.h42 行定义.

引用了 dependencies.

◆ adopt()

virtual void eve::Resource::adopt ( eve::Resource replacement)
pure virtual

Replace this instance's contents with replacement's. The ResourceManager keeps instance identity stable across reloads, so existing holders (raw pointers, refs, script instances) keep a valid object. Subclasses move the payload out of replacement, which is drained and destroyed by the caller afterwards. replacement must be the same concrete type as this.

eve::font::FontData, eve::image::ImageData, eve::model3d::ModelData , 以及 eve::sound::SoundData 内被实现.

被这些函数引用 eve::ResourceManager::refreshEntry().

◆ getDependencies()

std::vector< eve::ref< Resource > > eve::Resource::getDependencies ( ) const
inline

在文件 Resource.h40 行定义.

引用了 dependencies.

◆ getUri()

std::string eve::Resource::getUri ( ) const
inline

在文件 Resource.h39 行定义.

引用了 uri.

◆ setUri()

void eve::Resource::setUri ( std::string  value)
inlineprotected

Set the resource URI (the cache key). Used by ResourceManager.

在文件 Resource.h58 行定义.

引用了 uri , 以及 value.

被这些函数引用 eve::ResourceManager::get().

友元及相关函数文档

◆ ResourceManager

friend class ResourceManager
friend

在文件 Resource.h60 行定义.

类成员变量说明

◆ dependencies

std::vector<eve::ref<Resource> > eve::Resource::dependencies
protected

在文件 Resource.h63 行定义.

被这些函数引用 addDependency() , 以及 getDependencies().

◆ uri

std::string eve::Resource::uri
protected

在文件 Resource.h62 行定义.

被这些函数引用 getUri() , 以及 setUri().


该类的文档由以下文件生成: