Added SpriteBatch:getCount and SpriteBatch:getBufferSize, and removed SpriteBatch:isEmpty/isFull.

This commit is contained in:
Alex Szpakowski
2013-05-22 18:44:40 -03:00
parent 264948690c
commit 0b71fa1483
5 changed files with 17 additions and 17 deletions
+1 -1
View File
@@ -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.
+4 -4
View File
@@ -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
+4 -4
View File
@@ -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;
@@ -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 }
};
@@ -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);