MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / LoadFont

Method LoadFont

LuaSTGPlus/LuaWrapper.cpp:937–973  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

935 return 0;
936 }
937 static int LoadFont(lua_State* L)LNOEXCEPT
938 {
939 bool bSucceed = false;
940 const char* name = luaL_checkstring(L, 1);
941 const char* path = luaL_checkstring(L, 2);
942
943 ResourcePool* pActivedPool = LRES.GetActivedPool();
944 if (!pActivedPool)
945 return luaL_error(L, "can't load resource at this time.");
946
947 if (lua_gettop(L) == 2)
948 {
949 // HGE字体 mipmap=true
950 bSucceed = pActivedPool->LoadSpriteFont(name, path);
951 }
952 else
953 {
954 if (lua_isboolean(L, 3))
955 {
956 // HGE字体 mipmap=user_defined
957 bSucceed = pActivedPool->LoadSpriteFont(name, path, lua_toboolean(L, 3) == 0 ? false : true);
958 }
959 else
960 {
961 // fancy2d字体
962 const char* texpath = luaL_checkstring(L, 3);
963 if (lua_gettop(L) == 4)
964 bSucceed = pActivedPool->LoadSpriteFont(name, path, texpath, lua_toboolean(L, 4) == 0 ? false : true);
965 else
966 bSucceed = pActivedPool->LoadSpriteFont(name, path, texpath);
967 }
968 }
969
970 if (!bSucceed)
971 return luaL_error(L, "can't load font from file '%s'.", path);
972 return 0;
973 }
974 static int LoadTTF(lua_State* L)LNOEXCEPT
975 {
976 const char* name = luaL_checkstring(L, 1);

Callers

nothing calls this directly

Calls 2

GetActivedPoolMethod · 0.80
LoadSpriteFontMethod · 0.80

Tested by

no test coverage detected