libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
moResourcePlugin.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moResourcePlugin.h
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28 
29 
30 *******************************************************************************/
31 
32 #include "moBasePlugin.h"
33 #include "moResourceManager.h"
34 
35 #ifndef __MO_RESOURCE_PLUGIN_H__
36 #define __MO_RESOURCE_PLUGIN_H__
37 
38 class LIBMOLDEO_API moResourceFactory
39 {
40 public:
41  moResourceFactory() {}
42  virtual ~moResourceFactory();
43  virtual moResource* Create(void) = 0;
44  virtual void Destroy(moResource* fx) = 0;
45 };
46 
47 typedef moResourceFactory*(MO_PLG_ENTRY *CreateResourceFactoryFunction)();
48 typedef void(MO_PLG_ENTRY *DestroyResourceFactoryFunction)();
49 
50 class LIBMOLDEO_API moResourcePlugin
51 {
52 public:
53  moResource **array;
54  int n;
55 
56  CreateResourceFactoryFunction CreateResourceFactory;
57  DestroyResourceFactoryFunction DestroyResourceFactory;
58 
59  moResourceFactory* m_factory;
60 
61  moResourcePlugin() { handle = NULL; n=0; array = NULL; m_factory = NULL; }
62  moResourcePlugin(moText plugin_file) { m_factory = NULL; handle = NULL; n = 0; array = NULL; Load(plugin_file); }
63  virtual ~moResourcePlugin() { if(handle != NULL) Unload(); }
64 
65  void Load(moText plugin_file);
66  void Unload();
67  moResource* Create();
68  bool Destroy(moResource *Resource);
69  moText GetName() { return name; }
70 private:
71  moText name;
72  MOpluginHandle handle;
73 };
74 
75 moDeclareExportedDynamicArray(moResourcePlugin*, moResourcePluginsArray);
76 
77 LIBMOLDEO_API moResource* moNewResource(moText resource_name, moResourcePluginsArray &plugins);
78 LIBMOLDEO_API bool moDeleteResource(moResource* Resource, moResourcePluginsArray &plugins);
79 
80 #endif
81 
Recurso ( objeto para cargar y manipular objetos físicos de datos de imágenes, audio, video, 3d, 2d, fuentes, shaders y de cualquier otro tipo extendible por un plugin )
LIBMOLDEO_API bool moDeleteResource(moResource *Resource, moResourcePluginsArray &plugins)
#define LIBMOLDEO_API
Definition: moTypes.h:180
#define MO_PLG_ENTRY
Definition: moBasePlugin.h:46
clase de para manejar textos
Definition: moText.h:75
void * MOpluginHandle
Definition: moBasePlugin.h:44
#define moDeclareExportedDynamicArray(T, name)
Definition: moArrayH.h:278
LIBMOLDEO_API moResource * moNewResource(moText resource_name, moResourcePluginsArray &plugins)