Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em

Class EM_APPLICATION


Direct ancestors

EM_SHARED_APPLICATION_ID, EM_SHARED_SUBSYSTEMS, EM_SHARED_BITMAP_FACTORY, EM_SHARED_ERROR_HANDLER, MEMORY, SDL_VIDEO_FUNCTIONS_EXTERNAL

Known direct descendants

EM_EV_WIDGET_SCROLLABLE, EM_EV_WIDGET

Features

Invariants

indexing

description

Base class for interactive EiffelMedia applications.

To start an EiffelMedia application:
- First you have to initialize the screen to run the application on (initialize_screen).
- Set scene to the scene you want to run (a descendant of EM_SCENE, i.e. EM_DRAWABLE_SCENE)
- Call launch to let the application run.

An EM_APPLICATION initializes the video subsystem and holds the screen
on which the application is displayed.
To change the way the screen is initialized, descendant classes can redefine
the feature initialize_video_subsystem to set up the video_subsystem
before the screen is initialized.

date

$Date: 2005/10/26 17:25:41 $

revision

$Revision: 1.20 $

class

EM_APPLICATION

inherit

EM_SHARED_APPLICATION_ID

feature -- Initialization

initialize_screen

-- Initialize screen to video_surface.

ensure
screen_initialized: screen /= Void
initialize_video_subsystem

-- Configure video subsystem.
-- (Descendants can redefine this feature to set up
-- the video system before the screen is initialized)

feature -- Access

icon_filename: STRING

-- Path of applications icon

scene: EM_SCENE

-- Scene that launch executes

screen: EM_VIDEO_SURFACE

-- Screen where application is displayed

window_title: STRING

-- Window Title

feature -- Status report

is_video_subsystem_enabled: BOOLEAN

-- Is video subsystem enabled?

feature -- Element change

set_application_id (an_id: STRING)

-- Set the application's ID. This is ID is used in the EM net libraries and when writing
-- stuff to the user's folder.

require
id_not_void: an_id /= void
is_valid: application_id.is_valid (an_id)
ensure
id_set: application_id.item.is_equal (an_id)
set_scene (a_scene: like scene)

-- Set scene to a_scene.

ensure
scene_set: scene = a_scene
set_window_icon (a_filename: like icon_filename)

-- Set application's window icon to a_filename.
-- Transparent areas of the icon should be green.
-- This is only visible in windowed mode.

require
a_filename_not_void: a_filename /= Void
a_filename_not_empty: not a_filename.is_empty
a_filename_valid: (not a_filename.has ('\')) and (not has_upper (a_filename))
video_subsystem_is_enabled: is_video_subsystem_enabled
ensure
icon_set: icon_filename = a_filename
set_window_title (a_name: like window_title)

-- Set application window title to a_name.
-- This is only visible in windowed mode.

require
a_name_not_void: a_name /= Void
a_name_not_empty: not a_name.is_empty
ensure
title_set: window_title = a_name

feature -- Basic operations

launch

-- Launch the application by running scene.

require
screen_initialized: screen /= Void
scene_not_void: scene /= Void

feature -- Application ID singleton

application_id: EM_APPLICATION_ID

-- Application ID singleton.

-- (From EM_SHARED_APPLICATION_ID)

feature -- Implementation

has_upper (a_string: STRING): BOOLEAN

-- Does a_string contain upper case characters?

invariant


-- From ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)

end