diff --git a/changes.txt b/changes.txt index 18189a158..8d02533d6 100644 --- a/changes.txt +++ b/changes.txt @@ -19,13 +19,13 @@ LOVE 0.9.0 [] * Added boolean support to Shader:send. * Added Canvas:getPixel. * Added blend mode "replace". - * Added SpriteBatch:isEmpty and SpriteBatch:isFull. * Added Geometry objects (replaces Quads), allowing for arbitrary textured polygons. * Added love.graphics.setCanvases (multiple render targets.) * Added love.graphics.setColorMask. * Added love.graphics.setAlphaTest. * Added love.graphics.origin. * Added love.graphics.getRendererInfo. + * Added SpriteBatch:getCount and SpriteBatch:getBufferSize. * Added ParticleSystem:emit. * Added many ParticleSystem getter methods. * Added DXT-compressed texture support via love.image.newCompressedData. diff --git a/src/modules/graphics/opengl/SpriteBatch.cpp b/src/modules/graphics/opengl/SpriteBatch.cpp index aa8520cc4..c852f9c87 100644 --- a/src/modules/graphics/opengl/SpriteBatch.cpp +++ b/src/modules/graphics/opengl/SpriteBatch.cpp @@ -193,14 +193,14 @@ void SpriteBatch::setColor() color = 0; } -bool SpriteBatch::isEmpty() const +int SpriteBatch::getCount() const { - return next == 0; + return next; } -bool SpriteBatch::isFull() const +int SpriteBatch::getBufferSize() const { - return next >= size; + return size; } void SpriteBatch::draw(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky) const diff --git a/src/modules/graphics/opengl/SpriteBatch.h b/src/modules/graphics/opengl/SpriteBatch.h index 5c60b8c71..811a48b64 100644 --- a/src/modules/graphics/opengl/SpriteBatch.h +++ b/src/modules/graphics/opengl/SpriteBatch.h @@ -87,14 +87,14 @@ public: void setColor(); /** - * Returns whether the SpriteBatch is empty of sprites or not. + * Get the number of sprites currently in this SpriteBatch. **/ - bool isEmpty() const; + int getCount() const; /** - * Returns whether the amount of sprites has reached the buffer limit or not. + * Get the total number of sprites this SpriteBatch can hold. **/ - bool isFull() const; + int getBufferSize() const; // Implements Drawable. void draw(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky) const; diff --git a/src/modules/graphics/opengl/wrap_SpriteBatch.cpp b/src/modules/graphics/opengl/wrap_SpriteBatch.cpp index 3aa50517f..af18029b1 100644 --- a/src/modules/graphics/opengl/wrap_SpriteBatch.cpp +++ b/src/modules/graphics/opengl/wrap_SpriteBatch.cpp @@ -197,17 +197,17 @@ int w_SpriteBatch_setColor(lua_State *L) return 0; } -int w_SpriteBatch_isEmpty(lua_State *L) +int w_SpriteBatch_getCount(lua_State *L) { SpriteBatch *t = luax_checkspritebatch(L, 1); - luax_pushboolean(L, t->isEmpty()); + lua_pushinteger(L, t->getCount()); return 1; } -int w_SpriteBatch_isFull(lua_State *L) +int w_SpriteBatch_getBufferSize(lua_State *L) { SpriteBatch *t = luax_checkspritebatch(L, 1); - luax_pushboolean(L, t->isFull()); + lua_pushinteger(L, t->getBufferSize()); return 1; } @@ -223,8 +223,8 @@ static const luaL_Reg functions[] = { "setImage", w_SpriteBatch_setImage }, { "getImage", w_SpriteBatch_getImage }, { "setColor", w_SpriteBatch_setColor }, - { "isEmpty", w_SpriteBatch_isEmpty }, - { "isFull", w_SpriteBatch_isFull }, + { "getCount", w_SpriteBatch_getCount }, + { "getBufferSize", w_SpriteBatch_getBufferSize }, { 0, 0 } }; diff --git a/src/modules/graphics/opengl/wrap_SpriteBatch.h b/src/modules/graphics/opengl/wrap_SpriteBatch.h index 4b98c06e5..c726df378 100644 --- a/src/modules/graphics/opengl/wrap_SpriteBatch.h +++ b/src/modules/graphics/opengl/wrap_SpriteBatch.h @@ -42,8 +42,8 @@ int w_SpriteBatch_unbind(lua_State *L); int w_SpriteBatch_setImage(lua_State *L); int w_SpriteBatch_getImage(lua_State *L); int w_SpriteBatch_setColor(lua_State *L); -int w_SpriteBatch_isEmpty(lua_State *L); -int w_SpriteBatch_isFull(lua_State *L); +int w_SpriteBatch_getCount(lua_State *L); +int w_SpriteBatch_getBufferSize(lua_State *L); extern "C" int luaopen_spritebatch(lua_State *L);