Frage

I'm working with a bit of XNA code, as a beginner. So i use this tutorial, but it appears that i am doing something and i do not know why.

http://www.xnadevelopment.com/tutorials/theroadnottaken/theroadnottaken.shtml

I am at the part with Path collision, and this is how my code is written!

mTrackRender = new RenderTarget2D(graphics.GraphicsDevice, mCarWidth + 100,
               mCarHeight + 100, 1, SurfaceFormat.Color,DepthFormat.Depth24);

mTrackRenderRotated = new RenderTarget2D(graphics.GraphicsDevice, mCarWidth + 100,
                   mCarHeight + 100, 1);

I have declared mTrackREnder, and mTrackREnderRotated has objects at class level.

Well, what the issue ism i get this error for both of them:

Error 3 'Microsoft.Xna.Framework.Graphics.RenderTarget2D' does not contain a constructor that takes 4 arguments'

What am i doing wrong? How can i resolve this issue?

War es hilfreich?

Lösung

Take a look at the constructors of the RenderTarget2D class. None of them take the arguments that you are trying to pass.

In the first case, you are passing an integer where the constructor expects a boolean. Integers are not implicitely convertible to booleans in C#; use true and false instead of 1 and 0.

In the second case, it's not clear which constructor you are trying to call, but none of them take 4 arguments and none of them take an integer as the 4th argument.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top