package Applications.Gui is
-- An abstract application class with a single window for graphics and
-- mouse/keyboard facilities.
type Gui_Application is abstract new Application with private;
type A_Gui_Application is access all Gui_Application'Class;
-- Returns the title text at the top of the application's window.
function Get_Window_Title( this : not null access Gui_Application'Class ) return String;
private
type Gui_Application is abstract new Application with
record
-- the following fields are protected by .lock
winTitle : Unbounded_String; -- app window title
interactive : Boolean := False; -- application accepts user input
use_mouse : Boolean := False; -- application uses the mouse
xres, yres : Integer := 0; -- window resolution
scale : Integer := 1; -- window scaling factor
end record;
-- Closes the application and releases all resources. Do not call this if
-- the application didn't successfully initialize. This should be called
-- last by an overriding implementation.
procedure Close( this : access Gui_Application );
-- Constructs the application object. Constructs the application using
-- 'name' as the default window title. To specify the window title, call
-- Construct(3) instead. This should be called first by a subclass
-- constructor.
procedure Construct( this : access Gui_Application;
company : String;
name : String );
-- Constructs the application object. 'winTitle' is the title at the top of
-- the application window, if it's running in windowed mode. This should be
-- called first by a subclass constructor.
procedure Construct( this : access Gui_Application;
company : String;
name : String;
winTitle : String );
-- Initializes the application, setting up graphics and hardware. The
-- application will open in 640x400 windowed mode by default. This setting
-- can be overridden by the application's configuration. To specify the
-- default window parameters, call Init(4) instead. Returns True on success.
-- If initialization fails, Close will be called automatically to clean up.
-- No exceptions will be raised. This should be called first by an
-- overriding implementation.
function Init( this : access Gui_Application ) return Boolean;
-- Initializes the application, setting up graphics and hardware. Returns
-- True on success. If initialization fails, Close will be called
-- automatically to clean up. No exceptions will be raised. This should be
-- called first by an overriding implementation.
function Init( this : access Gui_Application;
app_xres,
app_yres : Natural;
app_scale : Positive;
app_windowed : Boolean ) return Boolean;
end Applications.Gui;