Skip to content

Commit 118936c

Browse files
committed
CCButtons now utilize Float opacity instead of int opacity.
Former-commit-id: 59482cc
1 parent 35d75ea commit 118936c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

cocos2d-ui/CCButton.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ - (id) initWithTitle:(NSString*) title spriteFrame:(CCSpriteFrame*) spriteFrame
8484
[self setBackgroundColor:[CCColor colorWithWhite:0.7 alpha:1] forState:CCControlStateHighlighted];
8585
[self setLabelColor:[CCColor colorWithWhite:0.7 alpha:1] forState:CCControlStateHighlighted];
8686

87-
[self setBackgroundOpacity:127 forState:CCControlStateDisabled];
88-
[self setLabelOpacity:127 forState:CCControlStateDisabled];
87+
[self setBackgroundOpacity:0.5f forState:CCControlStateDisabled];
88+
[self setLabelOpacity:0.5f forState:CCControlStateDisabled];
8989

9090
return self;
9191
}
@@ -489,15 +489,15 @@ - (void) setValue:(id)value forKey:(NSString *)key state:(CCControlState)state
489489
{
490490
if ([key isEqualToString:@"labelOpacity"])
491491
{
492-
[self setLabelOpacity:[value intValue] forState:state];
492+
[self setLabelOpacity:[value floatValue] forState:state];
493493
}
494494
else if ([key isEqualToString:@"labelColor"])
495495
{
496496
[self setLabelColor:value forState:state];
497497
}
498498
else if ([key isEqualToString:@"backgroundOpacity"])
499499
{
500-
[self setBackgroundOpacity:[value intValue] forState:state];
500+
[self setBackgroundOpacity:[value floatValue] forState:state];
501501
}
502502
else if ([key isEqualToString:@"backgroundColor"])
503503
{
@@ -513,15 +513,15 @@ - (id) valueForKey:(NSString *)key state:(CCControlState)state
513513
{
514514
if ([key isEqualToString:@"labelOpacity"])
515515
{
516-
return [NSNumber numberWithUnsignedChar:[self labelOpacityForState:state]];
516+
return [NSNumber numberWithFloat:[self labelOpacityForState:state]];
517517
}
518518
else if ([key isEqualToString:@"labelColor"])
519519
{
520520
return [self labelColorForState:state];
521521
}
522522
else if ([key isEqualToString:@"backgroundOpacity"])
523523
{
524-
return [NSNumber numberWithUnsignedChar:[self backgroundOpacityForState:state]];
524+
return [NSNumber numberWithFloat:[self backgroundOpacityForState:state]];
525525
}
526526
else if ([key isEqualToString:@"backgroundColor"])
527527
{

0 commit comments

Comments
 (0)