getMenuButtonBoundingClientRect
Get Menu Button Layout Information
getMenuButtonBoundingClientRect is a synchronous delegate method that provides the game with the position and size of the top-right menu, or capsule, button. Use the top-left corner of the game view as the origin.
Method Declaration
- (nonnull SUDOPMenuButtonBoundingClientRect *)getMenuButtonBoundingClientRect;Parameters
This method takes no parameters.
Return Value
This delegate method is optional. If implemented, it must return a nonnull SUDOPMenuButtonBoundingClientRect object. If no menu button bounds are available, return a rectangle with all six fields set to zero.
| Property | Type | Description |
|---|---|---|
| width | NSInteger | Width of the menu button. |
| height | NSInteger | Height of the menu button. |
| top | NSInteger | The y-coordinate of the button’s top edge. |
| right | NSInteger | The x-coordinate of the button’s right edge. |
| bottom | NSInteger | The y-coordinate of the button’s bottom edge. |
| left | NSInteger | The x-coordinate of the button’s left edge. |
Supply coordinates and dimensions in iOS logical points. The SDK converts them to the pixel values used by the game before returning the result.
After layout, convert the button bounds to the game view’s coordinate space using [buttonView convertRect:buttonView.bounds toView:gameView]. Fill the six properties from this rectangle in points.
Example
- (SUDOPMenuButtonBoundingClientRect *)getMenuButtonBoundingClientRect {
SUDOPMenuButtonBoundingClientRect *rect =
[[SUDOPMenuButtonBoundingClientRect alloc] init];
rect.width = 87;
rect.height = 32;
rect.top = 48;
rect.right = 407;
rect.bottom = 80;
rect.left = 320;
return rect;
}Notes
rightandbottomare the x-coordinate of the right edge and the y-coordinate of the bottom edge, respectively.- Keep
right = left + widthandbottom = top + height. - Return the latest layout on the next callback after screen rotation or a menu button position change.
