5 Replies - 1833 Views - Last Post: 15 February 2010 - 06:42 PM

#1 azuqie  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 13-April 09

How to make image appear in another class

Posted 13 January 2010 - 07:49 PM

i am creating a 3d game something like Halo world...But i don't know how to write the code where by when you select a player .the player you select will appear in another screen...the screen i have now is a screen whereby you need to chose a map and a character..i want that after choosing the selected character will appear in another screen which allow you to modify the character color...


my code for the selection screen is below...

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

using Engine;

namespace App
{
	class ScreenMapRaceSelection : GameScreen
	{
		protected Picture background;
		protected RectButton buttonMap1;
		protected RectButton buttonMap2;
		protected RectButton buttonRace1;
		protected RectButton buttonRace2;
		protected RectButton buttonRace3;
		protected RectButton buttonRace4;
		protected RectButton buttonEnemy1;
		protected RectButton buttonEnemy2;
		protected RectButton buttonEnemy3;
		protected RectButton buttonEnemy4;
		protected RectButton buttonNext;
		protected RectButton buttonBack;	  

		public ScreenMapRaceSelection()
		{
			TransitionOnTime = TimeSpan.FromSeconds(0.5);
			TransitionOffTime = TimeSpan.FromSeconds(1.0);
		}

		// azura todo p1 : we should make sure one screen class mapping one screen folder.   could you create a new folder for this class and put the pictures inside?
		public override void LoadContent()
		{
			background = new Picture(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\screen"), new Vector2(0, 0));

			buttonMap1 = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\map1"),
								ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\map1Down"),
								ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\map1Over"),
								new Rectangle(280,200,200,100));
			buttonMap1.ClickDownEvent+=new EventHandler<EventArgs>(buttonMap1_ClickDownEvent);

			buttonMap2 = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\map2"),
						ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\map2Down"),
						ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\map2Over"),
						new Rectangle(800, 200, 200, 100)); 
			buttonMap2.ClickDownEvent+=new EventHandler<EventArgs>(buttonMap2_ClickDownEvent);

			buttonNext = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\SharedTextures\Next"),
							  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\SharedTextures\NextDown"),
							  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\SharedTextures\NextOver"),
							  new Rectangle(10, 630, 100, 50));
			buttonNext.ClickDownEvent+=new EventHandler<EventArgs>(buttonNext_ClickDownEvent);

			buttonBack = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\SharedTextures\Back"),
					   ScreenManager.Content.Load<Texture2D>(@"Content\Textures\SharedTextures\BackDown"),
					   ScreenManager.Content.Load<Texture2D>(@"Content\Textures\SharedTextures\BackOver"),
					   new Rectangle(1200, 630, 100, 50));
			buttonBack.ClickDownEvent+=new EventHandler<EventArgs>(buttonBack_ClickDownEvent);

			buttonRace1 = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Centaur_Normal"),
					 ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Centaur_Down"),
					 ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Centaur_Over"),
					  new Rectangle(110, 370, 200,100));	  
			buttonRace1.ClickDownEvent+=new EventHandler<EventArgs>(buttonRace1_ClickDownEvent);

			buttonRace2 = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Druid_Normal"),
					  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Druid_Down"),
					  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Druid_Over"),
					  new Rectangle(410, 370, 200,100));
			buttonRace2.ClickDownEvent+=new EventHandler<EventArgs>(buttonRace2_ClickDownEvent);

			buttonRace3 = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Chim_Normal"),
					  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Chim_Down"),
					   ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Chim_Over"),
						new Rectangle(710, 370, 200,100));	 
			buttonRace3.ClickDownEvent+=new EventHandler<EventArgs>(buttonRace3_ClickDownEvent);

			buttonRace4 = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Tuaren_Normal"),
					  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Tuaren_Down"),
					  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Tuaren_Over"),
					  new Rectangle(1010, 370, 200,100));
			buttonRace4.ClickDownEvent+=new EventHandler<EventArgs>(buttonRace4_ClickDownEvent);   

			buttonEnemy1 = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Destroyer_Normal"),
					   ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Destroyer_Down"),
					   ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Destroyer_Over"),
					   new Rectangle(110, 540, 200, 100));
			buttonEnemy1.ClickDownEvent += new EventHandler<EventArgs>(buttonRace1_ClickDownEvent);

			buttonEnemy2 = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Raven_Normal"),
					   ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Raven_Down"),
					   ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Raven_Over"),
					   new Rectangle(410, 540, 200, 100));
			buttonEnemy2.ClickDownEvent += new EventHandler<EventArgs>(buttonRace2_ClickDownEvent);

			buttonEnemy3 = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Cyclops_Normal"),
					   ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Cyclops_Down"),
					   ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\Cyclops_Over"),
					   new Rectangle(710, 540, 200, 100));
			buttonEnemy3.ClickDownEvent += new EventHandler<EventArgs>(buttonRace3_ClickDownEvent);

			buttonEnemy4 = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\MiniBot_Normal"),
					   ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\MiniBot_Down"),
					   ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenMapRacesSelection\MiniBot_Over"),
					   new Rectangle(1000, 540, 200, 100));
			buttonEnemy4.ClickDownEvent += new EventHandler<EventArgs>(buttonRace4_ClickDownEvent);
		 }

		public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
		{
			base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);

			buttonMap1.Update();
			buttonMap2.Update();
			buttonRace1.Update();
			buttonRace2.Update();
			buttonRace3.Update();
			buttonRace4.Update();
			buttonEnemy1.Update();
			buttonEnemy2.Update();
			buttonEnemy3.Update();
			buttonEnemy4.Update();
			buttonBack.Update();
			buttonNext.Update();
		}

		// Only draw backrgound and the 3 buttons
		// 3 buttons are displayed with the current texture 
		// (may be over, normal or down)
		public override void Draw()
		{
			Color color = new Color(255, 255, 255, TransitionAlpha);
			ScreenManager.SpriteBatchBegin();
			background.Draw(ScreenManager.SpriteBatch);
			buttonMap1.Draw(ScreenManager.SpriteBatch);
			buttonMap2.Draw(ScreenManager.SpriteBatch);
			buttonRace1.Draw(ScreenManager.SpriteBatch);
			buttonRace2.Draw(ScreenManager.SpriteBatch);
			buttonRace3.Draw(ScreenManager.SpriteBatch);
			buttonRace4.Draw(ScreenManager.SpriteBatch);
			buttonEnemy1.Draw(ScreenManager.SpriteBatch);
			buttonEnemy2.Draw(ScreenManager.SpriteBatch);
			buttonEnemy3.Draw(ScreenManager.SpriteBatch);
			buttonEnemy4.Draw(ScreenManager.SpriteBatch);
			buttonBack.Draw(ScreenManager.SpriteBatch);
			buttonNext.Draw(ScreenManager.SpriteBatch);
			ScreenManager.SpriteBatch.End();
		}

		void buttonRace4_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
		}

		void buttonRace3_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
		}

		void buttonRace2_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
		}

		void buttonRace1_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
		}

		void buttonMap1_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
		}

		void buttonMap2_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
		}

		void buttonEnemy1_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
		}

		void buttonEnemy2_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
		}

		void buttonEnemy3_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
		}

		void buttonEnemy4_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
		}

		void buttonNext_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
			ScreenManager.RemoveScreen(this);
			ScreenManager.AddScreen(new ScreenColorSelection());
		}

		void buttonBack_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
			ScreenManager.RemoveScreen(this);
			ScreenManager.AddScreen(new ScreenMainMenu());
		}
	}
}




here is the code in my second screen where you can change the player color

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;

using Control;
using Engine;

namespace App
{
	class ScreenColorSelection : GameScreen
	{
		private static Texture2D background;
		private static Texture2D ChoosenRace;
		protected RectButton ButtonChooseColorRed;
		protected RectButton ButtonChooseColorGreen;
		protected RectButton ButtonChooseColorBlue;
		protected RectButton ButtonChooseColorYellow;
		protected RectButton buttonNext;
		protected RectButton buttonBack;
		  
		public ScreenColorSelection()
		{
			TransitionOnTime = TimeSpan.FromSeconds(0.5);
			TransitionOffTime = TimeSpan.FromSeconds(1.0);
		}

		void buttonNext_ClickDownEvent(object sender, EventArgs e)
		{
			Services.InputBase.SetCursor(CursorType.GeneralClick);
			Services.Sound.Play("hit");
			ScreenManager.RemoveScreen(this);
			GameSelectInfo info = GameSelectInfoFactary.CreateGameSelectInfo();
			ScreenLoadingGame screenLoadingGame = new ScreenLoadingGame(info);
			ScreenManager.AddScreen(screenLoadingGame);
		}

		void buttonBack_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
			ScreenLoading.Load(ScreenManager, LoadScreenMapRaceSelection, false, false);
			ScreenManager.RemoveScreen(this);
			ScreenManager.AddScreen(new ScreenMapRaceSelection());

		}

		void ButtonChooseColorYellow_ClickDownEvent(object sender, EventArgs e)
		{
			//Services.Sound.Play("hit");
			ScreenManager.RemoveScreen(this);
			GameSelectInfo info = GameSelectInfoFactary.CreateGameSelectInfo();
			ScreenLoadingGame screenLoadingGame = new ScreenLoadingGame(info);
			ScreenManager.AddScreen(screenLoadingGame);
		}

		void ButtonChooseColorGreen_ClickDownEvent(object sender, EventArgs e)
		{
			//Services.Sound.Play("hit");
			ScreenManager.RemoveScreen(this);
			GameSelectInfo info = GameSelectInfoFactary.CreateGameSelectInfo();
			ScreenLoadingGame screenLoadingGame = new ScreenLoadingGame(info);
			ScreenManager.AddScreen(screenLoadingGame);
		}

		void ButtonChooseColorBlue_ClickDownEvent(object sender, EventArgs e)
		{
			//Services.Sound.Play("hit");
			ScreenManager.RemoveScreen(this);
			GameSelectInfo info = GameSelectInfoFactary.CreateGameSelectInfo();
			ScreenLoadingGame screenLoadingGame = new ScreenLoadingGame(info);
			ScreenManager.AddScreen(screenLoadingGame);
		}

		void ButtonChooseColorRed_ClickDownEvent(object sender, EventArgs e)
		{
			//Services.Sound.Play("hit");
			ScreenManager.RemoveScreen(this);
			GameSelectInfo info = GameSelectInfoFactary.CreateGameSelectInfo();
			ScreenLoadingGame screenLoadingGame = new ScreenLoadingGame(info);
			ScreenManager.AddScreen(screenLoadingGame);
		 
		}

		public override void LoadContent()
		{
			background = ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenColorSelection\ScreenColorSelection");

			ChoosenRace = ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenColorSelection\Race");
						  

		   ButtonChooseColorRed = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenColorSelection\Red"),
								ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenColorSelection\RedDown"),
								ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenColorSelection\RedOver"),
								new Rectangle(925,400,100,100));
		   ButtonChooseColorRed.ClickDownEvent += new EventHandler<EventArgs>(ButtonChooseColorRed_ClickDownEvent);
	 
		   ButtonChooseColorBlue = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenColorSelection\Blue"),
							  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenColorSelection\BlueDown"),
							  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenColorSelection\BlueOver"),
							  new Rectangle(1050, 400, 100, 100));
		   ButtonChooseColorBlue.ClickDownEvent += new EventHandler<EventArgs>(ButtonChooseColorBlue_ClickDownEvent);
		 
		   ButtonChooseColorGreen = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenColorSelection\Green"),
							  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenColorSelection\GreenDown"),
							  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenColorSelection\GreenOver"),
							  new Rectangle(1050, 200, 100, 100));
		   ButtonChooseColorGreen.ClickDownEvent += new EventHandler<EventArgs>(ButtonChooseColorGreen_ClickDownEvent);

		   ButtonChooseColorYellow = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenColorSelection\Yellow"),
							  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenColorSelection\YellowDown"),
							  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\ScreenColorSelection\YellowOver"),
							  new Rectangle(925, 200, 100, 100));
		   ButtonChooseColorYellow.ClickDownEvent += new EventHandler<EventArgs>(ButtonChooseColorYellow_ClickDownEvent);
		
		   buttonNext = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\SharedTextures\Next"),
								  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\SharedTextures\NextDown"),
								  ScreenManager.Content.Load<Texture2D>(@"Content\Textures\SharedTextures\NextOver"),
								  new Rectangle(10, 630, 100, 50));
		   buttonNext.ClickDownEvent += new EventHandler<EventArgs>(buttonNext_ClickDownEvent);
		   buttonBack = new RectButton(ScreenManager.Content.Load<Texture2D>(@"Content\Textures\SharedTextures\Back"),
						   ScreenManager.Content.Load<Texture2D>(@"Content\Textures\SharedTextures\BackDown"),
						   ScreenManager.Content.Load<Texture2D>(@"Content\Textures\SharedTextures\BackOver"),
						   new Rectangle(1200, 630, 100, 50));
		   buttonBack.ClickDownEvent += new EventHandler<EventArgs>(buttonBack_ClickDownEvent);
		
		}

		public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
		{
			base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
			ButtonChooseColorBlue.Update();
			ButtonChooseColorRed.Update();
			ButtonChooseColorYellow.Update();
			ButtonChooseColorGreen.Update();
			buttonBack.Update();
			buttonNext.Update();
		}

		// Only draw backrgound and the 3 buttons
		// 3 buttons are displayed with the current texture 
		// (may be over, normal or down)
		public override void Draw()
		{
			Color color = new Color(255, 255, 255, TransitionAlpha);
			ScreenManager.SpriteBatchBegin();
			ScreenManager.SpriteBatch.Draw(background, new Vector2(0, 0), color);
			ScreenManager.SpriteBatch.Draw(ChoosenRace, new Vector2(100, 150), color);
			ButtonChooseColorBlue.Draw(ScreenManager.SpriteBatch);
			ButtonChooseColorRed.Draw(ScreenManager.SpriteBatch);
			ButtonChooseColorGreen.Draw(ScreenManager.SpriteBatch);
			ButtonChooseColorYellow.Draw(ScreenManager.SpriteBatch);
			buttonBack.Draw(ScreenManager.SpriteBatch);
			buttonNext.Draw(ScreenManager.SpriteBatch);
			ScreenManager.SpriteBatch.End();
		}

		private void OnCancel()
		{
			const string message = "Exit Demo?";
			MessageBoxScreen messageBox = new MessageBoxScreen(message);
			messageBox.Accepted += Exit;
			ScreenManager.AddScreen(messageBox);
			Services.Sound.Play("hit");
		}

		void LoadScreenMapRaceSelection(object sender, EventArgs e)
		{
			ScreenMapRaceSelection ScreenMapRaceSelection = new ScreenMapRaceSelection();
			ScreenManager.AddScreen(ScreenMapRaceSelection);
		}

		void Exit(object sender, EventArgs e)
		{
			ScreenManager.Game.Exit();
		}
	}
}



Mod Edit:
When posting code please use code tags like below.
:code:

Is This A Good Question/Topic? 0
  • +

Replies To: How to make image appear in another class

#2 n8wxs  Icon User is offline

  • --... ...-- -.. . -. ---.. .-- -..- ...
  • member icon

Reputation: 972
  • View blog
  • Posts: 3,878
  • Joined: 07-January 08

Re: How to make image appear in another class

Posted 13 January 2010 - 08:03 PM

Welcome to Dream.In.Code!

Please edit your post to add the :code: tags around your code.

Thanks!

========================
edit: nevermind. A moderator already 'fixed' it. :)

Please use the code tags whenever you post code. Thanks!

This post has been edited by n8wxs: 13 January 2010 - 08:05 PM

Was This Post Helpful? 0
  • +
  • -

#3 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: How to make image appear in another class

Posted 13 January 2010 - 08:08 PM

What you can do is when you call the constructor for the color screen is pass in what they player has selected.

		void buttonNext_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
			ScreenManager.RemoveScreen(this);
						// You would pass something to the constructor here 
			ScreenManager.AddScreen(new ScreenColorSelection()); 
		}



*edit*
Also, moving this to the XNA forum.

This post has been edited by SixOfEleven: 13 January 2010 - 08:10 PM

Was This Post Helpful? 0
  • +
  • -

#4 azuqie  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 13-April 09

Re: How to make image appear in another class

Posted 13 January 2010 - 08:15 PM

View PostSixOfEleven, on 13 Jan, 2010 - 07:08 PM, said:

What you can do is when you call the constructor for the color screen is pass in what they player has selected.

		void buttonNext_ClickDownEvent(object sender, EventArgs e)
		{
			Services.Sound.Play("hit");
			ScreenManager.RemoveScreen(this);
						// You would pass something to the constructor here 
			ScreenManager.AddScreen(new ScreenColorSelection()); 
		}



*edit*
Also, moving this to the XNA forum.



What do mean by the constructor...i am still new in this programming language i am only a student...and doing this big project for school ..i know that i need to write something in between it is just that i am not sure how..can give me some example??Really sorry
Was This Post Helpful? 0
  • +
  • -

#5 SixOfEleven  Icon User is offline

  • using Caffeine;
  • member icon

Reputation: 945
  • View blog
  • Posts: 6,342
  • Joined: 18-October 08

Re: How to make image appear in another class

Posted 14 January 2010 - 07:15 AM

This little bit of code new ScreenColorSelection() calls the constructor for the ScreenColorSelection class. Until you call the constructor of a class the value of the field is null, which means you can't use it. You have to use the new keyword to create an instance of the class. That is what the code does. What you need to do is create a second constructor in the class that will take the object that you want that class to use. Something like this:

public ScreenColorSelection(string value)
{
}



Now, that isn't exactly what you want to do. That is just an example. Now, in the class where you called the constructor you could pass in a string as follows:

ScreenManager.AddScreen(new ScreenColorSelection("some random string")); 



From the looks of your code you want to pass a Texture2D in with the image of the selected race I would gather. So, what you would want is to create a constructor in the ScreenColorSelection class that takes a Texture2D as a parameter and then set the Texture2D you want to edit in the constructor.

ScreenManager.AddScreen(new ScreenColorSelectoin(texture));



Constructor in the ScreenColorSelection class:

public ScreenColorSelection(Texture2D theTexture)
{
	textureFieldInYourClass = theTexture;
	TransitionOnTime = TimeSpan.FromSeconds(0.5);
	TransitionOffTime = TimeSpan.FromSeconds(1.0);
}


Was This Post Helpful? 0
  • +
  • -

#6 Guest_JaCkDaRiPpEr*


Reputation:

Re: How to make image appear in another class

Posted 15 February 2010 - 06:42 PM

Have you checked all layers or even applied them?
Was This Post Helpful? 0

Page 1 of 1