indexing description: "[ An EM_NEVER_ENDING_BACKGROUND_HORIZONTAL is an EM_NEVER_ENDING_BACKGROUND constraint to horizontal movement. ]" date: "$Date$" revision: "$Revision$" class EM_NEVER_ENDING_BACKGROUND_HORIZONTAL inherit EM_NEVER_ENDING_BACKGROUND create make feature {NONE} -- Initialization make (back_ground: EM_DRAWABLE) is -- Creates a EM_NEVER_ENDING_BACKGROUND_HORIZONTAL from `back_ground'. require back_ground /= void do img := back_ground speed:=0 cur_position:=0 create tile_pattern.make (back_ground, 1) last_time_pos_changed := time.ticks set_visible (True) ensure speed=0 end feature -- Commands go_to_time (cur_time: INTEGER) is -- Update `cur_position' up to `cur_time'. do -- Update `cur_position'. update_cur_position (img.width, cur_time) end draw (a_surface: EM_SURFACE) is -- Draws `current' to `a_surface' local pos_x, clip_x: INTEGER do if is_visible then -- Calculate where to draw 'Current'. clip_x := a_surface.coordinate_area.left_bound.floor pos_x := clip_x - pos_to_image_size (clip_x - (x - cur_position), img.width) -- Set up and draw tile pattern filling out `a_surface'. tile_pattern.set_times ((a_surface.coordinate_area.right_bound.ceiling - pos_x) // img.width + 1) tile_pattern.set_x_y (pos_x, y) a_surface.draw_object (tile_pattern) end end feature -- Status report height:INTEGER is -- The height of `current' do result := tile_pattern.height end width:INTEGER is -- The width of `current' do result := result.Max_value end feature {NONE} -- Implementation tile_pattern: EM_TILE_PATTERN_HORIZONTAL end