Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImGui::ImageButton(const sf::Sprite& sprite) ignores rotation #86

Closed
Boronak opened this issue May 29, 2019 · 7 comments
Closed

ImGui::ImageButton(const sf::Sprite& sprite) ignores rotation #86

Boronak opened this issue May 29, 2019 · 7 comments

Comments

@Boronak
Copy link

Boronak commented May 29, 2019

ImGui::ImageButton(const sf::Sprite& sprite) takes the texture and position but ignores the rotation of the sprite.

@eliasdaler
Copy link
Contributor

Indeed, right now sf::Sprite's transform is ignored, but I can only make it work with ImGui::Image, because there's no way to draw rotated image using ImGui::ImageButton.

I think what you need to do is to make custom ImageButton, which will copy how original ImageButton is implemented, but instead use advice from this issue and use AddImageQuad instead of AddImage.

Sorry, I don't want to implement this custom ImageButton in ImGui-SFML, because it will mean that I'll need to access ImGui's private API which will make things a lot more difficult.

But I'll eventually support sf::Sprite's transform in ImGui::Image

@eliasdaler
Copy link
Contributor

Another workaround (which is a lot easier!) is to draw sprite onto sf::RenderTexture and then pass it into ImageButton overload for sf::Texture. You're likely to encounter #35 then, and if you do - I'll add Image/ImageButton overload for sf::RenderTexture ASAP.

@Boronak
Copy link
Author

Boronak commented May 29, 2019

I am now using the workaround of drawing the rotated sprite to a RenderTexture and flipping it to counteract #35.

@eliasdaler
Copy link
Contributor

Okay, I'll add overload for sf::RenderTexture soon

@oprypin
Copy link
Member

oprypin commented Feb 17, 2021

Could you please actually add that overload? :s

@eliasdaler
Copy link
Contributor

"Soon" was 1.5 years ago... Shame on me.
Okay, I'll try to add it this week. But if someone provides a PR it would get into master even quicker. ;)

@eliasdaler
Copy link
Contributor

Update: fix for RenderTexture is not in master and released in v2.2

If I manage to do #87, the sprite transform might be taken into account. I'll see what i can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants