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

em.video.opengl

Class EM_GL_SCENE


Direct ancestors

EM_SCENE, EM_SHARED_SUBSYSTEMS, EM_CONSTANTS, GL_FUNCTIONS_EXTERNAL, GLU_FUNCTIONS_EXTERNAL

Features

Invariants

indexing

description

A scene which uses OpenGL to draw its content.

Inherit from this class and put your OpenGL drawing code in the feature draw.
Have a look at the code of redraw and initialize_scene to see which options
of OpenGL are alredy set.

To react on input events, redefine the various handle_* features.

date

$Date$

revision

$Revision$

deferred class

EM_GL_SCENE

inherit

EM_SCENE

feature -- Initialization

uninitialize_scene

-- Uninitialize scene.
-- This is called right before next scene is displayed.
-- Redefine this to clean up some needed things (openGl properties, images, ...)

-- (From EM_SCENE)

feature -- Access

event_loop: EM_EVENT_LOOP

-- Event loop that makes scene running

-- (From EM_SCENE)

field_of_view: DOUBLE

-- Field of view in degrees

max_view_distance: DOUBLE

-- Maximum viewing distance

min_view_distance: DOUBLE

-- Minimal viewing distance

next_scene: EM_SCENE

-- Scene that should be executed after this scene ends.
-- If next_scene = Void the program just ends.

-- (From EM_SCENE)

screen: EM_VIDEO_SURFACE

-- Surface where scene is drawed

-- (From EM_SCENE)

feature -- Status report

is_running: BOOLEAN

-- Is scene currently running?
-- Otherwise no events are dispatched and no animation will run right now.

-- (From EM_SCENE)

feature -- Status setting

set_frame_counter_visibility (a_value: BOOLEAN)

-- If a_value is True make frame counter visible,
-- else make it invisible.

-- (From EM_SCENE)

feature -- Element change

callback_for_set_next_scene_and_start: FUNCTION[ANY, TUPLE[], EM_SCENE]

-- we have to create next scene in same thread as the SDL thread
-- this function should point to a feature were next scene is created

-- (From EM_SCENE)

next_scene_is_set: BOOLEAN

-- Indicates that next scene is set and must be proceeded by
-- the main SDL Thread (syncronise both threads)

-- (From EM_SCENE)

set_field_of_view (a_fov: like field_of_view)

-- Set field_of_view to a_fov.

ensure
field_of_view_set: field_of_view = a_fov
set_max_view_distance (a_distance: like max_view_distance)

-- Set max_view_distance to a_distance.

require
a_distance_positive: a_distance > 0
a_distance_bigger_min: a_distance > min_view_distance
ensure
max_view_distance_set: max_view_distance = a_distance
set_min_view_distance (a_distance: like min_view_distance)

-- Set min_view_distance to a_distance.

require
a_distance_positive: a_distance > 0
a_distance_smaller_max: a_distance < max_view_distance
ensure
min_view_distance_set: min_view_distance = a_distance
set_next_scene (a_scene: like next_scene)

-- Set next_scene to a_scene.

-- (From EM_SCENE)

ensure
next_scene_set: next_scene = a_scene
set_next_scene_from_outside (a_callback: like callback_for_set_next_scene_and_start)

-- Set next_scene to a_scene from an other thread
-- Make sure that start_next_scene is called by the main SDL Thread

-- (From EM_SCENE)

ensure
next_scene_set: callback_for_set_next_scene_and_start = a_callback
next_scene_set: next_scene_is_set = true

feature -- Miscellaneous

quit

-- Stop scene whitout starting another one.

-- (From EM_SCENE)

run (a_screen: EM_VIDEO_SURFACE)

-- Run scene and show it on a_screen.

-- (From EM_SCENE)

require
a_screen_not_void: a_screen /= Void
start_next_scene

-- Stop Current and advance to next_scene.

-- (From EM_SCENE)

start_next_scene_threaded

-- Call creation procedure for next scene and start this scene immediadely

-- (From EM_SCENE)

feature -- Drawing

draw

-- Draw scene.

redraw

-- Redraw scene.

-- (From EM_SCENE)

feature -- Events

animation_event: EM_EVENT_TYPE [TUPLE [INTEGER]]

-- Animation event, allows animatable objects to perform animation
-- (i.e. moving them selves) before they get drawed.
-- As an argument the reference time in milliseconds is passed
-- up to which the animatable objects should draw them selves.
-- This event gets published right before the scene is redrawed.

-- (From EM_SCENE)

feature -- Animation

animate

-- Let all subscribed animatable objects perform their animation.
-- (Calls go_to_time of animatable objects with current time tick)

-- (From EM_SCENE)

start_animating (an_animatable: EM_ANIMATABLE)

-- Subscribe an_animatable to be animated when Current is running.

-- (From EM_SCENE)

stop_animating (an_animatable: EM_ANIMATABLE)

-- Unsubscribe an_animatable from beeing animated when Current is running.

-- (From EM_SCENE)

invariant

-- From EM_SCENE
make_scene_called: is_make_scene_called
animation_event_not_void: animation_event /= Void
event_loop_not_void: event_loop /= Void
screen_not_void_when_running: is_running implies screen /= Void

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

has_running_scene_definition: has_running_scene implies running_scene /= Void

end