CCMenuAdvanced Class Reference
Inherits from | CCMenu : CCLayerRGBA : CCLayer : CCNode : NSObject |
Declared in | CCMenuAdvanced.h |
Overview
@class CCMenuAdvanced CCMenu with some aditional features.
1) Selecting and activating CCMenuItems with Keyboard
(by default next/prev bindings aren’t set – set them manually or use one of align methods to bind arrows for this).
2) One of CCMenuItems can be set as escapeDelegate - so it will be activated by pressing escape
3) align left->right, right->left, bottom->top, top->bottom with autosetting self contentSize
4) externalBoundsRect - if it is set then menu items will be scrollable inside these bounds
5) priority property - must be set before onEnter to make it register with that priority
@todo [v0.2] add columns and rows alignment methods
Tasks
-
boundaryRect
Rectangle in parent’s coordinate system, which menu must fill with it’s boundingBox.
property -
minimumTouchLengthToSlide
Minimum length of touch, that will disable selected menu item & start scrolling.
property -
priority
Priority property for touch, mouse & keyboard for menu. Must be set before onEnter called.
property -
isDisabled
If YES – all touches & keyboard events will be ignored. If NO – all events will work, except for disabled items. Default is NO.
property -
debugDraw
If YES – draw rectangle around CCMenuAdvanced.
property -
escapeDelegate
property -
prevItemButtonBind
property -
nextItemButtonBind
property -
– alignItemsHorizontallyWithPadding:
AlignH items horizontal from left to right.
-
– alignItemsVerticallyWithPadding:
Designated alignVerticall from bottom to top.
-
– alignItemsHorizontallyWithPadding:leftToRight:
Designated alignHorizontal Method
-
– alignItemsVerticallyWithPadding:bottomToTop:
Designated alignVerticall Method
-
– fixPosition
Changes menu position to stay inside of boundaryRect if it is non-null.
-
– selectNextMenuItem
-
– selectPrevMenuItem
-
– activateSelectedItem
-
– cancelSelectedItem
Properties
boundaryRect
Rectangle in parent’s coordinate system, which menu must fill with it’s boundingBox.
@property (readwrite, assign) CGRect boundaryRect
Discussion
Note: boundaryRect must have greater size then menu’s boundingBox to make scrolling possible. Think about boundaryRect like about hole in paper sheet under which you would like to put CCMenuAdvanced and scroll it, but you never want to see the table – hole must be covered with paper.
Declared In
CCMenuAdvanced.h
debugDraw
If YES – draw rectangle around CCMenuAdvanced.
@property (readwrite, assign) BOOL debugDraw
Declared In
CCMenuAdvanced.h
isDisabled
If YES – all touches & keyboard events will be ignored. If NO – all events will work, except for disabled items. Default is NO.
@property (readwrite, assign) BOOL isDisabled
Declared In
CCMenuAdvanced.h
Instance Methods
alignItemsHorizontallyWithPadding:
AlignH items horizontal from left to right.
- (void)alignItemsHorizontallyWithPadding:(float)padding
Parameters
- padding
space between elements.
Declared In
CCMenuAdvanced.h
alignItemsHorizontallyWithPadding:leftToRight:
Designated alignHorizontal Method
- (void)alignItemsHorizontallyWithPadding:(float)padding leftToRight:(BOOL)leftToRight
Parameters
- padding
space between elements.
- leftRoRight
If YES – align items from left to right, if NO – right to left.
Declared In
CCMenuAdvanced.h
alignItemsVerticallyWithPadding:
Designated alignVerticall from bottom to top.
- (void)alignItemsVerticallyWithPadding:(float)padding
Parameters
- padding
space between elements.
Declared In
CCMenuAdvanced.h
alignItemsVerticallyWithPadding:bottomToTop:
Designated alignVerticall Method
- (void)alignItemsVerticallyWithPadding:(float)padding bottomToTop:(BOOL)bottomToTop
Parameters
- padding
space between elements.
- bottomToTop
If YES – align items from bottom to top, if NO – top to bottom.
Declared In
CCMenuAdvanced.h