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
@@ -323,7 +323,12 @@ namespace opengl
{
Image * image = luax_checktype<Image>(L, 1, "Image", GRAPHICS_IMAGE_T);
int size = luaL_optint(L, 2, 1000);
int usage = luaL_optint(L, 3, SpriteBatch::USAGE_DYNAMIC);
SpriteBatch::UsageHint usage = SpriteBatch::USAGE_DYNAMIC;
if (lua_gettop(L) > 2)
{
if (!SpriteBatch::getConstant(luaL_checkstring(L, 3), usage))
usage = SpriteBatch::USAGE_DYNAMIC;
}
SpriteBatch * t = NULL;
try {
t = instance->newSpriteBatch(image, size, usage);