MCPcopy Create free account
hub / github.com/SFML/SFML / setTexture

Method setTexture

src/SFML/Graphics/Shape.cpp:55–66  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

53{
54////////////////////////////////////////////////////////////
55void Shape::setTexture(const Texture* texture, bool resetRect)
56{
57 if (texture)
58 {
59 // Recompute the texture area if requested, or if there was no texture & rect before
60 if (resetRect || (!m_texture && (m_textureRect == IntRect())))
61 setTextureRect(IntRect({0, 0}, Vector2i(texture->getSize())));
62 }
63
64 // Assign the new texture
65 m_texture = texture;
66}
67
68
69////////////////////////////////////////////////////////////

Callers 2

Sprite.test.cppFile · 0.45
Shape.test.cppFile · 0.45

Calls 1

getSizeMethod · 0.45

Tested by

no test coverage detected