Quantcast
Channel: tIDE (Tilemap Integrated Development Environment)
Viewing all articles
Browse latest Browse all 173

New Post: Rectangle is an ambiguous reference error

$
0
0
xTile defines a type called Rectangle which conflicts with a Rectangle type defined in XNA. If you import both the namespaces Microsoft.Xna.Framework and xTile.Dimensions at the top of your code files (which contain the respective Rectangle types), then the compiler doesn't know which Rectangle you mean, unless you fully qualify it with the namespace.

So basically, instead of declaring your rectangle as
Rectangle myRectangle = new Rectangle(...);
use the full type qualifier xTile.Dimensions.Rectangle as in
xTile.Dimensions.Rectangle myRectangle = new xTile.Dimensions.Rectangle(...);
If you want to use the XNA one instead, you need to specify it as Microsoft.Xna.Framework.Rectangle.

I hope that helps. Beyond this, I think you should look up some C# tutorials.

Viewing all articles
Browse latest Browse all 173

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>