Game Development Reference
In-Depth Information
color of the
Highlighted State
to a light gray color. And, on the
Item Code Connections
tab, enter
shouldClose
in the
Selector
field. You should also clear the
Title
field to remove
all text from the button.
That's all there is to the button's CCB file. You should open
SettingsLayer.ccb
and drag
and drop
CloseButton.ccb
onto the
settingsLayer
node. Drag and move the button so that
it is in the upper right corner of the
S_bg
background image (position 140x75) as seen in
Figure 7-12
.
Or, if you would rather align it with the corner, you can change the position
types to
%
and use
100, 100
or a little less for the position.
Figure 7-12
.
The final version of the SettingsLayer.ccb
In Xcode, create yet another Objective-C class with the name
CloseButton
and using
CCNode
as the subclass. Open the
CloseButton.m
file to add the method highlighted in
Listing 7-6
.
Forwarding the CloseButton message to the nearest parent node
#import "CloseButton.h"
@implementation CloseButton
-(void) shouldClose
Search WWH ::
Custom Search