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.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/lua/modules/graphics/je_lua_graphics.cpp b/src/lua/modules/graphics/je_lua_graphics.cpp
index b1437e2..78674dd 100644
--- a/src/lua/modules/graphics/je_lua_graphics.cpp
+++ b/src/lua/modules/graphics/je_lua_graphics.cpp
@@ -6,6 +6,8 @@
#include "lua/modules/types.h"
#include "lua/common/je_lua_common.h"
+#include "je_lua_sprite.h"
+
using namespace std;
using namespace JinEngine;
using namespace JinEngine::Graphics;
@@ -19,7 +21,7 @@ namespace JinEngine
{
#include "../../resources/font.ttf.h"
-
+
static struct
{
Color curRenderColor;
@@ -634,7 +636,7 @@ namespace JinEngine
proxy->bind(new Shared<TTFData>(fd, JIN_GRAPHICS_TTFDATA));
return 1;
}
-
+
/* newText(str[, encode]) */
LUA_IMPLEMENT int l_newText(lua_State* L)
{
@@ -659,6 +661,13 @@ namespace JinEngine
return 1;
}
+ LUA_IMPLEMENT int l_newSprite(lua_State* L)
+ {
+ Proxy* p = luax_newinstance(L, JIN_GRAPHICS_SPRITE);
+ p->bind(new Shared<Lua::Sprite>(new Lua::Sprite(), JIN_GRAPHICS_SPRITE));
+ return 1;
+ }
+
/* newTextureFont(bitmap, text, color | cellw, cellh) */
LUA_IMPLEMENT int l_newTextureFont(lua_State* L)
{
@@ -746,6 +755,7 @@ namespace JinEngine
luax_newclass(L, luaopen_TextureFont);
luax_newclass(L, luaopen_Page);
luax_newclass(L, luaopen_JSL);
+ luax_newclass(L, luaopen_Sprite);
luaL_Reg f[] = {
/* window */
@@ -766,6 +776,7 @@ namespace JinEngine
{ "newTTFData", l_newTTFData },
{ "newText", l_newText },
{ "newTextureFont", l_newTextureFont },
+ { "newSprite", l_newSprite },
/* render */
{ "setClearColor", l_setClearColor },
{ "clear", l_clear },
@@ -793,7 +804,7 @@ namespace JinEngine
{ 0, 0 }
};
- // load whole lib
+ // Load whole lib.
luax_newlib(L, f);
return 1;