indexing description: "[ Main scene of normalized example ]" date: "$Date$" revision: "$Revision$" class NORMALIZED_SCENE inherit EM_DRAWABLE_SCENE redefine initialize_scene, handle_update_event end EM_SHARED_BITMAP_FACTORY EM_TIME_SINGLETON SDL_VIDEO_FUNCTIONS_EXTERNAL export {NONE} all end EM_SHARED_SUBSYSTEMS export {NONE} all end create make feature -- Initialization make(a_screen: EM_VIDEO_SURFACE) is -- calls all init functions do make_scene screen := a_screen end feature {NONE} -- Initialization initialize_scene is -- Create all needed objects local i, j: INTEGER do bitmap_factory.create_empty_bitmap (screen.width, screen.height) color := bitmap_factory.last_bitmap color.lock from i := 0 until i >= screen.width loop from j := 0 until j >= screen.height loop color.put_pixel (i, j, create {EM_COLOR}.make_with_rgb(255 - (i*255)//screen.width, 255 - (j*255)//screen.height, 128)) j := j + 1 end i := i + 1 end color.unlock create normalized_speed_string.make_normalized_string normalized_speed_string.set_speed (40) main_container.extend (color) main_container.extend (normalized_speed_string) set_frame_counter_visibility (True) -- Subscribe event handlers event_loop.update_event.subscribe (agent handle_update_event) end handle_update_event is -- Process deltas local delta: INTEGER do delta := normalized_speed_string.get_delta normalized_speed_string.set_x(normalized_speed_string.x + delta) normalized_speed_string.set_y(normalized_speed_string.y + delta) end feature {NONE} -- Implementation normalized_speed_string: NORMALIZED_SPEED_STRING -- String color: EM_BITMAP -- Color -- first_scene: EM_DRAWABLE_SCENE -- -- Screen end