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 Entities.Players is 
  10.  
  11.     type Player is abstract new Entity with private; 
  12.     type A_Player is access all Player'Class; 
  13.  
  14.     -- Notifies the player that something deadly happened to it and it should 
  15.     -- die. The player entity may choose to do nothing if it is currently 
  16.     -- invincible. This procedure must be overridden to provide an 
  17.     -- implementation. 
  18.     procedure Die( this : access Player ) is abstract; 
  19.  
  20.     -- Notifies the player entity that a "start movement" impulse in direction 
  21.     -- 'dir' was received. This procedure must be overridden to provide an 
  22.     -- implementation. 
  23.     procedure Move_Start( this : access Player; dir : Cardinal_Direction ) is abstract; 
  24.  
  25.     -- Notifies the player entity that a "stop movement" impulse in direction 
  26.     -- 'dir' was received. This procedure must be overridden to provide an 
  27.     -- implementation. 
  28.     procedure Move_Stop( this : access Player; dir : Cardinal_Direction ) is abstract; 
  29.  
  30. private 
  31.  
  32.     type Player is abstract new Entity with 
  33.         record 
  34.             alive  : Boolean := True; 
  35.             moving : Direction_Booleans := Direction_Booleans'(others => False); 
  36.         end record; 
  37.  
  38.     -- Constructs the Player object. Subclass constructors should call this 
  39.     -- procedure first. 
  40.     procedure Construct( this    : access Player; 
  41.                          width, 
  42.                          height  : Natural; 
  43.                          libName : String ); 
  44.  
  45.     procedure Object_Read( stream : access Root_Stream_Type'Class; obj : out Player ); 
  46.     for Player'Read use Object_Read; 
  47.  
  48.     procedure Object_Write( stream : access Root_Stream_Type'Class; obj : Player ); 
  49.     for Player'Write use Object_Write; 
  50.  
  51. end Entities.Players;