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

Method createNativeControl

core/ui/UIEditBox/UIEditBoxImpl-android.cpp:97–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97void EditBoxImplAndroid::createNativeControl(const Rect& frame)
98{
99 auto director = ax::Director::getInstance();
100 auto renderView = director->getRenderView();
101 auto frameSize = renderView->getFrameSize();
102
103 auto winSize = director->getWinSize();
104 auto leftBottom = _editBox->convertToWorldSpace(Point::ZERO);
105
106 auto contentSize = frame.size;
107 auto rightTop = _editBox->convertToWorldSpace(Point(contentSize.width, contentSize.height));
108
109 auto uiLeft = frameSize.width / 2 + (leftBottom.x - winSize.width / 2) * renderView->getScaleX();
110 auto uiTop = frameSize.height / 2 - (rightTop.y - winSize.height / 2) * renderView->getScaleY();
111 auto uiWidth = (rightTop.x - leftBottom.x) * renderView->getScaleX();
112 auto uiHeight = (rightTop.y - leftBottom.y) * renderView->getScaleY();
113 LOGD("scaleX = %f", renderView->getScaleX());
114 _editBoxIndex = JniHelper::callStaticIntMethod(editBoxClassName, "createEditBox", (int)uiLeft, (int)uiTop,
115 (int)uiWidth, (int)uiHeight, (float)renderView->getScaleX());
116 s_allEditBoxes[_editBoxIndex] = this;
117}
118
119void EditBoxImplAndroid::setNativeFont(const char* pFontName, int fontSize)
120{

Callers

nothing calls this directly

Calls 7

getInstanceFunction · 0.85
callStaticIntMethodFunction · 0.85
getFrameSizeMethod · 0.80
convertToWorldSpaceMethod · 0.80
PointClass · 0.50
getScaleXMethod · 0.45
getScaleYMethod · 0.45

Tested by

no test coverage detected