rag
graphic 2d engine
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
rag::Resource Class Referenceabstract

Abstract class the represent a game Resource, typically something costly to loaded. More...

#include <ResourceMgr.h>

Inheritance diagram for rag::Resource:
rag::Image

Public Types

enum  State { Enqueued = 0, LoadingInBackground, BackgroundLoaded, Ready }
 List of possible states for a Resource.
 

Public Member Functions

virtual void loadInBackground ()=0
 CPU intensive load goes here.
 
virtual void loadSync ()=0
 Load that must be synchronized with the main thread.
 
void acquire ()
 Prevents the Resource to be deleted until it's release()'d.
 
void release ()
 Releases the Resource, so it can be deleted.
 

Public Attributes

State state
 Current state.
 
std::string resourceName
 Resource unique name. Usually the file name.
 
int memorySize
 Size of the Resource in memory measured in bytes.
 

Friends

class ResourceMgr
 

Detailed Description

Abstract class the represent a game Resource, typically something costly to loaded.

Resources are treated as if they were memory and CPU intensive. There are methods to load asynchronously a Resource.

See also
ResourceMgr.

The documentation for this class was generated from the following file: