Class: Skin
- Inherits:
-
Object
- Object
- Skin
- Defined in:
- lib/rubysketch/solitaire/skin.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
Class Method Summary collapse
Instance Method Summary collapse
- #backgroundCheckerColors ⇒ Object
- #blackColor ⇒ Object
- #buttonColor ⇒ Object
- #cardSpriteSize ⇒ Object
- #closedImage ⇒ Object
-
#initialize(index = 0) ⇒ Skin
constructor
A new instance of Skin.
- #margin ⇒ Object
- #markColor(mark) ⇒ Object
- #menuIcon ⇒ Object
- #openedImage(mark, number) ⇒ Object
- #pauseIcon ⇒ Object
- #redColor ⇒ Object
- #settingsIcon ⇒ Object
- #translucentBackgroundColor ⇒ Object
Constructor Details
#initialize(index = 0) ⇒ Skin
Returns a new instance of Skin.
13 14 15 |
# File 'lib/rubysketch/solitaire/skin.rb', line 13 def initialize(index = 0) @index = index % self.class.offsets.size end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
17 18 19 |
# File 'lib/rubysketch/solitaire/skin.rb', line 17 def index @index end |
Class Method Details
.setup ⇒ Object
6 7 8 9 10 11 |
# File 'lib/rubysketch/solitaire/skin.rb', line 6 def self.setup() ncolumns = 7 size = [width, height].min @margin = size * 0.02 @cardSpriteWidth = (size - @margin * (ncolumns + 1)) / ncolumns end |
Instance Method Details
#backgroundCheckerColors ⇒ Object
43 44 45 |
# File 'lib/rubysketch/solitaire/skin.rb', line 43 def backgroundCheckerColors() @backgroundColors ||= self.class.colors[index][0, 2] end |
#blackColor ⇒ Object
51 52 53 |
# File 'lib/rubysketch/solitaire/skin.rb', line 51 def blackColor() @blackColor ||= self.class.colors[index][3] end |
#buttonColor ⇒ Object
55 56 57 |
# File 'lib/rubysketch/solitaire/skin.rb', line 55 def () @buttonColor ||= self.class.colors[index][4] end |
#cardSpriteSize ⇒ Object
39 40 41 |
# File 'lib/rubysketch/solitaire/skin.rb', line 39 def cardSpriteSize() @cardSpriteSize ||= self.class.cardSpriteSize end |
#closedImage ⇒ Object
31 32 33 |
# File 'lib/rubysketch/solitaire/skin.rb', line 31 def closedImage() @closedImage ||= self.class.closedImages[index] end |
#margin ⇒ Object
63 64 65 |
# File 'lib/rubysketch/solitaire/skin.rb', line 63 def margin() self.class.margin end |
#markColor(mark) ⇒ Object
67 68 69 |
# File 'lib/rubysketch/solitaire/skin.rb', line 67 def markColor(mark) Card::MARKS[0, 2].include?(mark) ? redColor : blackColor end |
#menuIcon ⇒ Object
23 24 25 |
# File 'lib/rubysketch/solitaire/skin.rb', line 23 def () @menuIcon ||= self.class.getAssetImage 64, 192, 64, 64 end |
#openedImage(mark, number) ⇒ Object
35 36 37 |
# File 'lib/rubysketch/solitaire/skin.rb', line 35 def openedImage(mark, number) (@openedImages ||= {})[[mark, number]] ||= createOpenedImage mark, number end |
#pauseIcon ⇒ Object
19 20 21 |
# File 'lib/rubysketch/solitaire/skin.rb', line 19 def pauseIcon() @pauseIcon ||= self.class.getAssetImage 0, 192, 64, 64 end |
#redColor ⇒ Object
47 48 49 |
# File 'lib/rubysketch/solitaire/skin.rb', line 47 def redColor() @redColor ||= self.class.colors[index][2] end |
#settingsIcon ⇒ Object
27 28 29 |
# File 'lib/rubysketch/solitaire/skin.rb', line 27 def settingsIcon() @settingsIcon ||= self.class.getAssetImage 128, 192, 64, 64 end |
#translucentBackgroundColor ⇒ Object
59 60 61 |
# File 'lib/rubysketch/solitaire/skin.rb', line 59 def translucentBackgroundColor() [0, 0, 0, 64] end |