MCPcopy Create free account
hub / github.com/axmolengine/axmol / open

Method open

extensions/SDFGen/src/SDFGen/SDFGen.cpp:206–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206void SDFGen::open(ax::Scene* scene)
207{
208 refreshFontList();
209
210 _atlasViewer = Sprite::create();
211 _atlasViewer->setTexture(Director::getInstance()->getTextureCache()->getWhiteTexture("/black-texture", 0));
212 _atlasViewer->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
213 _atlasViewer->retain();
214
215 auto defaultFontFile = FileUtils::getInstance()->fullPathForFilename(R"(fonts/arial.ttf)");
216
217 _atlasParams = new FontAtlasGenParams();
218 _atlasParams->sourceFont = "fonts/arial.ttf";
219 _atlasParams->fontAsset = "fonts/arial-SDF.xasset";
220
221 ImGuiPresenter::getInstance()->addFont(defaultFontFile);
222 /* For Simplified Chinese support, please use:
223 ImGuiPresenter::getInstance()->addFont(R"(C:\Windows\Fonts\msyh.ttc)", ImGuiPresenter::DEFAULT_FONT_SIZE,
224 ImGuiPresenter::GLYPH_RANGES::CHINESE_GENERAL);
225 */
226 ImGuiPresenter::getInstance()->enableDPIScale(); // enable dpi scale for 4K display support, depends at least one
227 // valid ttf/ttc font was added.
228 ImGuiPresenter::getInstance()->addRenderLoop("#sdfg", AX_CALLBACK_0(SDFGen::onImGuiDraw, this), scene);
229}
230
231void SDFGen::close()
232{

Callers 2

axlua_WebSocket_create00Function · 0.45

Calls 11

createFunction · 0.85
getInstanceFunction · 0.85
getWhiteTextureMethod · 0.80
getTextureCacheMethod · 0.80
fullPathForFilenameMethod · 0.80
addFontMethod · 0.80
enableDPIScaleMethod · 0.80
addRenderLoopMethod · 0.80
setTextureMethod · 0.45
setAnchorPointMethod · 0.45
retainMethod · 0.45

Tested by

no test coverage detected