G2D Panel Texture Problem

Nov 7, 2010 at 9:16 AM

I am trying to load a texture to a panel that I've created here is the following code:

 G2DPanel playerPic = new G2DPanel();
 playerPic.Bounds = new Rectangle(10,50,100,100);
 playerPic.Texture = Content.Load<Texture2D>("images\\MikuAvatar");

this there something that I am doing wrong? 

Nov 7, 2010 at 5:21 PM

It looks correct. What is the problem?


Nov 8, 2010 at 9:54 PM

Well after I ran this code to create the panel it did not appear when I ran the code, I knew that I've added to the scene correctly. By the way I am using GoblinXNA v3.4.  Also this image is a .png file I wonder if GoblinXNA supports it if not are there any formats that it likes. also do I need to add this:

player.Pic.DrawBackground = true;

If so that does not work either.
Nov 8, 2010 at 11:28 PM
Edited Nov 8, 2010 at 11:29 PM

Goblin supports any image type supported by XNA.

You don't need to set DrawBackground to true.

Are you sure you adding your panel to the scene correctly?

I just tried to simply add a texture in Tutorial 3 by adding the following code right after line 160 (frame.Border = ....)

frame.Texture = Content.Load("brick_wall_14");

And this works perfectly fine.

Note that the brick wall texture is in the /data/Textures folder.