XNA png import

The geek forum. PHP, Perl, HTML, hardware questions etc.. it's all in here. Got a techie question? We'll sort you out. Ask your questions or post a link to your own site here!

XNA png import

Postby Dante » Tue Aug 26, 2008 8:38 pm

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
FKA Pascal
User avatar
Dante
 
Posts: 1323
Joined: Thu Mar 04, 2004 8:24 pm
Location: Where-ever it is, it sure is hot!

Postby Dante » Thu Aug 28, 2008 11:29 pm

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
FKA Pascal
User avatar
Dante
 
Posts: 1323
Joined: Thu Mar 04, 2004 8:24 pm
Location: Where-ever it is, it sure is hot!


Return to Computing and Links

Who is online

Users browsing this forum: No registered users and 108 guests