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/je_lua_bitmap.cpp23
-rw-r--r--src/lua/modules/graphics/je_lua_canvas.cpp16
-rw-r--r--src/lua/modules/graphics/je_lua_graphics.cpp92
-rw-r--r--src/lua/modules/graphics/je_lua_page.cpp15
-rw-r--r--src/lua/modules/graphics/je_lua_shader.cpp23
-rw-r--r--src/lua/modules/graphics/je_lua_text.cpp9
-rw-r--r--src/lua/modules/graphics/je_lua_texture.cpp17
-rw-r--r--src/lua/modules/graphics/je_lua_texture_font.cpp13
-rw-r--r--src/lua/modules/graphics/je_lua_ttf.cpp11
-rw-r--r--src/lua/modules/graphics/je_lua_ttf_data.cpp12
10 files changed, 112 insertions, 119 deletions
diff --git a/src/lua/modules/graphics/je_lua_bitmap.cpp b/src/lua/modules/graphics/je_lua_bitmap.cpp
index 2a35ed5..1491bee 100644
--- a/src/lua/modules/graphics/je_lua_bitmap.cpp
+++ b/src/lua/modules/graphics/je_lua_bitmap.cpp
@@ -91,20 +91,19 @@ namespace JinEngine
proxy->bind(new Shared<Bitmap>(b, JIN_GRAPHICS_BITMAP));
return 1;
}
-
- LUA_IMPLEMENT const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "getWidth", l_getWidth },
- { "getHeight", l_getHeight },
- { "getSize", l_getSize },
- { "getPixel", l_getPixel },
- { "setPixel", l_setPixel },
- { "clone", l_clone },
- { 0, 0 }
- };
-
+
LUA_EXPORT int luaopen_Bitmap(lua_State* L)
{
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "getWidth", l_getWidth },
+ { "getHeight", l_getHeight },
+ { "getSize", l_getSize },
+ { "getPixel", l_getPixel },
+ { "setPixel", l_setPixel },
+ { "clone", l_clone },
+ { 0, 0 }
+ };
luax_newtype(L, JIN_GRAPHICS_BITMAP, f);
return 0;
}
diff --git a/src/lua/modules/graphics/je_lua_canvas.cpp b/src/lua/modules/graphics/je_lua_canvas.cpp
index 42570b2..8d8630f 100644
--- a/src/lua/modules/graphics/je_lua_canvas.cpp
+++ b/src/lua/modules/graphics/je_lua_canvas.cpp
@@ -47,17 +47,17 @@ namespace JinEngine
return 0;
}
- LUA_IMPLEMENT const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "getWidth", l_getWidth },
- { "getHeight", l_getHeight },
- { "getSize", l_getSize },
- { 0, 0 }
- };
-
LUA_EXPORT int luaopen_Canvas(lua_State* L)
{
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "getWidth", l_getWidth },
+ { "getHeight", l_getHeight },
+ { "getSize", l_getSize },
+ { 0, 0 }
+ };
luax_newtype(L, JIN_GRAPHICS_CANVAS, f);
+
return 0;
}
diff --git a/src/lua/modules/graphics/je_lua_graphics.cpp b/src/lua/modules/graphics/je_lua_graphics.cpp
index 3ff5710..3155aa0 100644
--- a/src/lua/modules/graphics/je_lua_graphics.cpp
+++ b/src/lua/modules/graphics/je_lua_graphics.cpp
@@ -738,52 +738,6 @@ namespace JinEngine
return 0;
}
- LUA_IMPLEMENT const luaL_Reg f[] = {
- /* window */
- { "init", l_init },
- { "setTitle", l_setTitle },
- { "getSize", l_getSize },
- { "getWidth", l_getWidth },
- { "getHeight", l_getHeight },
- { "destroy", l_destroy },
- { "hideWindow", l_hideWindow },
- { "showWindow", l_showWindow },
- /* creators */
- { "newBitmap", l_newBitmap },
- { "newTexture", l_newTexture },
- { "newShader", l_newShader },
- { "newShaderf", l_newShaderf },
- { "newCanvas", l_newCanvas },
- { "newTTFData", l_newTTFData },
- { "newText", l_newText },
- { "newTextureFont", l_newTextureFont },
- /* render */
- { "setClearColor", l_setClearColor },
- { "clear", l_clear },
- { "draw", l_draw },
- { "print", l_print },
- { "drawq", l_drawq },
- { "setColor", l_setColor },
- { "getColor", l_getColor },
- { "present", l_present },
- /* canvas */
- { "bindCanvas", l_bindCanvas },
- { "unbindCanvas", l_unbindCanvas },
- /* shader */
- { "useShader", l_useShader },
- /* shapes */
- { "point", l_point },
- { "line", l_line },
- { "rect", l_rect },
- { "circle", l_circle },
- { "triangle", l_triangle },
- { "polygon", l_polygon },
- /* font */
- { "setFont", l_setFont },
- { "unsetFont", l_unsetFont },
- { 0, 0 }
- };
-
LUA_PORT int luaopen_Texture(lua_State* L);
LUA_PORT int luaopen_Text(lua_State* L);
LUA_PORT int luaopen_TTF(lua_State* L);
@@ -806,6 +760,52 @@ namespace JinEngine
luaopen_TextureFont(L);
luaopen_Page(L);
luaopen_JSL(L);
+
+ luaL_Reg f[] = {
+ /* window */
+ { "init", l_init },
+ { "setTitle", l_setTitle },
+ { "getSize", l_getSize },
+ { "getWidth", l_getWidth },
+ { "getHeight", l_getHeight },
+ { "destroy", l_destroy },
+ { "hideWindow", l_hideWindow },
+ { "showWindow", l_showWindow },
+ /* creators */
+ { "newBitmap", l_newBitmap },
+ { "newTexture", l_newTexture },
+ { "newShader", l_newShader },
+ { "newShaderf", l_newShaderf },
+ { "newCanvas", l_newCanvas },
+ { "newTTFData", l_newTTFData },
+ { "newText", l_newText },
+ { "newTextureFont", l_newTextureFont },
+ /* render */
+ { "setClearColor", l_setClearColor },
+ { "clear", l_clear },
+ { "draw", l_draw },
+ { "print", l_print },
+ { "drawq", l_drawq },
+ { "setColor", l_setColor },
+ { "getColor", l_getColor },
+ { "present", l_present },
+ /* canvas */
+ { "bindCanvas", l_bindCanvas },
+ { "unbindCanvas", l_unbindCanvas },
+ /* shader */
+ { "useShader", l_useShader },
+ /* shapes */
+ { "point", l_point },
+ { "line", l_line },
+ { "rect", l_rect },
+ { "circle", l_circle },
+ { "triangle", l_triangle },
+ { "polygon", l_polygon },
+ /* font */
+ { "setFont", l_setFont },
+ { "unsetFont", l_unsetFont },
+ { 0, 0 }
+ };
// load whole lib
luax_newlib(L, f);
diff --git a/src/lua/modules/graphics/je_lua_page.cpp b/src/lua/modules/graphics/je_lua_page.cpp
index 29e3ff8..7e9b6d1 100644
--- a/src/lua/modules/graphics/je_lua_page.cpp
+++ b/src/lua/modules/graphics/je_lua_page.cpp
@@ -57,16 +57,15 @@ namespace JinEngine
return 1;
}
- LUA_IMPLEMENT const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "getSize", l_getSize },
- { "getWidth", l_getWidth },
- { "getHeight", l_getHeight },
- { 0, 0 }
- };
-
LUA_EXPORT int luaopen_Page(lua_State* L)
{
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "getSize", l_getSize },
+ { "getWidth", l_getWidth },
+ { "getHeight", l_getHeight },
+ { 0, 0 }
+ };
luax_newtype(L, JIN_GRAPHICS_PAGE, f);
return 0;
}
diff --git a/src/lua/modules/graphics/je_lua_shader.cpp b/src/lua/modules/graphics/je_lua_shader.cpp
index 9913bc3..cab31cf 100644
--- a/src/lua/modules/graphics/je_lua_shader.cpp
+++ b/src/lua/modules/graphics/je_lua_shader.cpp
@@ -111,23 +111,22 @@ namespace JinEngine
return 0;
}
- LUA_IMPLEMENT const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "sendNumber", l_sendNumber },
- { "sendTexture", l_sendTexture },
- { "sendCanvas", l_sendCanvas },
- { "sendVec2", l_sendVec2 },
- { "sendVec3", l_sendVec3 },
- { "sendVec4", l_sendVec4 },
- { "sendColor", l_sendColor },
- { 0, 0 }
- };
-
/**
* JSL program
*/
LUA_EXPORT int luaopen_JSL(lua_State* L)
{
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "sendNumber", l_sendNumber },
+ { "sendTexture", l_sendTexture },
+ { "sendCanvas", l_sendCanvas },
+ { "sendVec2", l_sendVec2 },
+ { "sendVec3", l_sendVec3 },
+ { "sendVec4", l_sendVec4 },
+ { "sendColor", l_sendColor },
+ { 0, 0 }
+ };
luax_newtype(L, JIN_GRAPHICS_SHADER, f);
return 0;
}
diff --git a/src/lua/modules/graphics/je_lua_text.cpp b/src/lua/modules/graphics/je_lua_text.cpp
index 60ab28c..4d6db5f 100644
--- a/src/lua/modules/graphics/je_lua_text.cpp
+++ b/src/lua/modules/graphics/je_lua_text.cpp
@@ -17,13 +17,12 @@ namespace JinEngine
return 0;
}
- LUA_IMPLEMENT const luaL_Reg f[] = {
- { "__gc", l_gc },
- { 0, 0 }
- };
-
LUA_EXPORT int luaopen_Text(lua_State* L)
{
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { 0, 0 }
+ };
luax_newtype(L, JIN_GRAPHICS_TEXT, f);
return 0;
}
diff --git a/src/lua/modules/graphics/je_lua_texture.cpp b/src/lua/modules/graphics/je_lua_texture.cpp
index 5236438..d7571b6 100644
--- a/src/lua/modules/graphics/je_lua_texture.cpp
+++ b/src/lua/modules/graphics/je_lua_texture.cpp
@@ -46,17 +46,16 @@ namespace JinEngine
proxy->release();
return 0;
}
-
- LUA_IMPLEMENT const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "getWidth", l_getWidth },
- { "getHeight", l_getHeight },
- { "getSize", l_getSize },
- { 0, 0 }
- };
-
+
LUA_EXPORT int luaopen_Texture(lua_State* L)
{
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "getWidth", l_getWidth },
+ { "getHeight", l_getHeight },
+ { "getSize", l_getSize },
+ { 0, 0 }
+ };
luax_newtype(L, JIN_GRAPHICS_TEXTURE, f);
return 0;
}
diff --git a/src/lua/modules/graphics/je_lua_texture_font.cpp b/src/lua/modules/graphics/je_lua_texture_font.cpp
index dbaa997..1cdbfff 100644
--- a/src/lua/modules/graphics/je_lua_texture_font.cpp
+++ b/src/lua/modules/graphics/je_lua_texture_font.cpp
@@ -51,16 +51,15 @@ namespace JinEngine
return 1;
}
- LUA_IMPLEMENT const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "typeset", l_typeset },
- { 0, 0 }
- };
-
LUA_EXPORT int luaopen_TextureFont(lua_State* L)
{
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "typeset", l_typeset },
+ { 0, 0 }
+ };
luax_newtype(L, JIN_GRAPHICS_TEXTUREFONT, f);
-
+
return 0;
}
diff --git a/src/lua/modules/graphics/je_lua_ttf.cpp b/src/lua/modules/graphics/je_lua_ttf.cpp
index 3e6050b..4e47906 100644
--- a/src/lua/modules/graphics/je_lua_ttf.cpp
+++ b/src/lua/modules/graphics/je_lua_ttf.cpp
@@ -57,14 +57,13 @@ namespace JinEngine
return 1;
}
- LUA_IMPLEMENT const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "typeset", l_typeset },
- { 0, 0 }
- };
-
LUA_EXPORT int luaopen_TTF(lua_State* L)
{
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "typeset", l_typeset },
+ { 0, 0 }
+ };
luax_newtype(L, JIN_GRAPHICS_TTF, f);
return 0;
diff --git a/src/lua/modules/graphics/je_lua_ttf_data.cpp b/src/lua/modules/graphics/je_lua_ttf_data.cpp
index e46fca6..cc91d60 100644
--- a/src/lua/modules/graphics/je_lua_ttf_data.cpp
+++ b/src/lua/modules/graphics/je_lua_ttf_data.cpp
@@ -36,15 +36,15 @@ namespace JinEngine
return 0;
}
- LUA_IMPLEMENT const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "newTTF", l_newTTF },
- { 0, 0 }
- };
-
LUA_EXPORT int luaopen_TTFData(lua_State* L)
{
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "newTTF", l_newTTF },
+ { 0, 0 }
+ };
luax_newtype(L, JIN_GRAPHICS_TTFDATA, f);
+
return 0;
}