SFML community forums

Bindings - other languages => General => Topic started by: KagonKhan on August 01, 2021, 05:01:46 am

Title: SFML GUI buttons design
Post by: KagonKhan on August 01, 2021, 05:01:46 am
To preface - yes I am aware of libraries for GUI using SFML.

I'm writing a game, and currently working on options menu. What I want to achieve is to have a button for resolution. Upon clicking it, a scrollable list is shown to choose resolutions from.

What I currently have, is the button class, and a list of buttons, scrollable by wheel. I also can manage showing, clicking / selecting, and hiding on my own. What I truly need is a way to "smartly" hide buttons that are outside of some defined area. An easy way would be to have a boolean that would render based on button position, but I am hoping that partial hiding would be possible - meaning that for example only top half of the button is visible IF it's at the border range.

Hoping for any suggestions

:^)
Title: Re: SFML GUI buttons design
Post by: G. on August 01, 2021, 08:56:09 am
You can draw them on an sf::RenderTexture that is the size of the viewable area you want, and display this texture with a sprite.
Title: Re: SFML GUI buttons design
Post by: KagonKhan on August 01, 2021, 08:58:01 am
You can draw them on an sf::RenderTexture that is the size of the viewable area you want, and display this texture with a sprite.


O, that sounds interesting. I'll play around with that in the upcoming days - thanks!
Title: Re: SFML GUI buttons design
Post by: KagonKhan on August 02, 2021, 08:11:18 am
Okay, got it to work just like I needed. Thank you very much :^)