aboutsummaryrefslogtreecommitdiff
path: root/src/lua
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-07-25 20:27:55 +0800
committerchai <chaifix@163.com>2018-07-25 20:27:55 +0800
commit0371f99359d1f58dbec6353234c2b1ebd86a7585 (patch)
tree59da821f194dd067e8bf196ebe422712cd975346 /src/lua
parent128b6dd3e3a803e475ec03493ee26e6b20d7e42b (diff)
*image->texture
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/graphics/luaopen_Image.cpp16
-rw-r--r--src/lua/graphics/luaopen_JSL.cpp4
-rw-r--r--src/lua/graphics/luaopen_graphics.cpp6
3 files changed, 13 insertions, 13 deletions
diff --git a/src/lua/graphics/luaopen_Image.cpp b/src/lua/graphics/luaopen_Image.cpp
index c5648a5..d651e20 100644
--- a/src/lua/graphics/luaopen_Image.cpp
+++ b/src/lua/graphics/luaopen_Image.cpp
@@ -9,31 +9,31 @@ namespace jin
namespace lua
{
- static inline Image* checkImage(lua_State* L)
+ static inline Texture* checkTexture(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_checktype(L, 1, TYPE_IMAGE);
if (proxy != 0 && proxy != nullptr)
- return (Image*)proxy->object;
+ return (Texture*)proxy->object;
return nullptr;
}
static int l_getWidth(lua_State* L)
{
- Image* i = checkImage(L);
+ Texture* i = checkTexture(L);
luax_pushnumber(L, i->getWidth());
return 1;
}
static int l_getHeight(lua_State *L)
{
- Image* i = checkImage(L);
+ Texture* i = checkTexture(L);
luax_pushnumber(L, i->getHeight());
return 1;
}
static int l_getPixel(lua_State* L)
{
- Image* i = checkImage(L);
+ Texture* i = checkTexture(L);
int x = luax_checknumber(L, 2);
int y = luax_checknumber(L, 3);
color c = i->getPixel(x, y);
@@ -46,7 +46,7 @@ namespace lua
static int l_setAnchor(lua_State* L)
{
- Image* i = checkImage(L);
+ Texture* i = checkTexture(L);
int x = luax_checknumber(L, 2);
int y = luax_checknumber(L, 3);
i->setAnchor(x, y);
@@ -55,7 +55,7 @@ namespace lua
static int l_getSize(lua_State* L)
{
- Image* i = checkImage(L);
+ Texture* i = checkTexture(L);
luax_pushnumber(L, i->getWidth());
luax_pushnumber(L, i->getHeight());
return 2;
@@ -64,7 +64,7 @@ namespace lua
static int l_gc(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_checktype(L, 1, TYPE_IMAGE);
- Image* img = (Image*)proxy->object;
+ Texture* img = (Texture*)proxy->object;
delete img;
return 0;
}
diff --git a/src/lua/graphics/luaopen_JSL.cpp b/src/lua/graphics/luaopen_JSL.cpp
index 236d8a6..5289a43 100644
--- a/src/lua/graphics/luaopen_JSL.cpp
+++ b/src/lua/graphics/luaopen_JSL.cpp
@@ -67,8 +67,8 @@ namespace lua
case IMAGE:
{
Proxy* proxy = (Proxy*)luax_checktype(L, 4, TYPE_IMAGE);
- Image* img = (Image*)proxy->object;
- jsl->sendImage(variable, img);
+ Texture* tex = (Texture*)proxy->object;
+ jsl->sendTexture(variable, tex);
break;
}
case CANVAS:
diff --git a/src/lua/graphics/luaopen_graphics.cpp b/src/lua/graphics/luaopen_graphics.cpp
index 44b0a2c..be40247 100644
--- a/src/lua/graphics/luaopen_graphics.cpp
+++ b/src/lua/graphics/luaopen_graphics.cpp
@@ -72,7 +72,7 @@ namespace lua
fs->read(f, &b);
Proxy* proxy = (Proxy*)luax_newinstance(L, TYPE_IMAGE, sizeof(Proxy));
- Image* img = Image::createImage(b.data, b.size);
+ Texture* img = Texture::createTexture(b.data, b.size);
proxy->bind(img);
return 1;
}
@@ -142,8 +142,8 @@ namespace lua
if (luax_istype(L, 1, TYPE_IMAGE))
{
Proxy* proxy = (Proxy*)luax_toudata(L, 1);
- Image* img = (Image*)proxy->object;
- img->draw(x, y, sx, sy, r);
+ Texture* tex = (Texture*)proxy->object;
+ tex->draw(x, y, sx, sy, r);
}
else if (luax_istype(L, 1, TYPE_CANVAS))
{