samples/06_save_load/01_save_load_game/app/main.rb
def button id, x, y, text
    @button_list[id] ||= { # assigns values to hash keys
      id: id,
      text: text,
      primitives: [
        [x + 10, y + 30, text, 2, 0].label, # positions label inside border
        [x, y, 300, 50].border,             # sets definition of border
      ]
    }

    @button_list[id][:primitives] # returns label and border for buttons
  end
# Creates buttons for the button_list and sets their values using a hash (uses symbols as keys)
Creates buttons for the button_list and sets their values using a hash (uses symbols as keys)
Creates buttons for the button_list and sets their values using a hash ( uses symbols as keys )
def button id, x, y, text
    @button_list[id] ||= { 
      id: id,
      text: text,
      primitives: [
        [x + 10, y + 30, text, 2, 0].label, 
        [x, y, 300, 50].border,             
      ]
    }
    @button_list[id][:primitives] 
  end
def button id , x , y , text @button_list [ id ] ||= { id : id , text : text , primitives : [ [ x + 10 , y + 30 , text , 2 , 0 ] . label , [ x , y , 300 , 50 ] . border , ] } @button_list [ id ] [ :primitives ] end
Creates buttons for the button_list and sets their values using a hash (uses symbols as keys)
Creates buttons for the button_list and sets their values using a hash ( uses symbols as keys )
# assigns values to hash keys # positions label inside border # sets definition of border # returns label and border for buttons
id
x
y
text