indexing description: "[ Scene to display EM_DRAWABLE's Either create an object to access the `main_container' or create a descendant and redefine `initialize_scene' where you can fill the `main_container' with the contained objects. When the scene is running, all drawable objects contained in `main_container' get drawn onto `screen'. The scene publishes mouse events to drawable objects it contains. Subclasses must call `make_scene' at creation. ]" date: "$Date$" revision: "$Revision$" class EM_DRAWABLE_SCENE inherit EM_SCENE redefine make_scene, run end create make_scene, make_from_container feature {NONE} -- Initialization make_scene is -- Initialise default values. do Precursor {EM_SCENE} create main_container.make create background_color.make_black ensure then main_container_created: main_container /= Void end make_from_container (a_container: EM_DRAWABLE_CONTAINER [EM_DRAWABLE]) is -- Initialise scene with `a_container' as `main_container'. require a_container_not_void: a_container /= Void do make_scene main_container := a_container ensure main_container_set: main_container = a_container end feature -- Initialization initialize_scene is -- Initialize scene by filling `container' with drawables the scene consists of. do end feature -- Access background_color: EM_COLOR -- Color used to fill `screen' before drawing scene -- (If set to Void the screen will not be cleared on each redraw) main_container: EM_DRAWABLE_CONTAINER [EM_DRAWABLE] -- Container for EM_DRAWABLE's on scene. feature -- Element change set_background_color (a_color: EM_COLOR) is -- Set `background_color' to `a_color'. do background_color := a_color ensure background_color_set: background_color = a_color end feature -- Miscellaneous run (a_screen: EM_VIDEO_SURFACE) is -- Run scene and show it on `a_screen'. do event_loop.mouse_button_down_event.subscribe (agent main_container.publish_mouse_event) event_loop.mouse_button_up_event.subscribe (agent main_container.publish_mouse_event) event_loop.mouse_motion_event.subscribe (agent main_container.publish_mouse_event) Precursor {EM_SCENE} (a_screen) end feature -- Drawing redraw is -- Redraw `Current' scene. -- Causes to clear `screen' and redraw `main_container' onto it. do if background_color /= Void then screen.fill (background_color) end main_container.draw (screen) if is_frame_counter_displayed then frame_counter.draw (screen) end screen.redraw end invariant main_container_not_void: main_container /= Void end