Cocos2dUtilities
Utilities developed by HurleyProg for use with Cocos2d
|
#import <CCButton.h>
Instance Methods | |
(void) | - disable |
(void) | - enable |
Protected Attributes | |
SEL | _selector |
id< NSObject > | _target |
Properties | |
id< NSObject > | target |
SEL | selector |
A subclass of CCSprite which adds itself to the touch dispatcher. When touched it will call specified selector on the supplied target. Can also increase/decrease the touchable area which is helpful when making small images into buttons. This class has only been tested in landscape mode.
- (void) disable |
Disables the button. Makes the button darker to look disabled
- (void) enable |
Enables the button. Removes the disabled look
+ (id) spriteWithFile: | (NSString *) | filename | |
withPressedFile: | (NSString*) | pressedFilename | |
target: | (id) | object | |
function: | (SEL) | callback | |
Initialzes the sprite and sets the sprite's touch area equal to the bounding box
filename | - The file to use as the non-pressed image. |
pressedFilename | - The file to be used as the button's pressed image |
object | - The object that the selector will be called on |
callback | - The selector to be called on the target |
+ (id) spriteWithFile: | (NSString *) | filename | |
withPressedFile: | (NSString*) | pressedFilename | |
touchAreaScale: | (float) | scale | |
priority: | (int) | priority | |
target: | (id) | object | |
function: | (SEL) | callback | |
Initialzes the sprite but allows the user to scale the touch area based on the bounding box of the button.
filename | - The file to use as the non-pressed image. |
pressedFilename | - The file to be used as the button's pressed image |
scale | - Scales the touch area by the amount specified. A value of '1.0' makes the touch area the same size as the button bounding box. |
priority | - Sets the priority for the touch dispatcher otherwise defaults to 0 |
object | - The object that the selector will be called on |
callback | - The selector to be called on the target |
+ (id) spriteWithFile: | (NSString *) | filename | |
withPressedFile: | (NSString*) | pressedFilename | |
touchAreaScale: | (float) | scale | |
target: | (id) | object | |
function: | (SEL) | callback | |
Initialzes the sprite but allows the user to scale the touch area based on the bounding box of the button.
filename | - The file to use as the non-pressed image. |
pressedFilename | - The file to be used as the button's pressed image |
scale | - Scales the touch area by the amount specified. A value of '1.0' makes the touch area the same size as the button bounding box. |
object | - The object that the selector will be called on |
callback | - The selector to be called on the target |
|
protected |
The selector to call when the button is pressed
|
protected |
The object which the selector will be called on
|
readwritenonatomicassign |
The property for the selector variable
|
readwritenonatomicassign |
The property for the target variable