1. -- 
  2. -- Copyright (c) 2013 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. with Interfaces;                        use Interfaces; 
  10. with Allegro.Bitmaps;                   use Allegro.Bitmaps; 
  11. with Allegro.Color;                     use Allegro.Color; 
  12.  
  13. -- Allegro 5.0.9 - Display routines 
  14. package Allegro.Displays is 
  15.  
  16.     type Allegro_Display is limited private; 
  17.     type A_Allegro_Display is access all Allegro_Display; 
  18.  
  19.     -- Display creation parameterization 
  20.  
  21.     subtype Display_Flags is Unsigned_32; 
  22.     ALLEGRO_WINDOWED                  : constant Display_Flags; 
  23.     ALLEGRO_FULLSCREEN                : constant Display_Flags; 
  24.     ALLEGRO_OPENGL                    : constant Display_Flags; 
  25.     ALLEGRO_DIRECT3D                  : constant Display_Flags; 
  26.     ALLEGRO_RESIZABLE                 : constant Display_Flags; 
  27.     ALLEGRO_FRAMELESS                 : constant Display_Flags; 
  28.     ALLEGRO_NOFRAME                   : constant Display_Flags; 
  29.     ALLEGRO_GENERATE_EXPOSE_EVENTS    : constant Display_Flags; 
  30.     ALLEGRO_OPENGL_3_0                : constant Display_Flags; 
  31.     ALLEGRO_OPENGL_FORWARD_COMPATIBLE : constant Display_Flags; 
  32.     ALLEGRO_FULLSCREEN_WINDOW         : constant Display_Flags; 
  33.     ALLEGRO_MINIMIZED                 : constant Display_Flags;  -- status only 
  34.  
  35.     type Display_Option is new Integer; 
  36.     ALLEGRO_RED_SIZE               : constant Display_Option; 
  37.     ALLEGRO_GREEN_SIZE             : constant Display_Option; 
  38.     ALLEGRO_BLUE_SIZE              : constant Display_Option; 
  39.     ALLEGRO_ALPHA_SIZE             : constant Display_Option; 
  40.     ALLEGRO_RED_SHIFT              : constant Display_Option; 
  41.     ALLEGRO_GREEN_SHIFT            : constant Display_Option; 
  42.     ALLEGRO_BLUE_SHIFT             : constant Display_Option; 
  43.     ALLEGRO_ALPHA_SHIFT            : constant Display_Option; 
  44.     ALLEGRO_ACC_RED_SIZE           : constant Display_Option; 
  45.     ALLEGRO_ACC_GREEN_SIZE         : constant Display_Option; 
  46.     ALLEGRO_ACC_BLUE_SIZE          : constant Display_Option; 
  47.     ALLEGRO_ACC_ALPHA_SIZE         : constant Display_Option; 
  48.     ALLEGRO_STEREO                 : constant Display_Option; 
  49.     ALLEGRO_AUX_BUFFERS            : constant Display_Option; 
  50.     ALLEGRO_COLOR_SIZE             : constant Display_Option; 
  51.     ALLEGRO_DEPTH_SIZE             : constant Display_Option; 
  52.     ALLEGRO_STENCIL_SIZE           : constant Display_Option; 
  53.     ALLEGRO_SAMPLE_BUFFERS         : constant Display_Option; 
  54.     ALLEGRO_SAMPLES                : constant Display_Option; 
  55.     ALLEGRO_RENDER_METHOD          : constant Display_Option; 
  56.     ALLEGRO_FLOAT_COLOR            : constant Display_Option; 
  57.     ALLEGRO_FLOAT_DEPTH            : constant Display_Option; 
  58.     ALLEGRO_SINGLE_BUFFER          : constant Display_Option; 
  59.     ALLEGRO_SWAP_METHOD            : constant Display_Option; 
  60.     ALLEGRO_COMPATIBLE_DISPLAY     : constant Display_Option; 
  61.     ALLEGRO_UPDATE_DISPLAY_REGION  : constant Display_Option; 
  62.     ALLEGRO_VSYNC                  : constant Display_Option; 
  63.     ALLEGRO_MAX_BITMAP_SIZE        : constant Display_Option; 
  64.     ALLEGRO_SUPPORT_NPOT_BITMAP    : constant Display_Option; 
  65.     ALLEGRO_CAN_DRAW_INTO_BITMAP   : constant Display_Option; 
  66.     ALLEGRO_SUPPORT_SEPARATE_ALPHA : constant Display_Option; 
  67.  
  68.     type Option_Importance is new Integer; 
  69.     ALLEGRO_DONTCARE : constant Option_Importance; 
  70.     ALLEGRO_REQUIRE  : constant Option_Importance; 
  71.     ALLEGRO_SUGGEST  : constant Option_Importance; 
  72.  
  73.     -- Access creation parameters 
  74.  
  75.     function Al_Get_New_Display_Adapter return Integer; 
  76.     pragma Import( C, Al_Get_New_Display_Adapter, "al_get_new_display_adapter" ); 
  77.  
  78.     function Al_Get_New_Display_Flags return Display_Flags; 
  79.     pragma Import( C, Al_Get_New_Display_Flags, "al_get_new_display_flags" ); 
  80.  
  81.     procedure Al_Get_New_Display_Option( option     : Display_Option; 
  82.                                          value      : out Integer; 
  83.                                          importance : out Option_Importance ); 
  84.  
  85.     function Al_Get_New_Display_Refresh_Rate return Integer; 
  86.     pragma Import( C, Al_Get_New_Display_Refresh_Rate, "al_get_new_display_refresh_rate" ); 
  87.  
  88.     procedure Al_Get_New_Window_Position( x, y : access Integer ); 
  89.     pragma Import( C, Al_Get_New_Window_Position, "al_get_new_window_position" ); 
  90.  
  91.     -- Modify creation parameters 
  92.  
  93.     procedure Al_Set_New_Display_Adapter( adapter : Integer ); 
  94.     pragma Import( C, Al_Set_New_Display_Adapter, "al_set_new_display_adapter" ); 
  95.  
  96.     procedure Al_Set_New_Display_Flags( flags : Display_Flags ); 
  97.     pragma Import( C, Al_Set_New_Display_Flags, "al_set_new_display_flags" ); 
  98.  
  99.     procedure Al_Set_New_Display_Option( option     : Display_Option; 
  100.                                          value      : Integer; 
  101.                                          importance : Option_Importance ); 
  102.     pragma Import( C, Al_Set_New_Display_Option, "al_set_new_display_option" ); 
  103.  
  104.     procedure Al_Reset_New_Display_Options; 
  105.     pragma Import( C, Al_Reset_New_Display_Options, "al_reset_new_display_options" ); 
  106.  
  107.     procedure Al_Set_New_Display_Refresh_Rate( refresh_rate : Integer ); 
  108.     pragma Import( C, Al_Set_New_Display_Refresh_Rate, "al_set_new_display_refresh_rate" ); 
  109.  
  110.     procedure Al_Set_New_Window_Position( x, y : Integer ); 
  111.     pragma Import( C, Al_Set_New_Window_Position, "al_set_new_window_position" ); 
  112.  
  113.     -- Display creation 
  114.  
  115.     function Al_Create_Display( w, h : Integer ) return A_Allegro_Display; 
  116.     pragma Import( C, Al_Create_Display, "al_create_display" ); 
  117.  
  118.     procedure Al_Destroy_Display( display : in out A_Allegro_Display ); 
  119.  
  120.     -- Get display properties 
  121.  
  122.     function Al_Get_Backbuffer( display : A_Allegro_Display ) return A_Allegro_Bitmap; 
  123.     pragma Import( C, Al_Get_Backbuffer, "al_get_backbuffer" ); 
  124.  
  125.     function Al_Get_Display_Width( display : A_Allegro_Display ) return Integer; 
  126.     pragma Import( C, Al_Get_Display_Width, "al_get_display_width" ); 
  127.  
  128.     function Al_Get_Display_Height( display : A_Allegro_Display ) return Integer; 
  129.     pragma Import( C, Al_Get_Display_Height, "al_get_display_height" ); 
  130.  
  131.     function Al_Get_Display_Flags( display : A_Allegro_Display ) return Display_Flags; 
  132.     pragma Import( C, Al_Get_Display_Flags, "al_get_display_flags" ); 
  133.  
  134.     function Al_Get_Display_Format( display : A_Allegro_Display ) return Allegro_Pixel_Format; 
  135.     pragma Import( C, Al_Get_Display_Format, "al_get_display_format" ); 
  136.  
  137.     function Al_Get_Display_Option( display : A_Allegro_Display; 
  138.                                     option  : Display_Option ) return Integer; 
  139.     pragma Import( C, Al_Get_Display_Option, "al_get_display_option" ); 
  140.  
  141.     function Al_Get_Display_Refresh_Rate( display : A_Allegro_Display ) return Integer; 
  142.     pragma Import( C, Al_Get_Display_Refresh_Rate, "al_get_display_refresh_rate" ); 
  143.  
  144.     procedure Al_Get_Window_Position( display : A_Allegro_Display; 
  145.                                       x, y    : access Integer ); 
  146.     pragma Import( C, Al_Get_Window_Position, "al_get_window_position" ); 
  147.  
  148.     -- Set display properties 
  149.  
  150.     procedure Al_Set_Display_Icon( display : A_Allegro_Display; 
  151.                                    icon    : A_Allegro_Bitmap ); 
  152.     pragma Import( C, Al_Set_Display_Icon, "al_set_display_icon" ); 
  153.  
  154.     type Allegro_Bitmap_Array is array (Integer range <>) of A_Allegro_Bitmap; 
  155.  
  156.     function Al_Set_Display_Flag( display : A_Allegro_Display; 
  157.                                   flag    : Display_Flags; 
  158.                                   onoff   : Boolean ) return Boolean; 
  159.  
  160.     function Al_Toggle_Display_Flag( display : A_Allegro_Display; 
  161.                                      flag    : Display_Flags; 
  162.                                      onoff   : Boolean ) return Boolean renames Al_Set_Display_Flag; 
  163.  
  164.     procedure Al_Set_Display_Icons( display : A_Allegro_Display; 
  165.                                     icons   : Allegro_Bitmap_Array ); 
  166.  
  167.     procedure Al_Set_Window_Position( display : A_Allegro_Display; x, y : Integer ); 
  168.     pragma Import( C, Al_Set_Window_Position, "al_set_window_position" ); 
  169.  
  170.     procedure Al_Set_Window_Title( display : A_Allegro_Display; title : String ); 
  171.  
  172.     -- Current display operations 
  173.  
  174.     function Al_Get_Current_Display return A_Allegro_Display; 
  175.     pragma Import( C, Al_Get_Current_Display, "al_get_current_display" ); 
  176.  
  177.     function Al_Get_Target_Bitmap return A_Allegro_Bitmap; 
  178.     pragma Import( C, Al_Get_Target_Bitmap, "al_get_target_bitmap" ); 
  179.  
  180.     procedure Al_Set_Target_Bitmap( bitmap : A_Allegro_Bitmap ); 
  181.     pragma Import( C, Al_Set_Target_Bitmap, "al_set_target_bitmap" ); 
  182.  
  183.     procedure Al_Set_Target_Backbuffer( display : A_Allegro_Display ); 
  184.     pragma Import( C, Al_Set_Target_Backbuffer, "al_set_target_backbuffer" ); 
  185.  
  186.     function Al_Wait_For_Vsync return Boolean; 
  187.  
  188.     procedure Al_Flip_Display; 
  189.     pragma Import( C, Al_Flip_Display, "al_flip_display" ); 
  190.  
  191.     procedure Al_Update_Display_Region( x, y          : Integer; 
  192.                                         width, height : Integer ); 
  193.     pragma Import( C, Al_Update_Display_Region, "al_update_display_region" ); 
  194.  
  195.     procedure Al_Hold_Bitmap_Drawing( hold : Boolean ); 
  196.  
  197.     function Al_Is_Bitmap_Drawing_Held return Boolean; 
  198.  
  199.     function Al_Inhibit_Screensaver( inhibit : Boolean ) return Boolean; 
  200.  
  201.     function Al_Is_Compatible_Bitmap( bitmap : A_Allegro_Bitmap ) return Boolean; 
  202.  
  203.     -- Display resizing 
  204.  
  205.     function Al_Acknowledge_Resize( display : A_Allegro_Display ) return Boolean; 
  206.  
  207.     -- Calls Al_Acknowledge_Resize, ignoring any errors. 
  208.     procedure Al_Acknowledge_Resize( display : A_Allegro_Display ); 
  209.  
  210.     function Al_Resize_Display( display       : A_Allegro_Display; 
  211.                                 width, height : Integer ) return Boolean; 
  212.  
  213.     -- Events 
  214.  
  215.     function Al_Get_Display_Event_Source( display : A_Allegro_Display ) return A_Allegro_Event_Source; 
  216.     pragma Import( C, Al_Get_Display_Event_Source, "al_get_display_event_source" ); 
  217.  
  218.     type Allegro_Display_Orientation is private; 
  219.     ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES   : constant Allegro_Display_Orientation; 
  220.     ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES  : constant Allegro_Display_Orientation; 
  221.     ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES : constant Allegro_Display_Orientation; 
  222.     ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES : constant Allegro_Display_Orientation; 
  223.     ALLEGRO_DISPLAY_ORIENTATION_FACE_UP     : constant Allegro_Display_Orientation; 
  224.     ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN   : constant Allegro_Display_Orientation; 
  225.  
  226. private 
  227.  
  228.     type Allegro_Display is limited null record; 
  229.     pragma Convention( C, Allegro_Display ); 
  230.  
  231.     ALLEGRO_WINDOWED                  : constant Display_Flags := 1; 
  232.     ALLEGRO_FULLSCREEN                : constant Display_Flags := 2; 
  233.     ALLEGRO_OPENGL                    : constant Display_Flags := 4; 
  234.     ALLEGRO_DIRECT3D                  : constant Display_Flags := 8; 
  235.     ALLEGRO_RESIZABLE                 : constant Display_Flags := 16; 
  236.     ALLEGRO_FRAMELESS                 : constant Display_Flags := 32; 
  237.     ALLEGRO_NOFRAME                   : constant Display_Flags := ALLEGRO_FRAMELESS; 
  238.     ALLEGRO_GENERATE_EXPOSE_EVENTS    : constant Display_Flags := 64; 
  239.     ALLEGRO_OPENGL_3_0                : constant Display_Flags := 128; 
  240.     ALLEGRO_OPENGL_FORWARD_COMPATIBLE : constant Display_Flags := 256; 
  241.     ALLEGRO_FULLSCREEN_WINDOW         : constant Display_Flags := 512; 
  242.     ALLEGRO_MINIMIZED                 : constant Display_Flags := 1024; 
  243.  
  244.     ALLEGRO_RED_SIZE               : constant Display_Option := 0; 
  245.     ALLEGRO_GREEN_SIZE             : constant Display_Option := 1; 
  246.     ALLEGRO_BLUE_SIZE              : constant Display_Option := 2; 
  247.     ALLEGRO_ALPHA_SIZE             : constant Display_Option := 3; 
  248.     ALLEGRO_RED_SHIFT              : constant Display_Option := 4; 
  249.     ALLEGRO_GREEN_SHIFT            : constant Display_Option := 5; 
  250.     ALLEGRO_BLUE_SHIFT             : constant Display_Option := 6; 
  251.     ALLEGRO_ALPHA_SHIFT            : constant Display_Option := 7; 
  252.     ALLEGRO_ACC_RED_SIZE           : constant Display_Option := 8; 
  253.     ALLEGRO_ACC_GREEN_SIZE         : constant Display_Option := 9; 
  254.     ALLEGRO_ACC_BLUE_SIZE          : constant Display_Option := 10; 
  255.     ALLEGRO_ACC_ALPHA_SIZE         : constant Display_Option := 11; 
  256.     ALLEGRO_STEREO                 : constant Display_Option := 12; 
  257.     ALLEGRO_AUX_BUFFERS            : constant Display_Option := 13; 
  258.     ALLEGRO_COLOR_SIZE             : constant Display_Option := 14; 
  259.     ALLEGRO_DEPTH_SIZE             : constant Display_Option := 15; 
  260.     ALLEGRO_STENCIL_SIZE           : constant Display_Option := 16; 
  261.     ALLEGRO_SAMPLE_BUFFERS         : constant Display_Option := 17; 
  262.     ALLEGRO_SAMPLES                : constant Display_Option := 18; 
  263.     ALLEGRO_RENDER_METHOD          : constant Display_Option := 19; 
  264.     ALLEGRO_FLOAT_COLOR            : constant Display_Option := 20; 
  265.     ALLEGRO_FLOAT_DEPTH            : constant Display_Option := 21; 
  266.     ALLEGRO_SINGLE_BUFFER          : constant Display_Option := 22; 
  267.     ALLEGRO_SWAP_METHOD            : constant Display_Option := 23; 
  268.     ALLEGRO_COMPATIBLE_DISPLAY     : constant Display_Option := 24; 
  269.     ALLEGRO_UPDATE_DISPLAY_REGION  : constant Display_Option := 25; 
  270.     ALLEGRO_VSYNC                  : constant Display_Option := 26; 
  271.     ALLEGRO_MAX_BITMAP_SIZE        : constant Display_Option := 27; 
  272.     ALLEGRO_SUPPORT_NPOT_BITMAP    : constant Display_Option := 28; 
  273.     ALLEGRO_CAN_DRAW_INTO_BITMAP   : constant Display_Option := 29; 
  274.     ALLEGRO_SUPPORT_SEPARATE_ALPHA : constant Display_Option := 30; 
  275.  
  276.     ALLEGRO_DONTCARE : constant Option_Importance := 0; 
  277.     ALLEGRO_REQUIRE  : constant Option_Importance := 1; 
  278.     ALLEGRO_SUGGEST  : constant Option_Importance := 2; 
  279.  
  280.     type Allegro_Display_Orientation is new Integer; 
  281.     ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES   : constant Allegro_Display_Orientation := 0; 
  282.     ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES  : constant Allegro_Display_Orientation := 1; 
  283.     ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES : constant Allegro_Display_Orientation := 2; 
  284.     ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES : constant Allegro_Display_Orientation := 3; 
  285.     ALLEGRO_DISPLAY_ORIENTATION_FACE_UP     : constant Allegro_Display_Orientation := 4; 
  286.     ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN   : constant Allegro_Display_Orientation := 5; 
  287.  
  288. end Allegro.Displays;