mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
Apply patch for issue #219
This commit is contained in:
@@ -171,6 +171,13 @@ namespace opengl
|
|||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpriteBatch::setImage(Image * newimage)
|
||||||
|
{
|
||||||
|
image->release();
|
||||||
|
image = newimage;
|
||||||
|
image->retain();
|
||||||
|
}
|
||||||
|
|
||||||
void SpriteBatch::draw(float x, float y, float angle, float sx, float sy, float ox, float oy) const
|
void SpriteBatch::draw(float x, float y, float angle, float sx, float sy, float ox, float oy) const
|
||||||
{
|
{
|
||||||
static Matrix t;
|
static Matrix t;
|
||||||
|
|||||||
@@ -96,6 +96,8 @@ namespace opengl
|
|||||||
void * lock();
|
void * lock();
|
||||||
void unlock();
|
void unlock();
|
||||||
|
|
||||||
|
void setImage(Image * newimage);
|
||||||
|
|
||||||
// Implements Drawable.
|
// Implements Drawable.
|
||||||
void draw(float x, float y, float angle, float sx, float sy, float ox, float oy) const;
|
void draw(float x, float y, float angle, float sx, float sy, float ox, float oy) const;
|
||||||
|
|
||||||
|
|||||||
@@ -81,12 +81,21 @@ namespace opengl
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int w_SpriteBatch_setImage(lua_State * L)
|
||||||
|
{
|
||||||
|
SpriteBatch * t = luax_checkspritebatch(L, 1);
|
||||||
|
Image * image = luax_checktype<Image>(L, 2, "Image", GRAPHICS_IMAGE_T);
|
||||||
|
t->setImage(image);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const luaL_Reg functions[] = {
|
static const luaL_Reg functions[] = {
|
||||||
{ "add", w_SpriteBatch_add },
|
{ "add", w_SpriteBatch_add },
|
||||||
{ "addq", w_SpriteBatch_addq },
|
{ "addq", w_SpriteBatch_addq },
|
||||||
{ "clear", w_SpriteBatch_clear },
|
{ "clear", w_SpriteBatch_clear },
|
||||||
{ "lock", w_SpriteBatch_lock },
|
{ "lock", w_SpriteBatch_lock },
|
||||||
{ "unlock", w_SpriteBatch_unlock },
|
{ "unlock", w_SpriteBatch_unlock },
|
||||||
|
{ "setImage", w_SpriteBatch_setImage },
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -97,4 +106,4 @@ namespace opengl
|
|||||||
|
|
||||||
} // opengl
|
} // opengl
|
||||||
} // graphics
|
} // graphics
|
||||||
} // love
|
} // love
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ namespace opengl
|
|||||||
int w_SpriteBatch_clear(lua_State * L);
|
int w_SpriteBatch_clear(lua_State * L);
|
||||||
int w_SpriteBatch_lock(lua_State * L);
|
int w_SpriteBatch_lock(lua_State * L);
|
||||||
int w_SpriteBatch_unlock(lua_State * L);
|
int w_SpriteBatch_unlock(lua_State * L);
|
||||||
|
int w_SpriteBatch_setImage(lua_State * L);
|
||||||
|
|
||||||
int luaopen_spritebatch(lua_State * L);
|
int luaopen_spritebatch(lua_State * L);
|
||||||
|
|
||||||
} // opengl
|
} // opengl
|
||||||
|
|||||||
Reference in New Issue
Block a user