aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/modules/graphics')
-rw-r--r--src/lua/modules/graphics/font.cpp4
-rw-r--r--src/lua/modules/graphics/image.cpp13
-rw-r--r--src/lua/modules/graphics/jsl.cpp5
3 files changed, 13 insertions, 9 deletions
diff --git a/src/lua/modules/graphics/font.cpp b/src/lua/modules/graphics/font.cpp
index 926f2cc..042eb19 100644
--- a/src/lua/modules/graphics/font.cpp
+++ b/src/lua/modules/graphics/font.cpp
@@ -10,6 +10,8 @@ namespace lua
using namespace jin::graphics;
+ typedef Ref<Font>& FontRef;
+
static int l_gc(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_FONT);
@@ -20,7 +22,7 @@ namespace lua
static int l_box(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_FONT, sizeof(Proxy));
- Ref<Font>& ref = proxy->getRef<Font>();
+ FontRef ref = proxy->getRef<Font>();
const char* text = luax_checkstring(L, 2);
int fheight = luax_checknumber(L, 3);
int spacing = luax_checknumber(L, 4);
diff --git a/src/lua/modules/graphics/image.cpp b/src/lua/modules/graphics/image.cpp
index 5824660..3caff16 100644
--- a/src/lua/modules/graphics/image.cpp
+++ b/src/lua/modules/graphics/image.cpp
@@ -11,8 +11,9 @@ namespace lua
using namespace jin::graphics;
typedef Texture Image;
+ typedef Ref<Image>& ImageRef;
- static inline Ref<Image>& checkImage(lua_State* L)
+ static inline ImageRef checkImage(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_IMAGE);
return proxy->getRef<Image>();
@@ -20,21 +21,21 @@ namespace lua
static int l_getWidth(lua_State* L)
{
- Ref<Image>& ref = checkImage(L);
+ ImageRef ref = checkImage(L);
luax_pushnumber(L, ref->getWidth());
return 1;
}
static int l_getHeight(lua_State *L)
{
- Ref<Image>& ref = checkImage(L);
+ ImageRef ref = checkImage(L);
luax_pushnumber(L, ref->getHeight());
return 1;
}
static int l_getPixel(lua_State* L)
{
- Ref<Image>& ref = checkImage(L);
+ ImageRef ref = checkImage(L);
int x = luax_checknumber(L, 2);
int y = luax_checknumber(L, 3);
color c = ref->getPixel(x, y);
@@ -47,7 +48,7 @@ namespace lua
static int l_setAnchor(lua_State* L)
{
- Ref<Image>& ref = checkImage(L);
+ ImageRef ref = checkImage(L);
int x = luax_checknumber(L, 2);
int y = luax_checknumber(L, 3);
ref->setAnchor(x, y);
@@ -56,7 +57,7 @@ namespace lua
static int l_getSize(lua_State* L)
{
- Ref<Image>& ref = checkImage(L);
+ ImageRef ref = checkImage(L);
luax_pushnumber(L, ref->getWidth());
luax_pushnumber(L, ref->getHeight());
return 2;
diff --git a/src/lua/modules/graphics/jsl.cpp b/src/lua/modules/graphics/jsl.cpp
index ccd9ebd..58de46a 100644
--- a/src/lua/modules/graphics/jsl.cpp
+++ b/src/lua/modules/graphics/jsl.cpp
@@ -11,8 +11,9 @@ namespace lua
using namespace jin::graphics;
typedef Texture Image;
+ typedef Ref<JSLProgram>& JSLRef;
- static inline Ref<JSLProgram>& checkJSLProgram(lua_State* L)
+ static inline JSLRef checkJSLProgram(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_SHADER);
return proxy->getRef<JSLProgram>();
@@ -49,7 +50,7 @@ namespace lua
*/
static int l_send(lua_State* L)
{
- Ref<JSLProgram>& ref = checkJSLProgram(L);
+ JSLRef ref = checkJSLProgram(L);
// number Image Texel
const char* typestr = luax_checkstring(L, 2);
// variable name