OPcman.h

OPresourceFile

  • OPfile resourceFile
  • ui16 headerSize
  • ui16 resourceCount
  • OPchar* resourceNames
  • ui32* resourceOffset
  • ui32* resourceSize

OPassetLoader

  • Extension
  • const OPchar* AssetTypePath
  • OPint AssetSize
  • OPint() Load
  • OPint() Unload
  • OPint() Reload

OPasset

  • void* Asset
  • OPint() Unload
  • OPint Dirty

Globals

  • OPhashMap OP_CMAN_HASHMAP
  • OPassetLoader* OP_CMAN_ASSETLOADERS
  • OPint OP_CMAN_ASSET_LOADER_COUNT
  • OPlinkedList* OP_CMAN_PURGE
  • OP_CMAN_RESOURCE_FILES

Functions

  • void OPcmanUpdate ( OPtimer* timer )
*Debug Only*
Watches the files of loaded resources for changes
Looks at Last Write Time for each file once every second
When a change happens the Reload method is called
  • void OPcmanAddLoader ( OPassetLoader* loader )
Adds a loader to be used when OPcmanInit is called
  • OPint OPcmanInit ( const OPchar* dir )
Initializes the Content Manager with an array of Asset Loaders
A custom directoy can be provided otherwise it defaults to assets/
  • OPint OPcmanPurge ( )
Unloads all assets that are no longer needed (marked deleted)
Assets that are no longer needed have been deleted with OPcmanDelete
  • OPint OPcmanIsLoaded ( const OPchar* key )
checks to see if an asset is loaded, triggers the load or unload.
  • OPint OPcmanLoad ( const OPchar* key )
Attempts to load an asset
  • OPint OPcmanUnload ( const OPchar* key )
Unloads a resource
  • void* OPcmanGet ( const OPchar* key )
Returns a pointer to the resource requested by file name
  • void* OPcmanLoadGet ( const OPchar* key )
Loads a resource and returns a pointer to the resource requested
  • OPint OPcmanDelete ( const OPchar* key )
Marks an asset as ready to delete
It will only be removed from memory when OPcmanPurge is called
  • void OPcmanDestroy ( )
Marks an asset as ready to delete
It will only be removed from memory when OPcmanPurge is called
  • OPint OPcmanSetDir ( OPchar* dir )
  • void OPcmanLoadResourcePack ( const OPchar* filename )
Loads a Resource Pack into the OPcman
The header data is loaded into memory, but the individual resources will be loaded
at request. The FILE handle will remain open until the Resource Pack is unloaded.
  • OPstream* OPcmanGetResource ( const OPchar* resourceName )
Gets an asset OPstream out of a Resource Pack that has been loaded
It will look in Resource Packs in the order they were loaded. If no
resource could be found, it will return NULL