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

Method initWithPlaceHolder

core/ui/UITextFieldEx.cpp:281–303  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////// initialize /////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

279// initialize
280//////////////////////////////////////////////////////////////////////////
281bool TextFieldEx::initWithPlaceHolder(std::string_view placeholder,
282 std::string_view fontName,
283 float fontSize,
284 float cursorWidth,
285 const Color4B& cursorColor)
286{
287 _placeHolder = placeholder;
288
289 _renderLabel =
290 _createLabel(placeholder, fontName, fontSize, Vec2::ZERO, TextHAlignment::CENTER, TextVAlignment::CENTER);
291 _renderLabel->setAnchorPoint(Point::ANCHOR_MIDDLE_LEFT);
292 this->addChild(_renderLabel);
293
294 _director->getScheduler()->runOnAxmolThread([this] { _renderLabel->setPosition(Point(0, this->getContentSize().height / 2)); });
295
296 __initCursor(fontSize, cursorWidth, cursorColor);
297
298 _fontName = fontName;
299 _fontSize = fontSize;
300 _systemFontUsed = !FileUtils::getInstance()->isFileExist(fontName);
301
302 return true;
303}
304
305std::string_view TextFieldEx::getTextFontName() const
306{

Callers 2

createMethod · 0.45
createMethod · 0.45

Calls 9

_createLabelFunction · 0.85
getInstanceFunction · 0.85
runOnAxmolThreadMethod · 0.80
PointClass · 0.50
setAnchorPointMethod · 0.45
addChildMethod · 0.45
setPositionMethod · 0.45
getContentSizeMethod · 0.45
isFileExistMethod · 0.45

Tested by

no test coverage detected