1. with Associations;                      use Associations; 
  2. with Directions;                        use Directions; 
  3. with Events; 
  4. with Entities;                          use Entities; 
  5. with Hashed_Strings;                    use Hashed_Strings; 
  6. with Recycling_Pools;                   use Recycling_Pools; 
  7. with Values;                            use Values; 
  8.  
  9. pragma Elaborate_All( Events ); 
  10.  
  11. package Events.Entities is 
  12.  
  13.     type Entity_Event is abstract new Event with private; 
  14.  
  15.     function Get_Id( this : not null access Entity_Event'Class ) return Entity_Id; 
  16.  
  17.     ---------------------------------------------------------------------------- 
  18.  
  19.     type Entities_Event is abstract new Event with private; 
  20.  
  21.     function Get_A( this : not null access Entities_Event'Class ) return Entity_Id; 
  22.  
  23.     function Get_B( this : not null access Entities_Event'Class ) return Entity_Id; 
  24.  
  25.     ---------------------------------------------------------------------------- 
  26.  
  27.     type Accelerate_Event is new Entity_Event with private; 
  28.     type A_Accelerate_Event is access all Accelerate_Event'Class; 
  29.  
  30.     ACCELERATE_ID : constant Event_Id := To_Event_Id( "Accelerate" ); 
  31.  
  32.     function Get_Acceleration( this : not null access Accelerate_Event'Class ) return Float; 
  33.     pragma Postcondition( Get_Acceleration'Result >= 0.0 ); 
  34.  
  35.     function Get_Direction( this : not null access Accelerate_Event'Class ) return Cardinal_Direction; 
  36.  
  37.     function Get_Velocity( this : not null access Accelerate_Event'Class ) return Float; 
  38.     pragma Postcondition( Get_Velocity'Result >= 0.0 ); 
  39.  
  40.     ---------------------------------------------------------------------------- 
  41.  
  42.     type Delete_Entity_Event is new Entity_Event with private; 
  43.     type A_Delete_Entity_Event is access all Delete_Entity_Event'Class; 
  44.  
  45.     DELETE_ENTITY_ID : constant Event_Id := To_Event_Id( "Delete_Entity" ); 
  46.  
  47.     ---------------------------------------------------------------------------- 
  48.  
  49.     type Entities_Collided_Event is new Entities_Event with private; 
  50.     type A_Entities_Collided_Event is access all Entities_Collided_Event'Class; 
  51.  
  52.     ENTITIES_COLLIDED_ID: constant Event_Id := To_Event_Id( "Entities_Collided" ); 
  53.  
  54.     ---------------------------------------------------------------------------- 
  55.  
  56.     type Entities_Separated_Event is new Entities_Event with private; 
  57.     type A_Entities_Separated_Event is access all Entities_Separated_Event'Class; 
  58.  
  59.     ENTITIES_SEPARATED_ID: constant Event_Id := To_Event_Id( "Entities_Separated" ); 
  60.  
  61.     ---------------------------------------------------------------------------- 
  62.  
  63.     type Entity_Attribute_Event is new Entity_Event with private; 
  64.  
  65.     -- Returns a copy of the attribute value. The caller is responsible for 
  66.     -- deleting the object. 
  67.     procedure Copy_Value( this : access Entity_Attribute_Event; 
  68.                           val  : in out A_Value ); 
  69.     pragma Precondition( val = null ); 
  70.  
  71.     -- Returns the attribute name. 
  72.     function Get_Attribute( this : access Entity_Attribute_Event ) return String; 
  73.     pragma Postcondition( Get_Attribute'Result'Length > 0 ); 
  74.  
  75.     ---------------------------------------------------------------------------- 
  76.  
  77.     type Entity_Attribute_Changed_Event is new Entity_Attribute_Event with private; 
  78.     type A_Entity_Attribute_Changed_Event is access all Entity_Attribute_Changed_Event; 
  79.  
  80.     ENTITY_ATTRIBUTE_CHANGED_ID : constant Event_Id := To_Event_Id( "Entity_Attribute_Changed" ); 
  81.  
  82.     ---------------------------------------------------------------------------- 
  83.  
  84.     type Entity_Created_Event is new Entity_Event with private; 
  85.     type A_Entity_Created_Event is access all Entity_Created_Event'Class; 
  86.  
  87.     ENTITY_CREATED_ID : constant Event_Id := To_Event_Id( "Entity_Created" ); 
  88.  
  89.     procedure Copy_Attributes( this       : not null access Entity_Created_Event'Class; 
  90.                                attributes : in out A_Association ); 
  91.     pragma Precondition( attributes = null ); 
  92.     pragma Postcondition( attributes /= null ); 
  93.  
  94.     function Get_Class( this : not null access Entity_Created_Event'Class ) return String; 
  95.     pragma Postcondition( Get_Class'Result'Length > 0 ); 
  96.  
  97.     function Get_Frame( this : not null access Entity_Created_Event'Class ) return Natural; 
  98.  
  99.     function Get_Height( this : not null access Entity_Created_Event'Class ) return Natural; 
  100.  
  101.     function Get_Lib_Name( this : not null access Entity_Created_Event'Class ) return String; 
  102.  
  103.     function Get_Width( this : not null access Entity_Created_Event'Class ) return Natural; 
  104.  
  105.     function Get_X( this : not null access Entity_Created_Event'Class ) return Float; 
  106.  
  107.     function Get_XV( this : not null access Entity_Created_Event'Class ) return Float; 
  108.  
  109.     function Get_Y( this : not null access Entity_Created_Event'Class ) return Float; 
  110.  
  111.     function Get_YV( this : not null access Entity_Created_Event'Class ) return Float; 
  112.  
  113.     function Is_Clipped( this : not null access Entity_Created_Event'Class ) return Boolean; 
  114.  
  115.     function Is_Metaphysical( this : not null access Entity_Created_Event'Class ) return Boolean; 
  116.  
  117.     function Is_Physical( this : not null access Entity_Created_Event'Class ) return Boolean; 
  118.  
  119.     ---------------------------------------------------------------------------- 
  120.  
  121.     type Entity_Deleted_Event is new Entity_Event with private; 
  122.     type A_Entity_Deleted_Event is access all Entity_Deleted_Event'Class; 
  123.  
  124.     ENTITY_DELETED_ID : constant Event_Id := To_Event_Id( "Entity_Deleted" ); 
  125.  
  126.     ---------------------------------------------------------------------------- 
  127.  
  128.     type Entity_Tile_Event is abstract new Entity_Event with private; 
  129.  
  130.     -- Returns the X location in tile coordinates. 
  131.     function Get_X( this : not null access Entity_Tile_Event'Class ) return Natural; 
  132.  
  133.     -- Returns the Y location in tile coordinates. 
  134.     function Get_Y( this : not null access Entity_Tile_Event'Class ) return Natural; 
  135.  
  136.     ---------------------------------------------------------------------------- 
  137.  
  138.     type Entity_Entered_Tile_Event is new Entity_Tile_Event with private; 
  139.     type A_Entity_Entered_Tile_Event is access all Entity_Entered_Tile_Event'Class; 
  140.  
  141.     ENTITY_ENTERED_TILE_ID : constant Event_Id := To_Event_Id( "Entity_Entered_Tile" ); 
  142.  
  143.     ---------------------------------------------------------------------------- 
  144.  
  145.     type Entity_Exited_Tile_Event is new Entity_Tile_Event with private; 
  146.     type A_Entity_Exited_Tile_Event is access all Entity_Exited_Tile_Event'Class; 
  147.  
  148.     ENTITY_EXITED_TILE_ID : constant Event_Id := To_Event_Id( "Entity_Exited_Tile" ); 
  149.  
  150.     ---------------------------------------------------------------------------- 
  151.  
  152.     type Entity_Face_Event is new Entity_Event with private; 
  153.     type A_Entity_Face_Event is access all Entity_Face_Event'Class; 
  154.  
  155.     ENTITY_FACE_ID : constant Event_Id := To_Event_Id( "Entity_Face" ); 
  156.  
  157.     function Get_Direction( this : not null access Entity_Face_Event'Class ) return Direction_Type; 
  158.  
  159.     ---------------------------------------------------------------------------- 
  160.  
  161.     type Entity_Grounded_Event is new Entity_Event with private; 
  162.     type A_Entity_Grounded_Event is access all Entity_Grounded_Event'Class; 
  163.  
  164.     ENTITY_GROUNDED_ID : constant Event_Id := To_Event_Id( "Entity_Grounded" ); 
  165.  
  166.     function Is_Grounded( this : not null access Entity_Grounded_Event'Class ) return Boolean; 
  167.  
  168.     ---------------------------------------------------------------------------- 
  169.  
  170.     type Entity_Hit_Wall_Event is new Entity_Event with private; 
  171.     type A_Entity_Hit_Wall_Event is access all Entity_Hit_Wall_Event'Class; 
  172.  
  173.     ENTITY_HIT_WALL_ID : constant Event_Id := To_Event_Id( "Entity_Hit_Wall" ); 
  174.  
  175.     function Get_Direction( this : not null access Entity_Hit_Wall_Event'Class ) return Cardinal_Direction; 
  176.  
  177.     ---------------------------------------------------------------------------- 
  178.  
  179.     type Entity_Moved_Event is new Entity_Event with private; 
  180.     type A_Entity_Moved_Event is access all Entity_Moved_Event'Class; 
  181.  
  182.     ENTITY_MOVED_ID : constant Event_Id := To_Event_Id( "Entity_Moved" ); 
  183.  
  184.     function Get_X( this : not null access Entity_Moved_Event'Class ) return Float; 
  185.  
  186.     function Get_XV( this : not null access Entity_Moved_Event'Class ) return Float; 
  187.  
  188.     function Get_Y( this : not null access Entity_Moved_Event'Class ) return Float; 
  189.  
  190.     function Get_YV( this : not null access Entity_Moved_Event'Class ) return Float; 
  191.  
  192.     ---------------------------------------------------------------------------- 
  193.  
  194.     type Entity_Resized_Event is new Entity_Event with private; 
  195.     type A_Entity_Resized_Event is access all Entity_Resized_Event'Class; 
  196.  
  197.     ENTITY_RESIZED_ID : constant Event_Id := To_Event_Id( "Entity_Resized" ); 
  198.  
  199.     function Get_Height( this : not null access Entity_Resized_Event'Class ) return Natural; 
  200.  
  201.     function Get_Width( this : not null access Entity_Resized_Event'Class ) return Natural; 
  202.  
  203.     ---------------------------------------------------------------------------- 
  204.  
  205.     type Follow_Entity_Event is new Entity_Event with private; 
  206.     type A_Follow_Entity_Event is access all Follow_Entity_Event'Class; 
  207.  
  208.     FOLLOW_ENTITY_ID : constant Event_Id := To_Event_Id( "Follow_Entity" ); 
  209.  
  210.     ---------------------------------------------------------------------------- 
  211.  
  212.     type Frame_Changed_Event is new Entity_Event with private; 
  213.     type A_Frame_Changed_Event is access all Frame_Changed_Event'Class; 
  214.  
  215.     FRAME_CHANGED_ID : constant Event_Id := To_Event_Id( "Frame_Changed" ); 
  216.  
  217.     function Get_Frame( this : not null access Frame_Changed_Event'Class ) return Natural; 
  218.  
  219.     ---------------------------------------------------------------------------- 
  220.  
  221.     type Impulse_Event is new Entity_Event with private; 
  222.     type A_Impulse_Event is access all Impulse_Event'Class; 
  223.  
  224.     IMPULSE_ID : constant Event_Id := To_Event_Id( "Impulse" ); 
  225.  
  226.     function Get_Impulse_Name( this : not null access Impulse_Event'Class ) return Hashed_String; 
  227.  
  228.     ---------------------------------------------------------------------------- 
  229.  
  230.     type Move_Entity_Event is new Entity_Event with private; 
  231.     type A_Move_Entity_Event is access all Move_Entity_Event'Class; 
  232.  
  233.     MOVE_ENTITY_ID : constant Event_Id := To_Event_Id( "Move_Entity" ); 
  234.  
  235.     function Get_X( this : not null access Move_Entity_Event'Class ) return Float; 
  236.  
  237.     function Get_Y( this : not null access Move_Entity_Event'Class ) return Float; 
  238.  
  239.     ---------------------------------------------------------------------------- 
  240.  
  241.     type Resize_Entity_Event is new Entity_Event with private; 
  242.     type A_Resize_Entity_Event is access all Resize_Entity_Event'Class; 
  243.  
  244.     RESIZE_ENTITY_ID : constant Event_Id := To_Event_Id( "Resize_Entity" ); 
  245.  
  246.     function Get_Height( this : not null access Resize_Entity_Event'Class ) return Natural; 
  247.  
  248.     function Get_Width( this : not null access Resize_Entity_Event'Class ) return Natural; 
  249.  
  250.     ---------------------------------------------------------------------------- 
  251.  
  252.     type Set_Entity_Attribute_Event is new Entity_Attribute_Event with private; 
  253.     type A_Set_Entity_Attribute_Event is access all Set_Entity_Attribute_Event; 
  254.  
  255.     SET_ENTITY_ATTRIBUTE_ID : constant Event_Id := To_Event_Id( "Set_Entity_Attribute" ); 
  256.  
  257.     ---------------------------------------------------------------------------- 
  258.  
  259.     type Spawn_Entity_Event is new Event with private; 
  260.     type A_Spawn_Entity_Event is access all Spawn_Entity_Event; 
  261.  
  262.     SPAWN_ENTITY_ID : constant Event_Id := To_Event_Id( "Spawn_Entity" ); 
  263.  
  264.     function Get_Height( this : access Spawn_Entity_Event ) return Integer; 
  265.  
  266.     function Get_Id( this : access Spawn_Entity_Event ) return String; 
  267.  
  268.     function Get_Width( this : access Spawn_Entity_Event ) return Integer; 
  269.  
  270.     function Get_X( this : access Spawn_Entity_Event ) return Float; 
  271.  
  272.     function Get_XV( this : access Spawn_Entity_Event ) return Float; 
  273.  
  274.     function Get_Y( this : access Spawn_Entity_Event ) return Float; 
  275.  
  276.     function Get_YV( this : access Spawn_Entity_Event ) return Float; 
  277.  
  278.     ---------------------------------------------------------------------------- 
  279.  
  280.     procedure Queue_Accelerate( id  : Entity_Id; 
  281.                                 dir : Cardinal_Direction; 
  282.                                 vel : Float; 
  283.                                 acc : Float ); 
  284.     pragma Precondition( vel >= 0.0 ); 
  285.     pragma Precondition( acc >= 0.0 ); 
  286.  
  287.     procedure Queue_Delete_Entity( id : Entity_Id ); 
  288.  
  289.     procedure Queue_Entities_Collided( a, b : Entity_Id ); 
  290.  
  291.     procedure Queue_Entities_Separated( a, b : Entity_Id ); 
  292.  
  293.     procedure Queue_Entity_Attribute_Changed( id        : Entity_Id; 
  294.                                               attribute : String; 
  295.                                               val       : in out A_Value ); 
  296.     pragma Precondition( attribute'Length > 0 ); 
  297.     pragma Postcondition( val = null ); 
  298.  
  299.     -- Argument 'attributes' is copied and unchanged. 
  300.     procedure Queue_Entity_Created( id           : Entity_Id; 
  301.                                     class        : String; 
  302.                                     physical, 
  303.                                     metaphysical, 
  304.                                     clipped      : Boolean; 
  305.                                     width, 
  306.                                     height       : Natural; 
  307.                                     x, y         : Float; 
  308.                                     xv, yv       : Float; 
  309.                                     libName      : String; 
  310.                                     frame        : Natural; 
  311.                                     attributes   : not null A_Association ); 
  312.     pragma Precondition( class'Length > 0 ); 
  313.  
  314.     procedure Queue_Entity_Deleted( id : Entity_Id ); 
  315.  
  316.     procedure Queue_Entity_Entered_Tile( id : Entity_Id; x, y : Natural ); 
  317.  
  318.     procedure Queue_Entity_Exited_Tile( id : Entity_Id; x, y : Natural ); 
  319.  
  320.     procedure Queue_Entity_Face( id : Entity_Id; dir : Direction_Type ); 
  321.  
  322.     procedure Queue_Entity_Grounded( id : Entity_Id; grounded : Boolean ); 
  323.  
  324.     procedure Queue_Entity_Hit_Wall( id : Entity_Id; dir : Cardinal_Direction ); 
  325.  
  326.     procedure Queue_Entity_Moved( id : Entity_Id; x, y, xv, yv : Float ); 
  327.  
  328.     procedure Queue_Entity_Resized( id : Entity_Id; width, height : Natural ); 
  329.  
  330.     procedure Queue_Impulse( id : Entity_Id; name : Hashed_String ); 
  331.  
  332.     procedure Queue_Follow_Entity( id : Entity_Id ); 
  333.  
  334.     procedure Queue_Frame_Changed( id : Entity_Id; frame : Natural ); 
  335.  
  336.     procedure Queue_Move_Entity( id : Entity_Id; x, y : Float ); 
  337.  
  338.     procedure Queue_Resize_Entity( id : Entity_Id; width, height : Natural ); 
  339.  
  340.     procedure Queue_Set_Entity_Attribute( id        : Entity_Id; 
  341.                                           attribute : String; 
  342.                                           val       : in out A_Value ); 
  343.     pragma Precondition( attribute'Length > 0 ); 
  344.     pragma Postcondition( val = null ); 
  345.  
  346.     procedure Queue_Set_Entity_Attribute( id        : Entity_Id; 
  347.                                           attribute : String; 
  348.                                           val       : Boolean ); 
  349.     pragma Precondition( attribute'Length > 0 ); 
  350.  
  351.     procedure Queue_Spawn_Entity( id     : String; 
  352.                                   x, y   : Float; 
  353.                                   width, 
  354.                                   height : Natural := 0; 
  355.                                   xv, yv : Float := 0.0 ); 
  356.     pragma Precondition( id'Length > 0 ); 
  357.  
  358. private 
  359.  
  360.     type Entity_Event is abstract new Event with 
  361.         record 
  362.             id : Entity_Id := INVALID_ID; 
  363.         end record; 
  364.  
  365.     procedure Construct( this : access Entity_Event; name : String; id : Entity_Id ); 
  366.     pragma Precondition( name'Length > 0 ); 
  367.  
  368.     function To_String( this : access Entity_Event ) return String; 
  369.  
  370.     ---------------------------------------------------------------------------- 
  371.  
  372.     type Entities_Event is abstract new Event with 
  373.         record 
  374.             a, b : Entity_Id := INVALID_ID; 
  375.         end record; 
  376.  
  377.     procedure Construct( this : access Entities_Event; name : String; a, b : Entity_Id ); 
  378.     pragma Precondition( name'Length > 0 ); 
  379.  
  380.     function To_String( this : access Entities_Event ) return String; 
  381.  
  382.     ---------------------------------------------------------------------------- 
  383.  
  384.     type Accelerate_Event is new Entity_Event with 
  385.         record 
  386.             dir : Cardinal_Direction := Left; 
  387.             vel : Float := 0.0; 
  388.             acc : Float := 0.0; 
  389.         end record; 
  390.  
  391.     procedure Construct( this : access Accelerate_Event; 
  392.                          id   : Entity_Id; 
  393.                          dir  : Cardinal_Direction; 
  394.                          vel  : Float; 
  395.                          acc  : Float ); 
  396.  
  397.     ---------------------------------------------------------------------------- 
  398.  
  399.     type Delete_Entity_Event is new Entity_Event with null record; 
  400.  
  401.     procedure Construct( this : access Delete_Entity_Event; id : Entity_Id ); 
  402.  
  403.     ---------------------------------------------------------------------------- 
  404.  
  405.     type Entities_Collided_Event is new Entities_Event with null record; 
  406.  
  407.     procedure Construct( this : access Entities_Collided_Event; a, b : Entity_Id ); 
  408.  
  409.     ---------------------------------------------------------------------------- 
  410.  
  411.     type Entities_Separated_Event is new Entities_Event with null record; 
  412.  
  413.     procedure Construct( this : access Entities_Separated_Event; a, b : Entity_Id ); 
  414.  
  415.     ---------------------------------------------------------------------------- 
  416.  
  417.     type Entity_Attribute_Event is new Entity_Event with 
  418.         record 
  419.             attribute : Unbounded_String; 
  420.             val       : A_Value := null; 
  421.         end record; 
  422.  
  423.     procedure Adjust( this : access Entity_Attribute_Event ); 
  424.  
  425.     -- 'name' is event name 
  426.     -- 'attribute' is the name of the attribute 
  427.     -- 'val' is the value of the attribute 
  428.     procedure Construct( this      : access Entity_Attribute_Event; 
  429.                          name      : String; 
  430.                          id        : Entity_Id; 
  431.                          attribute : String; 
  432.                          val       : in out A_Value ); 
  433.     pragma Precondition( name'Length > 0 ); 
  434.     pragma Precondition( attribute'Length > 0 ); 
  435.     pragma Postcondition( val = null ); 
  436.  
  437.     procedure Delete( this : in out Entity_Attribute_Event ); 
  438.  
  439.     ---------------------------------------------------------------------------- 
  440.  
  441.     type Entity_Attribute_Changed_Event is new Entity_Attribute_Event with null record; 
  442.  
  443.     procedure Construct( this      : access Entity_Attribute_Changed_Event; 
  444.                          id        : Entity_Id; 
  445.                          attribute : String; 
  446.                          val       : in out A_Value ); 
  447.     pragma Precondition( attribute'Length > 0 ); 
  448.     pragma Postcondition( val = null ); 
  449.  
  450.     ---------------------------------------------------------------------------- 
  451.  
  452.     type Entity_Created_Event is new Entity_Event with 
  453.         record 
  454.             class        : Unbounded_String; 
  455.             physical     : Boolean := True; 
  456.             metaphysical : Boolean := False; 
  457.             clipped      : Boolean := True; 
  458.             width, 
  459.             height       : Natural := 0; 
  460.             x, y         : Float := 0.0; 
  461.             xv, yv       : Float := 0.0; 
  462.             libName      : Unbounded_String; 
  463.             frame        : Natural := 0; 
  464.             attributes   : A_Association := null; 
  465.         end record; 
  466.  
  467.     procedure Adjust( this : access Entity_Created_Event ); 
  468.  
  469.     procedure Construct( this         : access Entity_Created_Event; 
  470.                          id           : Entity_Id; 
  471.                          class        : String; 
  472.                          physical, 
  473.                          metaphysical, 
  474.                          clipped      : Boolean; 
  475.                          width, 
  476.                          height       : Natural; 
  477.                          x, y         : Float; 
  478.                          xv, yv       : Float; 
  479.                          libName      : String; 
  480.                          frame        : Natural; 
  481.                          attributes   : not null A_Association ); 
  482.  
  483.     procedure Delete( this : in out Entity_Created_Event ); 
  484.  
  485.     function To_String( this : access Entity_Created_Event ) return String; 
  486.  
  487.     ---------------------------------------------------------------------------- 
  488.  
  489.     type Entity_Deleted_Event is new Entity_Event with null record; 
  490.  
  491.     procedure Construct( this : access Entity_Deleted_Event; id : Entity_Id ); 
  492.  
  493.     ---------------------------------------------------------------------------- 
  494.  
  495.     type Entity_Tile_Event is new Entity_Event with 
  496.         record 
  497.             x, y : Natural; 
  498.         end record; 
  499.  
  500.     procedure Construct( this : access Entity_Tile_Event; 
  501.                          name : String; 
  502.                          id   : Entity_Id; 
  503.                          x, y : Natural ); 
  504.  
  505.     ---------------------------------------------------------------------------- 
  506.  
  507.     type Entity_Entered_Tile_Event is new Entity_Tile_Event with null record; 
  508.  
  509.     procedure Construct( this : access Entity_Entered_Tile_Event; 
  510.                          id   : Entity_Id; 
  511.                          x, y : Natural ); 
  512.  
  513.     ---------------------------------------------------------------------------- 
  514.  
  515.     type Entity_Exited_Tile_Event is new Entity_Tile_Event with null record; 
  516.  
  517.     procedure Construct( this : access Entity_Exited_Tile_Event; 
  518.                          id   : Entity_Id; 
  519.                          x, y : Natural ); 
  520.  
  521.     ---------------------------------------------------------------------------- 
  522.  
  523.     type Entity_Face_Event is new Entity_Event with 
  524.         record 
  525.             dir : Direction_Type := Dir_Left; 
  526.         end record; 
  527.  
  528.     procedure Construct( this : access Entity_Face_Event; 
  529.                          id   : Entity_Id; 
  530.                          dir  : Direction_Type ); 
  531.  
  532.     ---------------------------------------------------------------------------- 
  533.  
  534.     type Entity_Grounded_Event is new Entity_Event with 
  535.         record 
  536.             grounded : Boolean := False; 
  537.         end record; 
  538.  
  539.     procedure Construct( this     : access Entity_Grounded_Event; 
  540.                          id       : Entity_Id; 
  541.                          grounded : Boolean ); 
  542.  
  543.     ---------------------------------------------------------------------------- 
  544.  
  545.     type Entity_Hit_Wall_Event is new Entity_Event with 
  546.         record 
  547.             dir : Cardinal_Direction; 
  548.         end record; 
  549.  
  550.     procedure Construct( this : access Entity_Hit_Wall_Event; 
  551.                          id   : Entity_Id; 
  552.                          dir  : Cardinal_Direction ); 
  553.  
  554.     ---------------------------------------------------------------------------- 
  555.  
  556.     type Entity_Moved_Event is new Entity_Event with 
  557.         record 
  558.             x, y   : Float := 0.0; 
  559.             xv, yv : Float := 0.0; 
  560.         end record; 
  561.  
  562.     procedure Construct( this   : access Entity_Moved_Event; 
  563.                          id     : Entity_Id; 
  564.                          x, y   : Float; 
  565.                          xv, yv : Float ); 
  566.  
  567.     ---------------------------------------------------------------------------- 
  568.  
  569.     type Entity_Resized_Event is new Entity_Event with 
  570.         record 
  571.             width, height : Natural := 0; 
  572.         end record; 
  573.  
  574.     procedure Construct( this   : access Entity_Resized_Event; 
  575.                          id     : Entity_Id; 
  576.                          width, 
  577.                          height : Natural ); 
  578.  
  579.     ---------------------------------------------------------------------------- 
  580.  
  581.     type Follow_Entity_Event is new Entity_Event with null record; 
  582.  
  583.     procedure Construct( this : access Follow_Entity_Event; id : Entity_Id ); 
  584.  
  585.     ---------------------------------------------------------------------------- 
  586.  
  587.     type Frame_Changed_Event is new Entity_Event with 
  588.         record 
  589.             frame : Natural; 
  590.         end record; 
  591.  
  592.     procedure Construct( this  : access Frame_Changed_Event; 
  593.                          id    : Entity_Id; 
  594.                          frame : Natural ); 
  595.  
  596.     ---------------------------------------------------------------------------- 
  597.  
  598.     impulse_event_pool : Recycling_Pool; 
  599.  
  600.     type Impulse_Event is new Entity_Event with 
  601.         record 
  602.             name : Hashed_String; 
  603.         end record; 
  604.  
  605.     procedure Construct( this : access Impulse_Event; 
  606.                          id   : Entity_Id; 
  607.                          name : Hashed_String ); 
  608.  
  609.     function To_String( this : access Impulse_Event ) return String; 
  610.  
  611.     ---------------------------------------------------------------------------- 
  612.  
  613.     type Move_Entity_Event is new Entity_Event with 
  614.         record 
  615.             x, y : Float := 0.0; 
  616.         end record; 
  617.  
  618.     procedure Construct( this : access Move_Entity_Event; 
  619.                          id   : Entity_Id; 
  620.                          x, y : Float ); 
  621.  
  622.     ---------------------------------------------------------------------------- 
  623.  
  624.     type Resize_Entity_Event is new Entity_Event with 
  625.         record 
  626.             width, height : Natural := 0; 
  627.         end record; 
  628.  
  629.     procedure Construct( this   : access Resize_Entity_Event; 
  630.                          id     : Entity_Id; 
  631.                          width, 
  632.                          height : Natural ); 
  633.  
  634.     ---------------------------------------------------------------------------- 
  635.  
  636.     type Set_Entity_Attribute_Event is new Entity_Attribute_Event with null record; 
  637.  
  638.     procedure Construct( this      : access Set_Entity_Attribute_Event; 
  639.                          id        : Entity_Id; 
  640.                          attribute : String; 
  641.                          val       : in out A_Value ); 
  642.     pragma Precondition( attribute'Length > 0 ); 
  643.     pragma Postcondition( val = null ); 
  644.  
  645.     ---------------------------------------------------------------------------- 
  646.  
  647.     type Spawn_Entity_Event is new Event with 
  648.         record 
  649.             id     : Unbounded_String; 
  650.             x, y   : Float; 
  651.             width, 
  652.             height : Natural; 
  653.             xv, yv : Float; 
  654.         end record; 
  655.  
  656.     procedure Construct( this   : access Spawn_Entity_Event; 
  657.                          id     : String; 
  658.                          x, y   : Float; 
  659.                          width, 
  660.                          height : Natural; 
  661.                          xv, yv : Float ); 
  662.     pragma Precondition( id'Length > 0 ); 
  663.  
  664.     function To_String( this : access Spawn_Entity_Event ) return String; 
  665.  
  666. end Events.Entities;