예제 #1
0
 public AGSSpriteSheet(string path, int cellWidth, int cellHeight, int startFromCell = 0, int cellsToGrab = -1, SpriteSheetOrder order = SpriteSheetOrder.TopLeftGoRight)
 {
     CellWidth     = cellWidth;
     CellHeight    = cellHeight;
     Order         = order;
     StartFromCell = startFromCell;
     CellsToGrab   = cellsToGrab;
     Path          = path;
 }
예제 #2
0
		public AGSSpriteSheet (string path, int cellWidth, int cellHeight, int startFromCell = 0, int cellsToGrab = -1, SpriteSheetOrder order = SpriteSheetOrder.TopLeftGoRight)
		{
			CellWidth = cellWidth;
			CellHeight = cellHeight;
			Order = order;
			StartFromCell = startFromCell;
			CellsToGrab = cellsToGrab;
			Path = path;
		}
예제 #3
0
        private void getOrder(SpriteSheetOrder order, int cellsInRow, int cellsInCol, out int startRow, out int startCol,
                              out Point mainStep, out Point secondStep)
        {
            switch (order)
            {
            case SpriteSheetOrder.BottomLeftGoRight:
                startRow   = cellsInCol - 1;
                startCol   = 0;
                mainStep   = new Point(1, 0);
                secondStep = new Point(0, -1);
                break;

            case SpriteSheetOrder.BottomLeftGoUp:
                startRow   = cellsInCol - 1;
                startCol   = 0;
                mainStep   = new Point(0, -1);
                secondStep = new Point(1, 0);
                break;

            case SpriteSheetOrder.BottomRightGoLeft:
                startRow   = cellsInCol - 1;
                startCol   = cellsInRow - 1;
                mainStep   = new Point(-1, 0);
                secondStep = new Point(0, -1);
                break;

            case SpriteSheetOrder.BottomRightGoUp:
                startRow   = cellsInCol - 1;
                startCol   = cellsInRow - 1;
                mainStep   = new Point(0, -1);
                secondStep = new Point(-1, 0);
                break;

            case SpriteSheetOrder.TopLeftGoDown:
                startRow   = 0;
                startCol   = 0;
                mainStep   = new Point(0, 1);
                secondStep = new Point(1, 0);
                break;

            case SpriteSheetOrder.TopLeftGoRight:
                startRow   = 0;
                startCol   = 0;
                mainStep   = new Point(1, 0);
                secondStep = new Point(0, 1);
                break;

            case SpriteSheetOrder.TopRightGoDown:
                startRow   = 0;
                startCol   = cellsInRow - 1;
                mainStep   = new Point(0, 1);
                secondStep = new Point(-1, 0);
                break;

            case SpriteSheetOrder.TopRightGoLeft:
                startRow   = 0;
                startCol   = cellsInRow - 1;
                mainStep   = new Point(-1, 0);
                secondStep = new Point(0, 1);
                break;

            default:
                throw new NotSupportedException($"Sprite sheet order {order} is not supported");
            }
        }
예제 #4
0
		private void getOrder (SpriteSheetOrder order, int cellsInRow, int cellsInCol, out int startRow, out int startCol,
			out Point mainStep, out Point secondStep)
		{
			switch (order) 
			{
				case SpriteSheetOrder.BottomLeftGoRight:
					startRow = cellsInCol - 1;
					startCol = 0;
					mainStep = new Point (1, 0);
					secondStep = new Point (0, -1);
					break;
				case SpriteSheetOrder.BottomLeftGoUp:
					startRow = cellsInCol - 1;
					startCol = 0;
					mainStep = new Point (0, -1);
					secondStep = new Point (1, 0);
					break;
				case SpriteSheetOrder.BottomRightGoLeft:
					startRow = cellsInCol - 1;
					startCol = cellsInRow - 1;
					mainStep = new Point (-1, 0);
					secondStep = new Point (0, -1);
					break;
				case SpriteSheetOrder.BottomRightGoUp:
					startRow = cellsInCol - 1;
					startCol = cellsInRow - 1;
					mainStep = new Point (0, -1);
					secondStep = new Point (-1, 0);
					break;
				case SpriteSheetOrder.TopLeftGoDown:
					startRow = 0;
					startCol = 0;
					mainStep = new Point (0, 1);
					secondStep = new Point (1, 0);
					break;
				case SpriteSheetOrder.TopLeftGoRight:
					startRow = 0;
					startCol = 0;
					mainStep = new Point (1, 0);
					secondStep = new Point (0, 1);
					break;
				case SpriteSheetOrder.TopRightGoDown:
					startRow = 0;
					startCol = cellsInRow - 1;
					mainStep = new Point (0, 1);
					secondStep = new Point (-1, 0);
					break;
				case SpriteSheetOrder.TopRightGoLeft:
					startRow = 0;
					startCol = cellsInRow - 1;
					mainStep = new Point (-1, 0);
					secondStep = new Point (0, 1);
					break;
				default:
					throw new NotSupportedException (string.Format ("Sprite sheet order {0} is not supported", order));
			}
		}