samples/99_genre_rpg_tactical/gameboard_movement/app/main.rb
def new_button id, x, y, text
  # create a hash ("entity") that has some metadata
  # about what it represents
  entity =
    {
      id: id,
      rect: { x: x, y: y, w: 200, h: 50 }
    }

  # for that entity, define the primitives
  # that form it
  entity[:primitives] =
    [
      { x: x, y: y, w: 200, h: 50 }.border,
      { x: x + 75, y: y + 30, text: text }.label
    ]

  entity
end
# helper method to create a button
helper method to create a button
helper method to create a button
def new_button id, x, y, text
  entity =
    {
      id: id,
      rect: { x: x, y: y, w: 200, h: 50 }
    }
  entity[:primitives] =
    [
      { x: x, y: y, w: 200, h: 50 }.border,
      { x: x + 75, y: y + 30, text: text }.label
    ]
  entity
end
def new_button id , x , y , text entity = { id : id , rect : { x : x , y : y , w : 200 , h : 50 } } entity [ :primitives ] = [ { x : x , y : y , w : 200 , h : 50 } . border , { x : x + 75 , y : y + 30 , text : text } . label ] entity end
helper method to create a button
helper method to create a button
# create a hash ("entity") that has some metadata # about what it represents # for that entity, define the primitives # that form it
id
x
y
text