indexing description: "[ Scene to demonstrate how resources can be loaded one by one. There's a progress bar showing the current progress of loading. ]" date: "$Date$" revision: "$Revision$" class LOADING_SCENE inherit SHARED_RESOURCES undefine default_create end EM_WIDGET_SCENE redefine initialize_scene, redraw end create make_widget_scene feature -- Initialization initialize_scene is -- initialize the scene do Precursor set_frame_counter_visibility (true) set_background_color (create {EM_COLOR}.make_white) place_widgets resources.load_fonts resources.start_loading_mainscene end redraw is -- redraw the scene do Precursor resources.load_next_mainscene_resource progress_bar.set_current_step (resources.mainscene_progress) if resources.mainscene_is_loaded then if not resources.has_error then resources.free_loadingscene set_next_scene (create {MAIN_SCENE}.make_scene) start_next_scene else quit end end end feature {NONE} -- Implementation place_widgets is -- place the widgets on screen local screen_width, screen_height: INTEGER do screen_width := video_subsystem.video_surface_width screen_height := video_subsystem.video_surface_height create drawable_panel.make_from_container (create {EM_DRAWABLE_CONTAINER [EM_DRAWABLE]}.make) drawable_panel.set_position ((screen_width - resources.sprite_init_em.width) // 2, (0.3 * screen_height).rounded) drawable_panel.set_dimension (resources.sprite_init_em.width, resources.sprite_init_em.height) add_widget (drawable_panel) resources.sprite_init_em.set_do_loop (true) resources.sprite_init_em.start drawable_panel.container.put_first (resources.sprite_init_em) create progress_bar.make_from_steps (resources.num_of_mainscene_resources) progress_bar.set_dimension((0.8 * screen_width).rounded, (0.1 * screen_height).rounded) progress_bar.set_position((screen_width - progress_bar.width) // 2, (0.8 * screen_height).rounded) add_widget (progress_bar) end progress_bar: EM_PROGRESS_BAR drawable_panel: EM_DRAWABLE_PANEL end