This project is read-only.

G2D Panel Texture Problem

Nov 7, 2010 at 10: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 6:21 PM

It looks correct. What is the problem?


Nov 8, 2010 at 10: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 9, 2010 at 12:28 AM
Edited Nov 9, 2010 at 12:29 AM

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.