1. ------------------------------------------------------------------------------ 
  2. --  File :            GLUT-Windows.ads 
  3. --  Description :     A Windowed viewer for GLOBE_3D, based on GLUT 
  4. --  Copyright (c) Gautier de Montmollin/Rod Kay 2006 .. 2008 
  5. ------------------------------------------------------------------------------ 
  6.  
  7. -- tbd : - add new 'traits' for glutGet state data. 
  8. --      - generalise lighting, textures, game controls 
  9. --      - find way to fix visibilty when window is iconised (may be platform dependant). 
  10.  
  11. -- with GL.Geometry; 
  12. -- with GL.skinned_Geometry; 
  13.  
  14. with Game_Control; 
  15. with GLUT.Devices; 
  16.  
  17. with Ada.Strings.Unbounded; 
  18.  
  19. with GLOBE_3D; 
  20.  
  21. package GLUT.Windows is 
  22.  
  23.    procedure Initialize;   -- called before any other operation 
  24.  
  25.    type Window is new GLOBE_3D.Window with private; 
  26.    type Window_view is access all Window'Class; pragma No_Strict_Aliasing (Window_view); 
  27.  
  28.    procedure Define  (Self : in out Window); 
  29.    procedure Destroy (Self : in out Window); 
  30.  
  31.    procedure Name_is (Self : in out Window; Now : String); 
  32.    function  Name    (Self :        Window) return String; 
  33.  
  34.    overriding procedure Enable (Self : in out Window); 
  35.  
  36.    overriding procedure Freshen (Self      : in out Window; 
  37.                       time_Step :        GLOBE_3D.Real; 
  38.                       Extras    :        GLOBE_3D.Visual_array := GLOBE_3D.null_Visuals); 
  39.  
  40.    function is_Closed (Self : Window) return Boolean; 
  41.  
  42.    -- objects 
  43.    -- 
  44.  
  45.    procedure Add (Self : in out Window; the_Object : GLOBE_3D.p_Visual); 
  46.    procedure Rid (Self : in out Window; the_Object : GLOBE_3D.p_Visual); 
  47.  
  48.    function  object_Count (Self : Window) return Natural; 
  49.  
  50.    no_such_Object  : exception;   -- raised when trying to 'rid' an object which has not been added to the Window. 
  51.  
  52.    -- smoothing 
  53.    -- 
  54.  
  55.    type Smoothing_method is (None, Software, Hardware); 
  56.  
  57.    function  Smoothing    (Self :        Window)                             return Smoothing_method; 
  58.    procedure Smoothing_is (Self : in out Window; Now : Smoothing_method); 
  59.  
  60.    -- Status display 
  61.    -- 
  62.  
  63.    function  Show_Status (Self :        Window) return Boolean; 
  64.    procedure Show_Status (Self : in out Window; 
  65.                           Show :        Boolean := True); 
  66.  
  67.    procedure Display_status (Self : in out Window; 
  68.                              sec  :        GLOBE_3D.Real); 
  69.  
  70.    function Frames_per_second (Self : Window) return Float; 
  71.  
  72.    -- Devices 
  73.    -- 
  74.  
  75.    function Keyboard (Self  : access Window'Class) return Devices.p_Keyboard; 
  76.    function Mouse    (Self  : access Window'Class) return Devices.p_Mouse; 
  77.  
  78. private 
  79.  
  80.    type natural_Array is array (Positive range 1 .. 123) of Natural; 
  81.  
  82.    type Window is new GLOBE_3D.Window with 
  83.       record 
  84.          Name          : Ada.Strings.Unbounded.Unbounded_String := Ada.Strings.Unbounded.To_Unbounded_String ("globe3d glut window"); 
  85.          glut_Window   : Integer; 
  86.  
  87.          Objects       : GLOBE_3D.Visual_array (1 .. 5_000); 
  88.          object_Count  : Natural := 0; 
  89.  
  90.          Smoothing     : Smoothing_method := Hardware; 
  91.          is_Visible    : Boolean          := True; 
  92.          is_Closed     : Boolean          := False; 
  93.          Show_Status   : Boolean          := True; 
  94.  
  95.          main_size_x, 
  96.          main_size_y   : GL.Sizei; 
  97.  
  98.          foggy            : Boolean                  := False; 
  99.          frontal_light    : GLOBE_3D.Light_definition; 
  100.          forget_mouse     : Natural                  := 0; 
  101.          full_screen      : Boolean                  := False; 
  102.          Alpha            : GL.Double                := 1.0; 
  103.  
  104.          -- Timer management 
  105.  
  106.          last_time  : Integer; 
  107.          sample     : natural_Array := (others => 0); 
  108.          Average    : GLOBE_3D.Real := 30.0;                                -- avg milliseconds 
  109.          new_scene  : Boolean      := True; 
  110.  
  111.          game_command  : Game_Control.Command_set := Game_Control.no_command; 
  112.  
  113.          -- Devices 
  114.  
  115.          Keyboard  : aliased Devices.Keyboard; 
  116.          Mouse     : aliased Devices.Mouse; 
  117.  
  118.          -- Video management 
  119.  
  120.          is_capturing_Video  : Boolean := False; 
  121.  
  122.       end record; 
  123.  
  124.   -- pragma Linker_options ("-mwindows"); -- Suppress console window 
  125. end GLUT.Windows;