Sha256: e25051d18c833d80d5c43363599b344bd9c2213e5f8d83f0434fda8ad6fd2e79

Contents?: true

Size: 779 Bytes

Versions: 1

Compression:

Stored size: 779 Bytes

Contents

class KlondikeSolitaire
  module View
    class PlayingCard
      include Glimmer::UI::CustomShape
  
      options :card_x, :card_y, :model, :parent_pile
      
      before_body {
        self.card_x ||= 0
        self.card_y ||= 0
      }
  
      body {
        rectangle(card_x, card_y, 49, 79, 15, 15) {
          background model.hidden ? :red : :white
          
          # border
          rectangle(0, 0, 49, 79, 15, 15) {
            foreground :black
          }
          
          unless model.hidden?
            text {
              string model ? "#{model.rank} #{model.suit.to_s[0].upcase}" : ""
              x 5
              y 5
              foreground model ? model.color : :transparent
            }
          end
        }
      }
  
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
glimmer-dsl-swt-4.20.13.8 samples/elaborate/klondike_solitaire/view/playing_card.rb