summaryrefslogtreecommitdiff
path: root/src/resources/resourcemanager.h
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-11-20 12:27:56 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-11-20 12:27:56 +0000
commitca58ec1faedca0081ecd233f2cefa1ba783cebf4 (patch)
tree11216c01bb8867a9bd4ad6d4b8bdefc3c61a952a /src/resources/resourcemanager.h
parent5a7abdafdac8f6ddd7972cadbc7e20563a0a29fc (diff)
downloadMana-ca58ec1faedca0081ecd233f2cefa1ba783cebf4.tar.gz
Mana-ca58ec1faedca0081ecd233f2cefa1ba783cebf4.tar.bz2
Mana-ca58ec1faedca0081ecd233f2cefa1ba783cebf4.tar.xz
Mana-ca58ec1faedca0081ecd233f2cefa1ba783cebf4.zip
Merged revisions 3642,3662-3664,3667 via svnmerge from
https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/trunk ........ r3642 | gmelquio | 2007-10-19 19:46:46 +0200 (Fri, 19 Oct 2007) | 1 line Factored code between resource handlers. Implemented failure-friendly sprite loader. ........ r3662 | gmelquio | 2007-10-21 21:01:16 +0200 (Sun, 21 Oct 2007) | 1 line Added persistent positioning. ........ r3663 | gmelquio | 2007-10-21 21:03:43 +0200 (Sun, 21 Oct 2007) | 1 line Fixed missing pixels at bottom and right. ........ r3664 | gmelquio | 2007-10-21 21:05:56 +0200 (Sun, 21 Oct 2007) | 1 line Changed to use default values when restoring missing settings. ........ r3667 | gmelquio | 2007-10-21 22:09:08 +0200 (Sun, 21 Oct 2007) | 1 line Fixed invisible text in dropboxes and shopboxes. ........
Diffstat (limited to 'src/resources/resourcemanager.h')
-rw-r--r--src/resources/resourcemanager.h34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index db29e6d3..150b773c 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -42,18 +42,8 @@ class SpriteDef;
class ResourceManager
{
public:
- /**
- * An enumeration of resource types.
- */
- enum E_RESOURCE_TYPE
- {
- //MAP,
- MUSIC,
- IMAGE,
- //SCRIPT,
- //TILESET,
- SOUND_EFFECT
- };
+ typedef Resource *(*loader)(void *, unsigned);
+ typedef Resource *(*generator)(void *);
/**
* Constructor.
@@ -109,17 +99,25 @@ class ResourceManager
isDirectory(const std::string &path);
/**
- * Creates a resource and adds it to the resource map. The idPath is
- * converted into the appropriate path for the current operating system
- * and the resource is loaded.
+ * Creates a resource and adds it to the resource map.
*
- * @param type The type of resource to load.
* @param idPath The resource identifier path.
+ * @param fun A function for generating the resource.
+ * @param data Extra parameters for the generator.
+ * @return A valid resource or <code>NULL</code> if the resource could
+ * not be generated.
+ */
+ Resource *get(std::string const &idPath, generator fun, void *data);
+
+ /**
+ * Loads a resource from a file and adds it to the resource map.
+ *
+ * @param path The file name.
+ * @param fun A function for parsing the file.
* @return A valid resource or <code>NULL</code> if the resource could
* not be loaded.
*/
- Resource*
- get(const E_RESOURCE_TYPE &type, const std::string &idPath);
+ Resource *load(std::string const &path, loader fun);
/**
* Convenience wrapper around ResourceManager::get for loading