This project is read-only.

Image as button, or adding button texture?

Oct 15, 2011 at 12:37 AM

Hi again Ohan, 

 so this is my question: How can i insert an image as button in my 2DGUI ? or it must be a button with a texture? b/c i search in the Goblin.chm and i found something called backTexture (button Properties)...but it doesnt work at all.. so when i create a G2DButton i found that i can write button1.Texture, but how can i work with that propertie? is that propertie useful to add an image to the button (jpg, png , etc) ?

I hope you can help me!

Oct 19, 2011 at 7:43 AM

i solved it! 

4 anybody who is interested... is really simple.

1.- Create variable Texture2D. Texture2D texture;

2.- In your 2DGUI function put this:  texture = Texture2D.FromFile(GraphicsDevice, "your/path/image.jpg");

3.- Finally u must assign the texture to a button or whatever u want... for example: G2DButton button = new G2DButton(""); button.Texture2D = texture;