From 952748a86c4ddf1d7e47b358a64904c35bacd4aa Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 17 Aug 2018 00:15:05 +0800 Subject: *update --- src/lua/graphics/luaopen_Canvas.cpp | 10 +++++----- src/lua/graphics/luaopen_Font.cpp | 2 +- src/lua/graphics/luaopen_Image.cpp | 12 ++++++------ src/lua/graphics/luaopen_JSL.cpp | 14 +++++++------- src/lua/graphics/luaopen_graphics.cpp | 8 ++++---- 5 files changed, 23 insertions(+), 23 deletions(-) (limited to 'src/lua/graphics') diff --git a/src/lua/graphics/luaopen_Canvas.cpp b/src/lua/graphics/luaopen_Canvas.cpp index d686a88..ca1270c 100644 --- a/src/lua/graphics/luaopen_Canvas.cpp +++ b/src/lua/graphics/luaopen_Canvas.cpp @@ -18,22 +18,22 @@ namespace lua static int l_getWidth(lua_State* L) { Ref& ref = checkCanvas(L); - luax_pushnumber(L, (*ref).getWidth()); + luax_pushnumber(L, ref->getWidth()); return 1; } static int l_getHeight(lua_State* L) { Ref& ref = checkCanvas(L); - luax_pushnumber(L, (*ref).getHeight()); + luax_pushnumber(L, ref->getHeight()); return 1; } static int l_getSize(lua_State* L) { Ref& ref = checkCanvas(L); - luax_pushnumber(L, (*ref).getWidth()); - luax_pushnumber(L, (*ref).getHeight()); + luax_pushnumber(L, ref->getWidth()); + luax_pushnumber(L, ref->getHeight()); return 2; } @@ -42,7 +42,7 @@ namespace lua Ref& ref = checkCanvas(L); int x = luax_checknumber(L, 1); int y = luax_checknumber(L, 2); - (*ref).setAnchor(x, y); + ref->setAnchor(x, y); return 0; } diff --git a/src/lua/graphics/luaopen_Font.cpp b/src/lua/graphics/luaopen_Font.cpp index 341af87..dc891b0 100644 --- a/src/lua/graphics/luaopen_Font.cpp +++ b/src/lua/graphics/luaopen_Font.cpp @@ -25,7 +25,7 @@ namespace lua int spacing = luax_checknumber(L, 4); int lheight = luax_checknumber(L, 5); int w, h; - (*ref).box(text, fheight, lheight, spacing, &w, &h); + ref->box(text, fheight, lheight, spacing, &w, &h); luax_pushnumber(L, w); luax_pushnumber(L, h); return 2; diff --git a/src/lua/graphics/luaopen_Image.cpp b/src/lua/graphics/luaopen_Image.cpp index b1672d5..47cb4c6 100644 --- a/src/lua/graphics/luaopen_Image.cpp +++ b/src/lua/graphics/luaopen_Image.cpp @@ -20,14 +20,14 @@ namespace lua static int l_getWidth(lua_State* L) { Ref& ref = checkImage(L); - luax_pushnumber(L, (*ref).getWidth()); + luax_pushnumber(L, ref->getWidth()); return 1; } static int l_getHeight(lua_State *L) { Ref& ref = checkImage(L); - luax_pushnumber(L, (*ref).getHeight()); + luax_pushnumber(L, ref->getHeight()); return 1; } @@ -36,7 +36,7 @@ namespace lua Ref& ref = checkImage(L); int x = luax_checknumber(L, 2); int y = luax_checknumber(L, 3); - color c = (*ref).getPixel(x, y); + color c = ref->getPixel(x, y); luax_pushnumber(L, c.rgba.r); luax_pushnumber(L, c.rgba.g); luax_pushnumber(L, c.rgba.b); @@ -49,15 +49,15 @@ namespace lua Ref& ref = checkImage(L); int x = luax_checknumber(L, 2); int y = luax_checknumber(L, 3); - (*ref).setAnchor(x, y); + ref->setAnchor(x, y); return 0; } static int l_getSize(lua_State* L) { Ref& ref = checkImage(L); - luax_pushnumber(L, (*ref).getWidth()); - luax_pushnumber(L, (*ref).getHeight()); + luax_pushnumber(L, ref->getWidth()); + luax_pushnumber(L, ref->getHeight()); return 2; } diff --git a/src/lua/graphics/luaopen_JSL.cpp b/src/lua/graphics/luaopen_JSL.cpp index e644c35..30b109a 100644 --- a/src/lua/graphics/luaopen_JSL.cpp +++ b/src/lua/graphics/luaopen_JSL.cpp @@ -61,28 +61,28 @@ namespace lua case NUMBER: { float number = luax_checknumber(L, 4); - (*ref).sendFloat(variable, number); + ref->sendFloat(variable, number); break; } case IMAGE: { Proxy* proxy = (Proxy*)luax_checktype(L, 4, JIN_GRAPHICS_IMAGE); Ref& tex = proxy->getRef(); - (*ref).sendTexture(variable, &(*tex)); + ref->sendTexture(variable, tex.getObject()); break; } case CANVAS: { Proxy* proxy = (Proxy*)luax_checktype(L, 4, JIN_GRAPHICS_CANVAS); Ref& canvas = proxy->getRef(); - (*ref).sendCanvas(variable, &(*canvas)); + ref->sendCanvas(variable, canvas.getObject()); break; } case VEC2: { float x = luax_checknumber(L, 4); float y = luax_checknumber(L, 5); - (*ref).sendVec2(variable, x, y); + ref->sendVec2(variable, x, y); break; } case VEC3: @@ -90,7 +90,7 @@ namespace lua float x = luax_checknumber(L, 4); float y = luax_checknumber(L, 5); float z = luax_checknumber(L, 6); - (*ref).sendVec3(variable, x, y, z); + ref->sendVec3(variable, x, y, z); break; } case VEC4: @@ -99,7 +99,7 @@ namespace lua float y = luax_checknumber(L, 5); float z = luax_checknumber(L, 6); float w = luax_checknumber(L, 7); - (*ref).sendVec4(variable, x, y, z, w); + ref->sendVec4(variable, x, y, z, w); break; } case COLOR: @@ -109,7 +109,7 @@ namespace lua col.rgba.g = luax_checkinteger(L, 5); col.rgba.b = luax_checkinteger(L, 6); col.rgba.a = luax_checkinteger(L, 7); - (*ref).sendColor(variable, &col); + ref->sendColor(variable, &col); break; } default: diff --git a/src/lua/graphics/luaopen_graphics.cpp b/src/lua/graphics/luaopen_graphics.cpp index dc8c9a1..14449a4 100644 --- a/src/lua/graphics/luaopen_graphics.cpp +++ b/src/lua/graphics/luaopen_graphics.cpp @@ -152,13 +152,13 @@ namespace lua if (luax_istype(L, 1, JIN_GRAPHICS_IMAGE)) { Proxy* proxy = (Proxy*)luax_toudata(L, 1); - Image* tex = &*proxy->getRef(); + Ref& tex = proxy->getRef(); tex->draw(x, y, sx, sy, r); } else if (luax_istype(L, 1, JIN_GRAPHICS_CANVAS)) { Proxy* proxy = (Proxy*)luax_toudata(L, 1); - Canvas* p = &*proxy->getRef(); + Ref& p = proxy->getRef(); p->draw(x, y, sx, sy, r); } else @@ -210,7 +210,7 @@ namespace lua } Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_CANVAS); Ref& ref = proxy->getRef(); - (*ref).bind(); + ref->bind(); return 0; } @@ -230,7 +230,7 @@ namespace lua if (luax_istype(L, 1, JIN_GRAPHICS_SHADER)) { Proxy* proxy = (Proxy*)luax_toudata(L, 1); - JSLProgram* jsl = &*proxy->getRef(); + Ref& jsl = proxy->getRef(); jsl->use(); } else -- cgit v1.1-26-g67d0