Add string mapping for spritebatch usage parameter (issue #264)

This commit is contained in:
Bart van Strien
2011-08-24 12:11:08 +02:00
parent f0dad41f39
commit b14ca78109
3 changed files with 34 additions and 3 deletions
+10 -2
View File
@@ -29,6 +29,7 @@
#include <common/Object.h>
#include <common/Vector.h>
#include <common/Matrix.h>
#include <common/StringMap.h>
#include <graphics/Drawable.h>
#include <graphics/Volatile.h>
#include <graphics/Color.h>
@@ -73,9 +74,10 @@ namespace opengl
enum UsageHint
{
USAGE_DYNAMIC,
USAGE_DYNAMIC = 1,
USAGE_STATIC,
USAGE_STREAM
USAGE_STREAM,
USAGE_MAX_ENUM
};
SpriteBatch(Image * image, int size, int usage);
@@ -108,6 +110,9 @@ namespace opengl
// Implements Drawable.
void draw(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky) const;
static bool getConstant(const char * in, UsageHint & out);
static bool getConstant(UsageHint in, const char *& out);
private:
void addv(const vertex * v);
@@ -121,6 +126,9 @@ namespace opengl
*/
void setColorv(vertex * v, const Color & color);
static StringMap<UsageHint, USAGE_MAX_ENUM>::Entry usageHintEntries[];
static StringMap<UsageHint, USAGE_MAX_ENUM> usageHints;
}; // SpriteBatch
} // opengl