XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

Problem with One of the Draw functions...

Last post 07-14-2008 10:43 PM by Polarican. 2 replies.
  • 07-14-2008 10:22 PM

    Problem with One of the Draw functions...

     

    I'm currently trying to make a sprite class and everything was going fine untill I started to add extra functionality to the sprite class I made.  Currently my sprite class works fine, but when I try to add this fuction in:

     

    public virtual void VC_DrawFrameEx(SpriteBatch batch)  
    {  
         batch.Draw(this.Texture, this.Pos, this.Frame, this.Tint, this.Rot, this.Origin, this.Effect, this.Layer);  

    It won't take my this.pos value!  It seems to want a Rectangle but I already have a Draw Function that takes Rectangles.

     

    Any thoughts?

  • 07-14-2008 10:28 PM In reply to

    Re: Problem with One of the Draw functions...

    There ae multiple overloads of the Draw function with different numbers of parameters.

    Your number and type of parameters don't match any of them so the compiler finds the closest one and tells you which paramter it thinks is wrong.

    See http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.spritebatch.draw.aspx

    You have 8 parameters so the compiler assumes you are using the 3rd one from that list which needs a Rectangle as the second parameter.

    If you want a vector2 as the 2nd parameter you need to use the 4th, 5th, 6th or 7th overloads none of which have 8 parameters.



    The ZBuffer News and information for XNA

    Please read the forum FAQs - Bug reporting
  • 07-14-2008 10:43 PM In reply to

    Re: Problem with One of the Draw functions...

    Opps your right!  I forgot my Scale parameter!  Now it works.  Thanks for your help :P
Page 1 of 1 (3 items) Previous Next