SFML community forums

Help => Graphics => Topic started by: shekel on June 06, 2021, 10:35:14 am

Title: Inheritance from Shape
Post by: shekel on June 06, 2021, 10:35:14 am
Hello everybody.

I am creating a button (RectangleShape + Text) and the basic functionality works correctly.

My problem is when I want to use for example 'setOutlineColor', nothing happens.

Should I overwrite all the methods? Or can I indicate that all properties apply to the RectangleShape?

Sorry for my english, this is google translator
Title: Re: Inheritance from Shape
Post by: Stauricus on June 06, 2021, 01:18:23 pm
maybe you got to the same problem I did a while ago (https://en.sfml-dev.org/forums/index.php?topic=27556). both Text and Shape have setOutlineColor.
in my case, I had to use Text and Sprite as members of the class I was creating. I looked into some GUI libraries made with SFML (I dont remember exactly which ones), and they also did it like this.
Title: Re: Inheritance from Shape
Post by: kojack on June 06, 2021, 03:24:40 pm
It looks like this isn't using inheritance, it appears to be aggregation of rectangleshape (it's got a pointer to one). But we'd need to see the whole class to see where it might be going wrong.
Title: Re: Inheritance from Shape
Post by: G. on June 06, 2021, 05:24:47 pm
Do you set an outline thickness (https://www.sfml-dev.org/documentation/2.5.1/classsf_1_1RectangleShape.php#a5ad336ad74fc1f567fce3b7e44cf87dc)?