MCPcopy Create free account
hub / github.com/SFML/imgui-sfml / getSpriteTextureData

Function getSpriteTextureData

imgui-SFML.cpp:167–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165};
166
167[[nodiscard]] SpriteTextureData getSpriteTextureData(const sf::Sprite& sprite)
168{
169 const sf::Texture& texture(sprite.getTexture());
170 const sf::Vector2f textureSize(texture.getSize());
171 const sf::FloatRect textureRect(sprite.getTextureRect());
172
173 return {toImVec2(textureRect.position.componentWiseDiv(textureSize)),
174 toImVec2((textureRect.position + textureRect.size).componentWiseDiv(textureSize)),
175 convertGLTextureHandleToImTextureID(texture.getNativeHandle())};
176}
177
178void RenderDrawLists(ImDrawData* draw_data); // rendering callback function prototype
179

Callers 2

ImageFunction · 0.85
ImageButtonFunction · 0.85

Calls 2

toImVec2Function · 0.85

Tested by

no test coverage detected