1. -- 
  2. -- Copyright (c) 2012 Kevin Wellwood 
  3. -- All rights reserved. 
  4. -- 
  5. -- This source code is distributed under the Modified BSD License. For terms and 
  6. -- conditions, see license.txt. 
  7. -- 
  8.  
  9. package Tiles.Matrices is 
  10.  
  11.     -- maximum size of a matrix in either dimension 
  12.     MAX_MATRIX_SIZE : constant := 32; 
  13.  
  14.     ---------------------------------------------------------------------------- 
  15.  
  16.     -- A Tile_Matrix is a two-dimensional array of tile ids. It is stored in the 
  17.     -- index file of a tile library and used to draw repeating tile patterns or 
  18.     -- large tile-based objects when editing a world map. 
  19.     type Tile_Matrix is array (Integer range <>, Integer range <>) of Integer; 
  20.     type A_Tile_Matrix is access all Tile_Matrix; 
  21.  
  22.     -- Returns a copy of the Tile_Matrix. 
  23.     function Copy( src : A_Tile_Matrix ) return A_Tile_Matrix; 
  24.     pragma Postcondition( Copy'Result /= src or else src = null ); 
  25.  
  26.     -- Deletes the Tile_Matrix. 
  27.     procedure Delete( m : in out A_Tile_Matrix ); 
  28.     pragma Postcondition( m = null ); 
  29.  
  30. private 
  31.  
  32.     function A_Tile_Matrix_Input( stream : access Root_Stream_Type'Class ) return A_Tile_Matrix; 
  33.     for A_Tile_Matrix'Input use A_Tile_Matrix_Input; 
  34.  
  35.     procedure A_Tile_Matrix_Output( stream : access Root_Stream_Type'Class; matrix : A_Tile_Matrix ); 
  36.     for A_Tile_Matrix'Output use A_Tile_Matrix_Output; 
  37.  
  38.     procedure A_Tile_Matrix_Read( stream : access Root_Stream_Type'Class; matrix : out A_Tile_Matrix ); 
  39.     for A_Tile_Matrix'Read use A_Tile_Matrix_Read; 
  40.  
  41.     procedure A_Tile_Matrix_Write( stream : access Root_Stream_Type'Class; matrix : A_Tile_Matrix ); 
  42.     for A_Tile_Matrix'Write use A_Tile_Matrix_Write; 
  43.  
  44. end Tiles.Matrices;