aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/graphics/je_lua_bitmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/modules/graphics/je_lua_bitmap.cpp')
-rw-r--r--src/lua/modules/graphics/je_lua_bitmap.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/lua/modules/graphics/je_lua_bitmap.cpp b/src/lua/modules/graphics/je_lua_bitmap.cpp
index 8d4897b..2a35ed5 100644
--- a/src/lua/modules/graphics/je_lua_bitmap.cpp
+++ b/src/lua/modules/graphics/je_lua_bitmap.cpp
@@ -10,9 +10,9 @@ namespace JinEngine
namespace Lua
{
- typedef Shared<Bitmap>& BitmapRef;
+ typedef Shared<Bitmap>& SharedBitmap;
- LUA_IMPLEMENT inline BitmapRef checkBitmap(lua_State* L)
+ LUA_IMPLEMENT inline SharedBitmap checkBitmap(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_BITMAP);
return proxy->getShared<Bitmap>();
@@ -20,32 +20,32 @@ namespace JinEngine
LUA_IMPLEMENT int l_gc(lua_State* L)
{
- BitmapRef ref = checkBitmap(L);
- ref.release();
+ SharedBitmap shared = checkBitmap(L);
+ shared.release();
return 0;
}
LUA_IMPLEMENT int l_getWidth(lua_State* L)
{
- BitmapRef ref = checkBitmap(L);
- int w = ref->getWidth();
+ SharedBitmap shared = checkBitmap(L);
+ int w = shared->getWidth();
luax_pushinteger(L, w);
return 1;
}
LUA_IMPLEMENT int l_getHeight(lua_State* L)
{
- BitmapRef ref = checkBitmap(L);
- int h = ref->getHeight();
+ SharedBitmap shared = checkBitmap(L);
+ int h = shared->getHeight();
luax_pushinteger(L, h);
return 1;
}
LUA_IMPLEMENT int l_getSize(lua_State* L)
{
- BitmapRef ref = checkBitmap(L);
- int w = ref->getWidth();
- int h = ref->getHeight();
+ SharedBitmap shared = checkBitmap(L);
+ int w = shared->getWidth();
+ int h = shared->getHeight();
luax_pushinteger(L, w);
luax_pushinteger(L, h);
return 2;
@@ -53,10 +53,10 @@ namespace JinEngine
LUA_IMPLEMENT int l_getPixel(lua_State* L)
{
- BitmapRef ref = checkBitmap(L);
+ SharedBitmap shared = checkBitmap(L);
int x = luax_checkinteger(L, 2);
int y = luax_checkinteger(L, 3);
- Color col = ref->getPixel(x, y);
+ Color col = shared->getPixel(x, y);
luax_pushinteger(L, col.r);
luax_pushinteger(L, col.g);
luax_pushinteger(L, col.b);
@@ -66,7 +66,7 @@ namespace JinEngine
LUA_IMPLEMENT int l_setPixel(lua_State* L)
{
- BitmapRef ref = checkBitmap(L);
+ SharedBitmap shared = checkBitmap(L);
int x = luax_checkinteger(L, 2);
int y = luax_checkinteger(L, 3);
if (!luax_istable(L, 4))
@@ -78,16 +78,16 @@ namespace JinEngine
unsigned int g = luax_rawgetnumber(L, 4, 2);
unsigned int b = luax_rawgetnumber(L, 4, 3);
unsigned int a = luax_rawgetnumber(L, 4, 4);
- ref->setPixel(Color(r, g, b, a), x, y);
+ shared->setPixel(Color(r, g, b, a), x, y);
return 0;
}
LUA_IMPLEMENT int l_clone(lua_State* L)
{
- BitmapRef ref = checkBitmap(L);
- Bitmap* bitmap = ref.getObject();
+ SharedBitmap shared = checkBitmap(L);
+ Bitmap* bitmap = shared.getObject();
Bitmap* b = Bitmap::clone(bitmap);
- Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_BITMAP, sizeof(Proxy));
+ Proxy* proxy = luax_newinstance(L, JIN_GRAPHICS_BITMAP);
proxy->bind(new Shared<Bitmap>(b, JIN_GRAPHICS_BITMAP));
return 1;
}