1. with Allegro.Bitmaps;                   use Allegro.Bitmaps; 
  2. with Allegro.Fixed_Point_Math;          use Allegro.Fixed_Point_Math; 
  3. with Allegro.Truecolor;                 use Allegro.Truecolor; 
  4.  
  5. package Allegro.Sprites is 
  6.  
  7.     -- Allegro 4.4.1 - Blitting and Sprites 
  8.     -- This package is complete 
  9.  
  10.     -- Drawing modes for Draw_Sprite_Ex 
  11.     DRAW_SPRITE_NORMAL : constant Integer; 
  12.     DRAW_SPRITE_LIT    : constant Integer; 
  13.     DRAW_SPRITE_TRANS  : constant Integer; 
  14.  
  15.     -- Flipping modes for Draw_Sprite_Ex 
  16.     FLIP_DRAW_SPRITE_NO_FLIP : constant Integer; 
  17.     FLIP_DRAW_SPRITE_H_FLIP  : constant Integer; 
  18.     FLIP_DRAW_SPRITE_V_FLIP  : constant Integer; 
  19.     FLIP_DRAW_SPRITE_VH_FLIP : constant Integer; 
  20.  
  21.     ---------------------------------------------------------------------------- 
  22.  
  23.     procedure Blit( source, 
  24.                     dest     : not null A_Bitmap; 
  25.                     source_x, 
  26.                     source_y, 
  27.                     dest_x, 
  28.                     dest_y   : Integer; 
  29.                     width, 
  30.                     height   : Natural ); 
  31.  
  32.     procedure Draw_Character_Ex( bmp, 
  33.                                  sprite : not null A_Bitmap; 
  34.                                  x, y   : Integer; 
  35.                                  color, 
  36.                                  bg     : Color_Type ); 
  37.  
  38.     procedure Draw_Gouraud_Sprite( bmp, 
  39.                                    sprite         : not null A_Bitmap; 
  40.                                    x, y, 
  41.                                    c1, c2, c3, c4 : Color_Type ); 
  42.  
  43.     procedure Draw_Lit_Sprite( bmp, 
  44.                                sprite : not null A_Bitmap; 
  45.                                x, y   : Integer; 
  46.                                color  : Color_Type ); 
  47.  
  48.     procedure Draw_Sprite( bmp, sprite : not null A_Bitmap; x, y : Integer ); 
  49.  
  50.     procedure Draw_Sprite_Ex( bmp, 
  51.                               sprite : not null A_Bitmap; 
  52.                               x, y   : Integer; 
  53.                               mode   : Integer; 
  54.                               flip   : Integer ); 
  55.  
  56.     procedure Draw_Sprite_H_Flip( bmp, sprite : not null A_Bitmap; x, y : Integer ); 
  57.  
  58.     procedure Draw_Sprite_V_Flip( bmp, sprite : not null A_Bitmap; x, y : Integer ); 
  59.  
  60.     procedure Draw_Sprite_VH_Flip( bmp, sprite : not null A_Bitmap; x, y : Integer ); 
  61.  
  62.     procedure Draw_Trans_Sprite( bmp, sprite : not null A_Bitmap; x, y : Integer ); 
  63.  
  64.     procedure Masked_Blit( source, 
  65.                            dest     : not null A_Bitmap; 
  66.                            source_x, 
  67.                            source_y, 
  68.                            dest_x, 
  69.                            dest_y   : Integer; 
  70.                            width, 
  71.                            height   : Natural ); 
  72.  
  73.     procedure Masked_Stretch_Blit( source, 
  74.                                    dest     : not null A_Bitmap; 
  75.                                    source_x, 
  76.                                    source_y : Integer; 
  77.                                    source_w, 
  78.                                    source_h : Natural; 
  79.                                    dest_x, 
  80.                                    dest_y   : Integer; 
  81.                                    dest_w, 
  82.                                    dest_h   : Natural ); 
  83.  
  84.     procedure Pivot_Scaled_Sprite( bmp, 
  85.                                    sprite : not null A_Bitmap; 
  86.                                    x, y, 
  87.                                    cx, cy : Integer; 
  88.                                    angle, 
  89.                                    scale  : Fixed ); 
  90.  
  91.     procedure Pivot_Scaled_Sprite_Lit( bmp, 
  92.                                        sprite : not null A_Bitmap; 
  93.                                        x, y, 
  94.                                        cx, cy : Integer; 
  95.                                        angle, 
  96.                                        scale  : Fixed; 
  97.                                        color  : Color_Type ); 
  98.  
  99.     procedure Pivot_Scaled_Sprite_Trans( bmp, 
  100.                                          sprite : not null A_Bitmap; 
  101.                                          x, y, 
  102.                                          cx, cy : Integer; 
  103.                                          angle, 
  104.                                          scale  : Fixed ); 
  105.  
  106.     procedure Pivot_Scaled_Sprite_V_Flip( bmp, 
  107.                                           sprite : not null A_Bitmap; 
  108.                                           x, y, 
  109.                                           cx, cy : Integer; 
  110.                                           angle, 
  111.                                           scale  : Fixed ); 
  112.  
  113.     procedure Pivot_Scaled_Sprite_V_Flip_Lit( bmp, 
  114.                                               sprite : not null A_Bitmap; 
  115.                                               x, y, 
  116.                                               cx, cy : Integer; 
  117.                                               angle, 
  118.                                               scale  : Fixed; 
  119.                                               color  : Color_Type ); 
  120.  
  121.     procedure Pivot_Scaled_Sprite_V_Flip_Trans( bmp, 
  122.                                                 sprite : not null A_Bitmap; 
  123.                                                 x, y, 
  124.                                                 cx, cy : Integer; 
  125.                                                 angle, 
  126.                                                 scale  : Fixed ); 
  127.  
  128.     procedure Pivot_Sprite( bmp, 
  129.                             sprite : not null A_Bitmap; 
  130.                             x, y, 
  131.                             cx, cy : Integer; 
  132.                             angle  : Fixed ); 
  133.  
  134.     procedure Pivot_Sprite_Lit( bmp, 
  135.                                 sprite : not null A_Bitmap; 
  136.                                 x, y, 
  137.                                 cx, cy : Integer; 
  138.                                 angle  : Fixed; 
  139.                                 color  : Color_Type ); 
  140.  
  141.     procedure Pivot_Sprite_Trans( bmp, 
  142.                                   sprite : not null A_Bitmap; 
  143.                                   x, y, 
  144.                                   cx, cy : Integer; 
  145.                                   angle  : Fixed ); 
  146.  
  147.     procedure Pivot_Sprite_V_Flip( bmp, 
  148.                                    sprite : not null A_Bitmap; 
  149.                                    x, y, 
  150.                                    cx, cy : Integer; 
  151.                                    angle  : Fixed ); 
  152.  
  153.     procedure Pivot_Sprite_V_Flip_Lit( bmp, 
  154.                                        sprite : not null A_Bitmap; 
  155.                                        x, y, 
  156.                                        cx, cy : Integer; 
  157.                                        angle  : Fixed; 
  158.                                        color  : Color_Type ); 
  159.  
  160.     procedure Pivot_Sprite_V_Flip_Trans( bmp, 
  161.                                          sprite : not null A_Bitmap; 
  162.                                          x, y, 
  163.                                          cx, cy : Integer; 
  164.                                          angle  : Fixed ); 
  165.  
  166.     procedure Rotate_Scaled_Sprite( bmp, 
  167.                                     sprite : not null A_Bitmap; 
  168.                                     x, y   : Integer; 
  169.                                     angle, 
  170.                                     scale  : Fixed ); 
  171.  
  172.     procedure Rotate_Scaled_Sprite_Lit( bmp, 
  173.                                         sprite : not null A_Bitmap; 
  174.                                         x, y   : Integer; 
  175.                                         angle, 
  176.                                         scale  : Fixed; 
  177.                                         color  : Color_Type ); 
  178.  
  179.     procedure Rotate_Scaled_Sprite_Trans( bmp, 
  180.                                           sprite : not null A_Bitmap; 
  181.                                           x, y   : Integer; 
  182.                                           angle, 
  183.                                           scale  : Fixed ); 
  184.  
  185.     procedure Rotate_Scaled_Sprite_V_Flip( bmp, 
  186.                                            sprite : not null A_Bitmap; 
  187.                                            x, y   : Integer; 
  188.                                            angle, 
  189.                                            scale  : Fixed ); 
  190.  
  191.     procedure Rotate_Scaled_Sprite_V_Flip_Lit( bmp, 
  192.                                                sprite : not null A_Bitmap; 
  193.                                                x, y   : Integer; 
  194.                                                angle, 
  195.                                                scale  : Fixed; 
  196.                                                color  : Color_Type ); 
  197.  
  198.     procedure Rotate_Scaled_Sprite_V_Flip_Trans( bmp, 
  199.                                                  sprite : not null A_Bitmap; 
  200.                                                  x, y   : Integer; 
  201.                                                  angle, 
  202.                                                  scale  : Fixed ); 
  203.  
  204.     procedure Rotate_Sprite( bmp, 
  205.                              sprite : not null A_Bitmap; 
  206.                              x, y   : Integer; 
  207.                              angle  : Fixed ); 
  208.  
  209.     procedure Rotate_Sprite_Lit( bmp, 
  210.                                  sprite : not null A_Bitmap; 
  211.                                  x, y   : Integer; 
  212.                                  angle  : Fixed; 
  213.                                  color  : Color_Type ); 
  214.  
  215.     procedure Rotate_Sprite_Trans( bmp, 
  216.                                    sprite : not null A_Bitmap; 
  217.                                    x, y   : Integer; 
  218.                                    angle  : Fixed ); 
  219.  
  220.     procedure Rotate_Sprite_V_Flip( bmp, 
  221.                                     sprite : not null A_Bitmap; 
  222.                                     x, y   : Integer; 
  223.                                     angle  : Fixed ); 
  224.  
  225.     procedure Rotate_Sprite_V_Flip_Lit( bmp, 
  226.                                         sprite : not null A_Bitmap; 
  227.                                         x, y   : Integer; 
  228.                                         angle  : Fixed; 
  229.                                         color  : Color_Type ); 
  230.  
  231.     procedure Rotate_Sprite_V_Flip_Trans( bmp, 
  232.                                           sprite : not null A_Bitmap; 
  233.                                           x, y   : Integer; 
  234.                                           angle  : Fixed ); 
  235.  
  236.     procedure Stretch_Blit( source, 
  237.                             dest          : not null A_Bitmap; 
  238.                             source_x, 
  239.                             source_y      : Integer; 
  240.                             source_width, 
  241.                             source_height : Natural; 
  242.                             dest_x, 
  243.                             dest_y        : Integer; 
  244.                             dest_width, 
  245.                             dest_height   : Natural ); 
  246.  
  247.     procedure Stretch_Sprite( bmp, 
  248.                               sprite : not null A_Bitmap; 
  249.                               x, y   : Integer; 
  250.                               w, h   : Natural ); 
  251.  
  252. private 
  253.  
  254.     DRAW_SPRITE_NORMAL : constant Integer := 0; 
  255.     DRAW_SPRITE_LIT    : constant Integer := 1; 
  256.     DRAW_SPRITE_TRANS  : constant Integer := 2; 
  257.  
  258.     FLIP_DRAW_SPRITE_NO_FLIP : constant Integer := 2#00#; 
  259.     FLIP_DRAW_SPRITE_H_FLIP  : constant Integer := 2#01#; 
  260.     FLIP_DRAW_SPRITE_V_FLIP  : constant Integer := 2#10#; 
  261.     FLIP_DRAW_SPRITE_VH_FLIP : constant Integer := 2#11#; 
  262.  
  263.     ---------------------------------------------------------------------------- 
  264.  
  265.     pragma Import( C, Blit, "blit" ); 
  266.     pragma Import( C, Draw_Character_Ex, "draw_character_ex" ); 
  267.     pragma Import( C, Draw_Gouraud_Sprite, "draw_gouraud_sprite" ); 
  268.     pragma Import( C, Draw_Lit_Sprite, "draw_lit_sprite" ); 
  269.     pragma Import( C, Draw_Sprite, "draw_sprite" ); 
  270.     pragma Import( C, Draw_Sprite_Ex, "draw_sprite_ex" ); 
  271.     pragma Import( C, Draw_Sprite_H_Flip, "draw_sprite_h_flip" ); 
  272.     pragma Import( C, Draw_Sprite_V_Flip, "draw_sprite_v_flip" ); 
  273.     pragma Import( C, Draw_Sprite_VH_Flip, "draw_sprite_vh_flip" ); 
  274.     pragma Import( C, Draw_Trans_Sprite, "draw_trans_sprite" ); 
  275.     pragma Import( C, Masked_Blit, "masked_blit" ); 
  276.     pragma Import( C, Masked_Stretch_Blit, "masked_stretch_blit" ); 
  277.     pragma Import( C, Pivot_Scaled_Sprite, "pivot_scaled_sprite" ); 
  278.     pragma Import( C, Pivot_Scaled_Sprite_Lit, "pivot_scaled_sprite_lit" ); 
  279.     pragma Import( C, Pivot_Scaled_Sprite_Trans, "pivot_scaled_sprite_trans" ); 
  280.     pragma Import( C, Pivot_Scaled_Sprite_V_Flip, "pivot_scaled_sprite_v_flip" ); 
  281.     pragma Import( C, Pivot_Scaled_Sprite_V_Flip_Lit, "pivot_scaled_sprite_v_flip_lit" ); 
  282.     pragma Import( C, Pivot_Scaled_Sprite_V_Flip_Trans, "pivot_scaled_sprite_v_flip_trans" ); 
  283.     pragma Import( C, Pivot_Sprite, "pivot_sprite" ); 
  284.     pragma Import( C, Pivot_Sprite_Lit, "pivot_sprite_lit" ); 
  285.     pragma Import( C, Pivot_Sprite_Trans, "pivot_sprite_trans" ); 
  286.     pragma Import( C, Pivot_Sprite_V_Flip, "pivot_sprite_v_flip" ); 
  287.     pragma Import( C, Pivot_Sprite_V_Flip_Lit, "pivot_sprite_v_flip_lit" ); 
  288.     pragma Import( C, Pivot_Sprite_V_Flip_Trans, "pivot_sprite_v_flip_trans" ); 
  289.     pragma Import( C, Rotate_Scaled_Sprite, "rotate_scaled_sprite" ); 
  290.     pragma Import( C, Rotate_Scaled_Sprite_Lit, "rotate_scaled_sprite_lit" ); 
  291.     pragma Import( C, Rotate_Scaled_Sprite_Trans, "rotate_scaled_sprite_trans" ); 
  292.     pragma Import( C, Rotate_Scaled_Sprite_V_Flip, "rotate_scaled_sprite_v_flip" ); 
  293.     pragma Import( C, Rotate_Scaled_Sprite_V_Flip_Lit, "rotate_scaled_sprite_v_flip_lit" ); 
  294.     pragma Import( C, Rotate_Scaled_Sprite_V_Flip_Trans, "rotate_scaled_sprite_v_flip_trans" ); 
  295.     pragma Import( C, Rotate_Sprite, "rotate_sprite" ); 
  296.     pragma Import( C, Rotate_Sprite_Lit, "rotate_sprite_lit" ); 
  297.     pragma Import( C, Rotate_Sprite_Trans, "rotate_sprite_trans" ); 
  298.     pragma Import( C, Rotate_Sprite_V_Flip, "rotate_sprite_v_flip" ); 
  299.     pragma Import( C, Rotate_Sprite_V_Flip_Lit, "rotate_sprite_v_flip_lit" ); 
  300.     pragma Import( C, Rotate_Sprite_V_Flip_Trans, "rotate_sprite_v_flip_trans" ); 
  301.     pragma Import( C, Stretch_Blit, "stretch_blit" ); 
  302.     pragma Import( C, Stretch_Sprite, "stretch_sprite" ); 
  303.  
  304. end Allegro.Sprites;