Sha256: 2dfbd70ff14cca91ec412ebf07cf98aa2b4ec76d218ba0e158e83e098f2dd624

Contents?: true

Size: 815 Bytes

Versions: 2

Compression:

Stored size: 815 Bytes

Contents

require 'glimmer_klondike_solitaire/model/dealing_pile'

require_relative 'empty_playing_card'
require_relative 'hidden_playing_card'

class GlimmerKlondikeSolitaire
  module View
    class DealingPile
      include Glimmer::UI::CustomShape
      
      options :pile_x, :pile_y, :model
      
      after_body {
        observe(model, 'playing_cards.empty?') do |empty_value|
          body_root.shapes.to_a.dup.each {|shape| shape.dispose(dispose_images: false)}
          if empty_value
            body_root.content {
              empty_playing_card
            }
          else
            body_root.content {
              hidden_playing_card
            }
          end
        end
      }
  
      body {
        shape(pile_x, pile_y) {
          hidden_playing_card
        }
      }
  
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
glimmer_klondike_solitaire-1.1.0 app/glimmer_klondike_solitaire/view/dealing_pile.rb
glimmer_klondike_solitaire-1.0.1 app/glimmer_klondike_solitaire/view/dealing_pile.rb