コード例 #1
0
ファイル: MapViewInfo.cs プロジェクト: aj9251/pandorasbox3
		/// <summary>
		/// Gets the BlockInformation for the current pixel
		/// </summary>
		/// <returns>The BlockInfo for the current view</returns>
		internal PixelCoordinate GetInfo()
		{
			PixelCoordinate coordinate;

			if ( !CurrentBlockIsValid() )
			{
				coordinate = new PixelCoordinate( -1, -1 );
			}
			else
			{
				coordinate = new PixelCoordinate( m_CurrentXBlock - m_ValidStart.XBlock, m_CurrentYBlock - m_ValidStart.YBlock, m_CurrentXCell, m_CurrentYCell, m_ValidYBlocks );
			}

			m_CurrentPoint.X++;

			//if ( m_CurrentPoint.X == ( m_RotateView ? m_ImageSize.Width + 1 : m_ImageSize.Width ) )
			if ( m_CurrentPoint.X == m_ImageSize.Width )
			{
				// move one line down
				m_CurrentPoint.X = 0;
				m_CurrentPoint.Y++;

				m_CurrentXBlock = m_Start.XBlock;
				m_CurrentXCell = m_Start.XCell;

				// Move one cell down
				if ( m_CurrentPoint.Y < m_TopPixels )
				{
					m_CurrentYCell = m_Start.YCell;
					m_CurrentYBlock = m_Start.YBlock;
				}
				else
				{
					if ( ( m_CurrentPoint.Y - m_TopPixels ) % m_PixelsPerCell == 0 )
					{
						m_CurrentYCell += ( 8 / m_CellsPerBlock );

						if ( m_CurrentYCell > 7 )
						{
							m_CurrentYCell %= 8;
							m_CurrentYBlock++;
						}
					}
				}
			}
			else
			{
				if ( ( m_CurrentPoint.X - m_LeftPixels ) % m_PixelsPerCell == 0 )
				{
					// move one step right
					m_CurrentXCell += ( 8 / m_CellsPerBlock );

					if ( m_CurrentXCell > 7 )
					{
						m_CurrentXCell %= 8;
						m_CurrentXBlock++;
					}
				}
			}

			return coordinate;
		}
コード例 #2
0
        /// <summary>
        /// Gets the BlockInformation for the current pixel
        /// </summary>
        /// <returns>The BlockInfo for the current view</returns>
        internal PixelCoordinate GetInfo()
        {
            PixelCoordinate coordinate;

            if (!CurrentBlockIsValid())
            {
                coordinate = new PixelCoordinate(-1, -1);
            }
            else
            {
                coordinate = new PixelCoordinate(m_CurrentXBlock - m_ValidStart.XBlock, m_CurrentYBlock - m_ValidStart.YBlock, m_CurrentXCell, m_CurrentYCell, m_ValidYBlocks);
            }

            m_CurrentPoint.X++;

            //if ( m_CurrentPoint.X == ( m_RotateView ? m_ImageSize.Width + 1 : m_ImageSize.Width ) )
            if (m_CurrentPoint.X == m_ImageSize.Width)
            {
                // move one line down
                m_CurrentPoint.X = 0;
                m_CurrentPoint.Y++;

                m_CurrentXBlock = m_Start.XBlock;
                m_CurrentXCell  = m_Start.XCell;

                // Move one cell down
                if (m_CurrentPoint.Y < m_TopPixels)
                {
                    m_CurrentYCell  = m_Start.YCell;
                    m_CurrentYBlock = m_Start.YBlock;
                }
                else
                {
                    if ((m_CurrentPoint.Y - m_TopPixels) % m_PixelsPerCell == 0)
                    {
                        m_CurrentYCell += (8 / m_CellsPerBlock);

                        if (m_CurrentYCell > 7)
                        {
                            m_CurrentYCell %= 8;
                            m_CurrentYBlock++;
                        }
                    }
                }
            }
            else
            {
                if ((m_CurrentPoint.X - m_LeftPixels) % m_PixelsPerCell == 0)
                {
                    // move one step right
                    m_CurrentXCell += (8 / m_CellsPerBlock);

                    if (m_CurrentXCell > 7)
                    {
                        m_CurrentXCell %= 8;
                        m_CurrentXBlock++;
                    }
                }
            }

            return(coordinate);
        }