samples/06_save_load/01_save_load_game/app/main.rb
# Creates a progress bar (used for lighting the fire) and sets its values.
Creates a progress bar (used for lighting the fire) and sets its values.
Creates a progress bar ( used for lighting the fire ) and sets its values .
def progress_bar id, x, y, text, percentage
    @button_list[id] = { 
      id: id,
      text: text,
      primitives: [
        [x, y, 300, 50, 100, 100, 100].solid, 
        [x + 10, y + 30, text, 2, 0].label, 
        [x, y, 300, 50].border, 
      ]
    }
    @button_list[id][:primitives][0][2] = 300 * percentage
    @button_list[id][:primitives]
  end
def progress_bar id , x , y , text , percentage @button_list [ id ] = { id : id , text : text , primitives : [ [ x , y , 300 , 50 , 100 , 100 , 100 ] . solid , [ x + 10 , y + 30 , text , 2 , 0 ] . label , [ x , y , 300 , 50 ] . border , ] } @button_list [ id ] [ :primitives ] [ 0 ] [ 2 ] = 300 * percentage @button_list [ id ] [ :primitives ] end
Creates a progress bar (used for lighting the fire) and sets its values.
Creates a progress bar ( used for lighting the fire ) and sets its values .
# assigns values to hash keys # sets definition for solid (which fills the bar with gray) # sets definition for label, positions inside border # sets definition of border # Fills progress bar based on percentage. If the fire was ready to be lit (100%) and we multiplied by # 100, only 1/3 of the bar would only be filled in. 200 would cause only 2/3 to be filled in.
id
x
y
text
percentage