pawker/app/hand.rb
def tick(args)
    return if cards.none?

    if ease_x
      @x = ease_x.current(args)
      @ease_x = nil if ease_x.complete?(args)
    end

    if ease_y
      @y = ease_y.current(args)
      @ease_y = nil if ease_y.complete?(args)
    end

    # Position all the cards
    splayed_cards, tucked_cards = splay_and_tuck

    # Calculate the final width
    all_cards = (splayed_cards + tucked_cards)
    width = all_cards.last.x + all_cards.last.w - all_cards.first.x

    # Final height
    height = height_of_cards

    # Draw a light colour outline around the cards
    args.nokia.sprites << { x: x + 1, y: y, w: width, h: height + 2, path: :pixel }.merge(LIGHT_COLOUR_RGB) # Narrow, tall
    args.nokia.sprites << { x: x, y: y + 1, w: width + 2, h: height, path: :pixel }.merge(LIGHT_COLOUR_RGB) # Wide, short

    (splayed_cards + tucked_cards).reverse.each do |card|
      args.nokia.sprites << card
    end
  end
# Render the best combination of cards splayed, then tuck the remaining
# cards underneath.
#
# TODO: When a card gets added or removed, ease it into place
#
# TODO: When a card gets added or removed, ease the size of the box
#
Render the best combination of cards splayed, then tuck the remaining
cards underneath.

When a card gets added or removed, ease it into place

When a card gets added or removed, ease the size of the box
Render the best combination of cards splayed then tuck the remaining cards underneath . When a card gets added or removed ease it into place When a card gets added or removed ease the size of the box
def tick(args)
    return if cards.none?
    if ease_x
      @x = ease_x.current(args)
      @ease_x = nil if ease_x.complete?(args)
    end
    if ease_y
      @y = ease_y.current(args)
      @ease_y = nil if ease_y.complete?(args)
    end
    splayed_cards, tucked_cards = splay_and_tuck
    all_cards = (splayed_cards + tucked_cards)
    width = all_cards.last.x + all_cards.last.w - all_cards.first.x
    height = height_of_cards
    args.nokia.sprites << { x: x + 1, y: y, w: width, h: height + 2, path: :pixel }.merge(LIGHT_COLOUR_RGB) 
    args.nokia.sprites << { x: x, y: y + 1, w: width + 2, h: height, path: :pixel }.merge(LIGHT_COLOUR_RGB) 
    (splayed_cards + tucked_cards).reverse.each do |card|
      args.nokia.sprites << card
    end
  end
def tick ( args ) return if cards . none? if ease_x @x = ease_x . current ( args ) @ease_x = nil if ease_x . complete? ( args ) end if ease_y @y = ease_y . current ( args ) @ease_y = nil if ease_y . complete? ( args ) end splayed_cards , tucked_cards = splay_and_tuck all_cards = ( splayed_cards + tucked_cards ) width = all_cards . last . x + all_cards . last . w - all_cards . first . x height = height_of_cards args . nokia . sprites << { x : x + 1 , y : y , w : width , h : height + 2 , path : :pixel } . merge ( LIGHT_COLOUR_RGB ) args . nokia . sprites << { x : x , y : y + 1 , w : width + 2 , h : height , path : :pixel } . merge ( LIGHT_COLOUR_RGB ) ( splayed_cards + tucked_cards ) . reverse . each do | card | args . nokia . sprites << card end end
Render the best combination of cards splayed, then tuck the remaining
cards underneath.
Render the best combination of cards splayed then tuck the remaining cards underneath .
# Position all the cards # Calculate the final width # Final height # Draw a light colour outline around the cards # Narrow, tall # Wide, short
args