Jump to content

  • Log In with Google      Sign In   
  • Create Account

Code not running and image not loading


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Key   Members   -  Reputation: 112

Like
0Likes
Like

Posted 08 August 2012 - 12:26 PM

I posted my problem over at stackoverflow, but haven't found the solution yet.

private void LoadImageList()
    {
	    string filepath = Application.StartupPath + @"\Content\Textures\Tiles\PlatformTiles.png";
	    Bitmap tileSheet = new Bitmap(filepath);
	    int tilecount = 0;
	    for (int y = 0; y < tileSheet.Height / TileGrid.TileHeight; y++)
	    {
		    for (int x = 0; x < tileSheet.Width / TileGrid.TileWidth; x++)
		    {
			    Bitmap newBitmap = tileSheet.Clone(
				    new System.Drawing.Rectangle(
					    x * TileGrid.TileWidth,
					    y * TileGrid.TileHeight,
					    TileGrid.TileWidth,
					    TileGrid.TileHeight),
					    System.Drawing.Imaging.PixelFormat.DontCare);
			    imgListTiles.Images.Add(newBitmap);
			    string itemName = "";
			    if (tilecount == 0)
			    {
				    itemName = "Empty";
			    }
			    if (tilecount == 1)
			    {
				    itemName = "White";
			    }
			    listTiles.Items.Add(new ListViewItem(itemName, tilecount++));
		    }
	    }
    }

All I did was update PlatformTiles.png with a newer one and the next time I ran the program it doesn't load. I placed a breakpoint at int tilecount = 0; and it doesn't ever reach it. Everything after it doesn't run either. Any ideas? I used the original PlaformTiles.png and it doesn't work either.

Sponsor:

#2 weeska   Members   -  Reputation: 255

Like
0Likes
Like

Posted 15 August 2012 - 12:31 PM

Hi,

i think the problem is the same stated there. You shouldn't use file extensions with Content Loading in XNA.

I hope this helps.

weeska

#3 Machaira   Moderators   -  Reputation: 1028

Like
0Likes
Like

Posted 20 August 2012 - 07:40 AM

Answered in the SO post
Microsoft XNA MVP | Check out my blog for random ramblings on XNA game development




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS