diff options
Diffstat (limited to 'src/libjin-lua/modules/graphics/l_ttf_data.cpp')
-rw-r--r-- | src/libjin-lua/modules/graphics/l_ttf_data.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/libjin-lua/modules/graphics/l_ttf_data.cpp b/src/libjin-lua/modules/graphics/l_ttf_data.cpp index 1c8c653..9cc629e 100644 --- a/src/libjin-lua/modules/graphics/l_ttf_data.cpp +++ b/src/libjin-lua/modules/graphics/l_ttf_data.cpp @@ -10,40 +10,40 @@ using namespace JinEngine::Graphics::Fonts; namespace JinEngine { - namespace Lua - { - - const char* Jin_Lua_TTFData = "TTFData"; - - LUA_IMPLEMENT int l_newTTF(lua_State* L) - { - LuaObject* luaTTFData = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TTFData); - int fontsize = luax_checkinteger(L, 2); - TTFData* fontData = luaTTFData->getObject<TTFData>(); - TTF* font = fontData->createTTF(fontsize); - Shared* shrTTF = new Shared(font); - LuaObject* luaTTF = luax_newinstance(L, Jin_Lua_TTF, shrTTF); - luaTTF->setDependency((int)TTFDependency::DEP_TTFDATA, luaTTFData); - return 1; - } - - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TTFData); - p->release(); - return 0; - } - - LUA_EXPORT void luaopen_TTFData(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "newTTF", l_newTTF }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_TTFData, methods); - - } - - } // namespace Lua + namespace Lua + { + + const char* Jin_Lua_TTFData = "TTFData"; + + LUA_IMPLEMENT int l_newTTF(lua_State* L) + { + LuaObject* luaTTFData = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TTFData); + int fontsize = luax_checkinteger(L, 2); + TTFData* fontData = luaTTFData->getObject<TTFData>(); + TTF* font = fontData->createTTF(fontsize); + Shared* shrTTF = new Shared(font); + LuaObject* luaTTF = luax_newinstance(L, Jin_Lua_TTF, shrTTF); + luaTTF->setDependency((int)TTFDependency::DEP_TTFDATA, luaTTFData); + return 1; + } + + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TTFData); + p->release(); + return 0; + } + + LUA_EXPORT void luaopen_TTFData(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "newTTF", l_newTTF }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_TTFData, methods); + + } + + } // namespace Lua } // namespace JinEngine
\ No newline at end of file |