Page 1 of 1

XNA png import

PostPosted: Tue Aug 26, 2008 8:38 pm
by Dante
Anyone here use XNA 2.0 and VS 2005 C#.NET?

I'm having a problem getting my pngs loaded onto the load content method, I used

mySprite = new SoldierSprite(Content.Load<Texture2d>("TestSprite"), new Vector2(0f,0f), new Vector2(178f,261f));

but every time the program runs it says it can't find "TestSprite" which is loaded in the solution Items as a png... I mean, the file is sitting there right in front of me, loaded into the program and I copied and pasted its name into this location just as stated in Beginning XNA 2.0 Game Programming from Novice to Professional... but IT SAYS IT CAN'T FIND IT :(... Is there something else I have to do to the file for VS to find it and use it in XNA?

Confused and Lost,
Pascal

PostPosted: Thu Aug 28, 2008 11:29 pm
by Dante
Figured it out YAY!!!

(You have to add the file into "content" directory SPECIFICALLY, and then you have to make sure that the combo box is set to texture or something like that...) HERE!

I just found the solution, turns out when you said to simply Add>Existing Item in the solution explorer, that wasn't quite the way its now done.

Turns out that you have to right click on CONTENT>Add>Existing Item.

(Clicking anywheres apparently doesn't do the trick :(, )

Furthermore, the Files of type combo box must be set to Texture Files

Anyways, hope that helps if anyone else is using XNA in the future!

-Pascal