im expermenting with c# and XNA and was just wondering that is possible
im trying to do this is there way to change the name of the proptery or field so i can declare to something the built in xna will recognize?

rectangle.Location.Above top;

or

xTile.Dimensions.Location.Origin.Above top;

Recommended Answers

All 8 Replies

No, you can't use it like a type, but you can use the Typeof(field) as a type.

Not sure what you are really asking here, could you explain more what you are trying to do?

im using xTile.dll and xTilepipeline.dll(dll for tIde map editor so you can import 2d tile maps into game) ok now im using a tutorial on camera and trying to change it so i can import the map heres where i get errors

private void CalculateBoundingRectangle()
        {
            
            if (texture != null)
            {
                
                
                rectangle = new xTile.Dimensions.Rectangle(0, 0, texture.Width, texture.Height);
                Vector2 leftTop = Vector2.Transform(new Vector2(rectangle.Location.Left, rectangle.top), Transform);
                Vector2 rightTop = Vector2.Transform(new Vector2(rectangle.Location.Right, rectangle.top), Transform);
                Vector2 leftBottom = Vector2.Transform(new Vector2(rectangle.Location.Left, rectangle.bottom), Transform);
                Vector2 rightBottom = Vector2.Transform(new Vector2(rectangle.Location.Right, rectangle.bottom), Transform);

                Vector2 min = Vector2.Min(Vector2.Min(leftTop, rightTop),
                                  Vector2.Min(leftBottom, rightBottom));
                Vector2 max = Vector2.Max(Vector2.Max(leftTop, rightTop),
                                          Vector2.Max(leftBottom, rightBottom));

                rectangle = new xTile.Dimensions.Rectangle((int)min.X, (int)min.Y,
                    (int)(max.X - min.X), (int)(max.Y - min.Y));
            }

now im trying to use the rectangle.location.above from the dll but it throws an error
so im trying to change above to top

Could you possibly tell me what error, exactly, it is throwing and which line? Can't see your monitor from here.

cannot convert from 'xTile.Dimensions.Location' to 'float'
The best overloaded method match for Microsoft.XNA.Framework.Vector2.Vector2(float,float)' has some invalid arguments.

on line 9 but line 9 now looks like

Vector2 leftTop = Vector2.Transform(new Vector2(rectangle.Location.Left, rectangle.Location.Above), Transform);

It's telling you that xTile.Demensions.Location isn't a float. I have no idea what it actually is (I suspect that it is an x/y coordinate).

right you are Sensei it is indeed a x y coordinate im not sure but im guessing the

xTile.Dimensions.Location.Origin.Above

im guessing above is also referring to an x or y coordinate im not sure theres not much documentation to these dlls

im also unsure but the Vector2 only takes top for a coordinate so if i could somehow change the above code to make it so Above is top then it might work

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.