aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/graphics/je_lua_graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/modules/graphics/je_lua_graphics.cpp')
-rw-r--r--src/lua/modules/graphics/je_lua_graphics.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/lua/modules/graphics/je_lua_graphics.cpp b/src/lua/modules/graphics/je_lua_graphics.cpp
index ce569d0..900b26b 100644
--- a/src/lua/modules/graphics/je_lua_graphics.cpp
+++ b/src/lua/modules/graphics/je_lua_graphics.cpp
@@ -17,6 +17,7 @@
#include "je_lua_text.h"
#include "je_lua_texture_font.h"
#include "je_lua_page.h"
+#include "je_lua_sprite.h"
using namespace std;
using namespace JinEngine;
@@ -385,16 +386,27 @@ namespace JinEngine
font->render(page, x, y);
}
+ LUA_IMPLEMENT void l_draw_sprite(lua_State* L)
+ {
+ if (!luax_istype(L, 1, Jin_Lua_Sprite))
+ return;
+ Proxy* pxySprite = (Proxy*)luax_toudata(L, 1);
+ Sprite* spr = pxySprite->getObject<Sprite>();
+ spr->render();
+ }
+
LUA_IMPLEMENT int l_draw(lua_State* L)
{
- if (luax_istype(L, 1, Jin_Lua_Texture))
- l_draw_texture(L);
- else if (luax_istype(L, 1, Jin_Lua_Canvas))
- l_draw_canvas(L);
- else if (luax_istype(L, 1, Jin_Lua_Text))
- l_draw_text(L);
- else if (luax_istype(L, 1, Jin_Lua_Page))
- l_draw_page(L);
+ if (luax_istype(L, 1, Jin_Lua_Texture))
+ l_draw_texture(L);
+ else if (luax_istype(L, 1, Jin_Lua_Canvas))
+ l_draw_canvas(L);
+ else if (luax_istype(L, 1, Jin_Lua_Text))
+ l_draw_text(L);
+ else if (luax_istype(L, 1, Jin_Lua_Page))
+ l_draw_page(L);
+ else if (luax_istype(L, 1, Jin_Lua_Sprite))
+ l_draw_sprite(L);
else
{
luax_typerror(L, 1, "texture or canvas");