简体   繁体   中英

Missing Assembly/Directive Reference for SFML.NET

I have been using SFML with C++ for three months now, and recently decided to transition over to C#. I referenced the dlls in my project, added the CSFML dlls to my project, and added the using statements to the top of my code. However, I am given the error posted below after the line:

shape.setFillColor(fillColor);

What is my problem?

Error: error CS1061: 'SFML.Graphics.CircleShape' does not contain a definition for 'setFillColor' and no extension method 'setFillColor' accepting a first argument of type 'SFML.Graphics.CircleShape' could be found (are you missing a using directive or an assembly reference?)

Code: http://pastie.org/private/eujxnxorisb4ajtp22ovng

Looking into code SFML.NET code, CircleShape inherits from Shape which has this method wrapped into property:

// SFML.Graphics.Shape
public Color FillColor
{
    get
    {
        return Shape.sfShape_getFillColor(base.CPointer);
    }
    set
    {
         Shape.sfShape_setFillColor(base.CPointer, value);
    }
}

so you can simply call:

shape.FillColor = ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM