le3d - LightEngine 3D
A straightforward C++ 3D software engine for real-time graphics
bmpcache.h
Go to the documentation of this file.
1 
33 #ifndef LE_BMPCACHE_H
34 #define LE_BMPCACHE_H
35 
36 #include "global.h"
37 #include "config.h"
38 
39 #include "bitmap.h"
40 
41 /*****************************************************************************/
46 typedef enum{
47  LE_BMPCACHE_RGB = 0x00,
52 
53 /*****************************************************************************/
59 {
60 public:
61  LeBmpCache();
62  ~LeBmpCache();
63 
64  void clean();
65 
66  void loadDirectory(const char * path);
67  LeBitmap * loadBMP(const char * path);
68 
69  int getSlotFromName(const char * name);
70  LeBitmap * getBitmapFromName(const char * name);
71 
72 public:
77  typedef struct{
79  char path[LE_MAX_FILE_PATH+1];
80  char name[LE_MAX_FILE_NAME+1];
81  int flags;
84  int noExtras;
85  int cursor;
86  }Slot;
87 
89  int noSlots;
91 private:
92  int createSlot(LeBitmap * bitmap, const char * path);
93  void deleteSlot(int slot);
94 };
95 
96 extern LeBmpCache bmpCache;
97 
98 #endif // LE_BMPCACHE_H
LeBmpCache bmpCache
Definition: bmpcache.cpp:50
#define LE_MAX_FILE_NAME
Definition: config.h:40
#define LE_BMPCACHE_SLOTS
Definition: config.h:47
int getSlotFromName(const char *name)
Retrieve a bitmap slot index from a bitmap name or path.
Definition: bmpcache.cpp:207
int noExtras
Definition: bmpcache.h:84
~LeBmpCache()
Definition: bmpcache.cpp:75
LeBitmap * bitmap
Definition: bmpcache.h:78
LightEngine 3D: General engine configuration file.
Definition: bmpcache.h:48
Cache and inventory all bitmaps loaded.
Definition: bmpcache.h:58
LightEngine 3D: Global helpers and definitions.
int flags
Definition: bmpcache.h:81
Definition: bmpcache.h:50
represents a bitmap cache slot
Definition: bmpcache.h:77
void clean()
Unload all resources in cache and remove entries.
Definition: bmpcache.cpp:85
LE_BMPCACHE_FLAGS
Bitmap cache slot flags.
Definition: bmpcache.h:46
int noSlots
Definition: bmpcache.h:89
LeBmpCache()
Definition: bmpcache.cpp:53
Contain and manage a RGB or RGBA 32bit bitmap image.
Definition: bitmap.h:58
LeBitmap * extras
Definition: bmpcache.h:83
Definition: bmpcache.h:49
void loadDirectory(const char *path)
Load in cache all the recognized bitmap files from the given directory.
Definition: bmpcache.cpp:132
LeBitmap * loadBMP(const char *path)
Load a BMP file of given path and apply transforms.
Definition: bmpcache.cpp:99
LightEngine 3D: Bitmap image container & manipulator.
Definition: bmpcache.h:47
int cursor
Definition: bmpcache.h:85
Slot cacheSlots[LE_BMPCACHE_SLOTS]
Definition: bmpcache.h:88
LeBitmap * getBitmapFromName(const char *name)
Retrieve a bitmap object from its name or path.
Definition: bmpcache.cpp:231
#define LE_MAX_FILE_PATH
Definition: config.h:41