Example #1
0
		/// <summary>
		/// Sets guy to be the image in row,col.
		/// </summary>
		/// <param name="guy"></param>
		/// <param name="row"></param>
		/// <param name="col"></param>
		public void SetImageGuy(ImageGuy guy, int row, int col)
		{
			if( row < mImageGuys.Length && col < mImageGuys[row].Length)
			{
				mImageGuys[row][col] = guy;
				this.Invalidate(new Rectangle(row*24, col*24,24,24));
			}
		}
Example #2
0
		public void FillWithImage(ImageGuy guy)
		{
			for(int i = 0; i < mImageGuys.Length; i++)
			{
				for(int j = 0; j < mImageGuys[i].Length; j++)
				{
					mImageGuys[i][j] = guy;
				}
			}
			this.Invalidate();
		}
Example #3
0
		public PlayGraphicPanel()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();
			this.BackColor = Color.Gainsboro;
			this.AllowDrop = true;

			mImageGuys = new ImageGuy[6][];
			for(int i =0; i < mImageGuys.Length; i++)
			{
				mImageGuys[i] = new ImageGuy[7];
			}
		}
Example #4
0
		public TilePanel()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();
			mTiles = new ImageGuy[mColumns][];
			for(int i = 0; i < mTiles.Length; i++)
			{
				mTiles[i] = new ImageGuy[mRows];
			}
			mTileHash = new Hashtable(200);
			// TODO: Add any initialization after the InitializeComponent call

		}
Example #5
0
		/// <summary>
		/// Adds ImageGuy guy to the square that contains x,y.
		/// </summary>
		/// <param name="guy"></param>
		/// <param name="x"></param>
		/// <param name="y"></param>
		public void AddImageGuy(ImageGuy guy, int x, int y )
		{
			int i = (int)x/24;
			int j = (int)y/24;
			if( i < mImageGuys.Length && j < mImageGuys[i].Length )
			{
				mImageGuys[i][j] = guy;
			}
			this.Invalidate(new Rectangle(i*24, j*24,24,24));
		}
Example #6
0
		private void mTilePanel_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
		{
			ImageGuy test = mTilePanel.GetImageGuy(e.X, e.Y);
			
			if( test != null )
			{
				mDragTile = test;
				mDragTileNameLabel.Text = mDragTile.FileNameNoExt;
				this.Invalidate();
			}
		}
Example #7
0
		/// <summary>
		/// Adds the tiles to this control.
		/// </summary>
		/// <param name="fileNames">The file names for the tiles.</param>
		public void AddTiles(string[] fileNames)
		{
			if( fileNames == null || fileNames.Length < 1 )
				return;

			mCurrentX = 0;
			mCurrentY = 0;
			foreach( string file in fileNames )
			{
				ImageGuy img = new ImageGuy( file );
				AddImage(img);
			}
			this.Invalidate();
		}
Example #8
0
		private void AddImage(ImageGuy img)
		{
			if( mCurrentY >= mTiles[1].Length  )
			{
				mCurrentX ++;
				mCurrentY = 0;
			}
			if( mCurrentX < mTiles.Length && mCurrentY < mTiles[0].Length )
			{
				mTiles[mCurrentX][mCurrentY] = img;
				mCurrentY++;
			}
			mTileHash.Add(img.FileNameNoExt, img);
		}