Source/PlayingCard.m
changeset 3 40d225cf9c43
parent 0 e9f7ba4718e1
child 4 d781b00f3ed4
     1.1 --- a/Source/PlayingCard.m	Fri Mar 07 11:43:02 2008 -0800
     1.2 +++ b/Source/PlayingCard.m	Tue Mar 11 09:21:53 2008 -0700
     1.3 @@ -21,6 +21,7 @@
     1.4      THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     1.5  */
     1.6  #import "PlayingCard.h"
     1.7 +#import "GGBTextLayer.h"
     1.8  #import "QuartzUtils.h"
     1.9  
    1.10  
    1.11 @@ -33,25 +34,31 @@
    1.12  }
    1.13  
    1.14  
    1.15 -- (CALayer*) createFront
    1.16 +- (GGBLayer*) createFront
    1.17  {
    1.18 -    CALayer *front = [super createFront];
    1.19 +    GGBLayer *front = [super createFront];
    1.20      NSString *name = [NSString stringWithFormat: @"%@%@",
    1.21                        self.rankString, self.suitString];
    1.22      
    1.23      CGColorRef suitColor = self.suitColor;
    1.24 -    CATextLayer *label;
    1.25 -    label = AddTextLayer(front, name, [NSFont systemFontOfSize: 18],
    1.26 -                         kCALayerMaxXMargin | kCALayerMinYMargin);
    1.27 +    GGBTextLayer *label;
    1.28 +    label = [GGBTextLayer textLayerInSuperlayer: front
    1.29 +                                       withText: name
    1.30 +                                       fontSize: 18.0
    1.31 +                                      alignment: kCALayerMaxXMargin | kCALayerMinYMargin];
    1.32      label.foregroundColor = suitColor;
    1.33 -    label = AddTextLayer(front, name, [NSFont systemFontOfSize: 18],
    1.34 -                         kCALayerMaxXMargin | kCALayerMaxYMargin);
    1.35 +    label = [GGBTextLayer textLayerInSuperlayer: front
    1.36 +                                       withText: name
    1.37 +                                       fontSize: 18.0
    1.38 +                                      alignment: kCALayerMaxXMargin | kCALayerMaxYMargin];
    1.39      label.foregroundColor = suitColor;
    1.40      label.anchorPoint = CGPointMake(1,1);
    1.41      [label setValue: [NSNumber numberWithFloat: M_PI] forKeyPath: @"transform.rotation"];
    1.42      
    1.43 -    label = AddTextLayer(front, self.faceSymbol, [NSFont systemFontOfSize: 80],
    1.44 -                         kCALayerWidthSizable | kCALayerHeightSizable);
    1.45 +    label = [GGBTextLayer textLayerInSuperlayer: front
    1.46 +                                       withText: self.faceSymbol
    1.47 +                                       fontSize: 80
    1.48 +                                      alignment: kCALayerWidthSizable | kCALayerHeightSizable];
    1.49      label.foregroundColor = suitColor;
    1.50      return front;
    1.51  }
    1.52 @@ -86,7 +93,7 @@
    1.53      static CGColorRef kSuitColor[4];
    1.54      if( ! kSuitColor[0] ) {
    1.55          kSuitColor[0] = kSuitColor[3] = kBlackColor;
    1.56 -        kSuitColor[1] = kSuitColor[2] = CGColorCreateGenericRGB(1, 0, 0, 1);
    1.57 +        kSuitColor[1] = kSuitColor[2] = CreateRGB(1, 0, 0, 1);
    1.58      }
    1.59      return kSuitColor[self.suit];
    1.60  }