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

Method initWithPolygon

core/2d/Sprite.cpp:260–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260bool Sprite::initWithPolygon(const ax::PolygonInfo& info)
261{
262 bool ret = false;
263
264 Texture2D* texture = _director->getTextureCache()->addImage(info.getFilename());
265 if (texture && initWithTexture(texture))
266 {
267 _polyInfo = info;
268 _renderMode = RenderMode::POLYGON;
269 Node::setContentSize(_polyInfo.getRect().size / _director->getContentScaleFactor());
270 ret = true;
271 }
272
273 return ret;
274}
275
276// designated initializer
277bool Sprite::initWithTexture(Texture2D* texture, const Rect& rect, bool rotated)

Callers 3

createMethod · 0.80
createMethod · 0.80

Calls 3

getTextureCacheMethod · 0.80
getRectMethod · 0.80
addImageMethod · 0.45

Tested by

no test coverage detected