SFML community forums

Bindings - other languages => DotNet => Topic started by: Brikinhos on June 18, 2020, 03:26:02 pm

Title: C#, How to code an entity Drawable and Transformable?
Post by: Brikinhos on June 18, 2020, 03:26:02 pm
Hi all, I'm porting my project from C++ to C# and I encountered a problem, I have a class Entity that inherits from Drawable and Transformable, but C# doesn't allow multiple inheritance. How can I do that? Thanks in advance.
Title: Re: C#, How to code an entity Drawable and Transformable?
Post by: eXpl0it3r on June 19, 2020, 10:34:38 am
Drawable is an interface while Transformable is a class, so you can derive from the Transformable class and implement the interface. See how it's done for the Sprite class (https://github.com/SFML/SFML.Net/blob/master/src/SFML.Graphics/Sprite.cs#L17).
Title: Re: C#, How to code an entity Drawable and Transformable?
Post by: Brikinhos on June 19, 2020, 04:13:40 pm
Oh damn! I feel so bad with myself xD, thanks so much!