samples/13_path_finding_algorithms/02_detailed_breadth_first_search/app/main.rb
def render_slider
    # Using primitives hides the line under the white circle of the slider
    # Draws the line
    outputs.primitives << [slider.x, slider.y, slider.x + slider.w, slider.y].line
    # The circle needs to be offset so that the center of the circle
    # overlaps the line instead of the upper right corner of the circle
    # The circle's x value is also moved based on the current seach step
    circle_x = (slider.x - slider.offset) + (state.anim_steps * slider.spacing)
    circle_y = (slider.y - slider.offset)
    circle_rect = [circle_x, circle_y, 37, 37]
    outputs.primitives << [circle_rect, 'circle-white.png'].sprite
  end
# Draws the slider so the user can move it and see the progress of the search
Draws the slider so the user can move it and see the progress of the search
Draws the slider so the user can move it and see the progress of the search
def render_slider
    outputs.primitives << [slider.x, slider.y, slider.x + slider.w, slider.y].line
    circle_x = (slider.x - slider.offset) + (state.anim_steps * slider.spacing)
    circle_y = (slider.y - slider.offset)
    circle_rect = [circle_x, circle_y, 37, 37]
    outputs.primitives << [circle_rect, 'circle-white.png'].sprite
  end
def render_slider outputs . primitives << [ slider . x , slider . y , slider . x + slider . w , slider . y ] . line circle_x = ( slider . x - slider . offset ) + ( state . anim_steps * slider . spacing ) circle_y = ( slider . y - slider . offset ) circle_rect = [ circle_x , circle_y , 37 , 37 ] outputs . primitives << [ circle_rect , 'circle-white.png' ] . sprite end
Draws the slider so the user can move it and see the progress of the search
Draws the slider so the user can move it and see the progress of the search
# Using primitives hides the line under the white circle of the slider # Draws the line # The circle needs to be offset so that the center of the circle # overlaps the line instead of the upper right corner of the circle # The circle's x value is also moved based on the current seach step