diff options
author | chai <chaifix@163.com> | 2018-11-15 08:32:38 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-11-15 08:32:38 +0800 |
commit | a6f2d5fff89b7322009c46a9272668ca4c32ce64 (patch) | |
tree | ff81127c3be8bde426e57db544d69b9616ddc25b /src/lua/modules/graphics/je_lua_ttf_data.cpp | |
parent | 611d12bdd245dd43b7434661d3e24f2b435378cb (diff) |
*修改代码结构
Diffstat (limited to 'src/lua/modules/graphics/je_lua_ttf_data.cpp')
-rw-r--r-- | src/lua/modules/graphics/je_lua_ttf_data.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lua/modules/graphics/je_lua_ttf_data.cpp b/src/lua/modules/graphics/je_lua_ttf_data.cpp index 4df2f6e..fb43ae4 100644 --- a/src/lua/modules/graphics/je_lua_ttf_data.cpp +++ b/src/lua/modules/graphics/je_lua_ttf_data.cpp @@ -1,8 +1,11 @@ #include "lua/modules/luax.h" -#include "lua/modules/types.h" + #include "lua/common/je_lua_common.h" #include "libjin/jin.h" +#include "je_lua_ttf.h" +#include "je_lua_ttf_data.h" + using namespace JinEngine::Graphics; using namespace JinEngine::Graphics::Fonts; @@ -11,28 +14,25 @@ namespace JinEngine namespace Lua { - enum TTFDependency - { - DEP_TTFDATA = 1, - }; + const char* Jin_Lua_TTFData = "TTFData"; LUA_IMPLEMENT int l_newTTF(lua_State* L) { - Proxy* pxyTTFData = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_TTFDATA); + Proxy* pxyTTFData = (Proxy*)luax_checktype(L, 1, Jin_Lua_TTFData); int fontsize = luax_checkinteger(L, 2); Shared<TTFData>& shrFontData = pxyTTFData->getShared<TTFData>(); TTFData* fontData = shrFontData.getObject(); - Proxy* pxyTTF = luax_newinstance(L, JIN_GRAPHICS_TTF); + Proxy* pxyTTF = luax_newinstance(L, Jin_Lua_TTF); TTF* font = fontData->createTTF(fontsize); - Shared<TTF>* shrTTF = new Shared<TTF>(font, JIN_GRAPHICS_TTF); - shrTTF->setDependency(DEP_TTFDATA, &shrFontData); + Shared<TTF>* shrTTF = new Shared<TTF>(font, Jin_Lua_TTF); + shrTTF->setDependency((int)TTFDependency::DEP_TTFDATA, &shrFontData); pxyTTF->bind(shrTTF); return 1; } LUA_IMPLEMENT int l_gc(lua_State* L) { - Proxy* p = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_TTFDATA); + Proxy* p = (Proxy*)luax_checktype(L, 1, Jin_Lua_TTFData); p->release(); return 0; } @@ -44,7 +44,7 @@ namespace JinEngine { "newTTF", l_newTTF }, { 0, 0 } }; - luax_newtype(L, JIN_GRAPHICS_TTFDATA, f); + luax_newtype(L, Jin_Lua_TTFData, f); return 0; } |