new Menu(x, y, dir)
Menu
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
x |
number | the topleft-x coordinate of the Menu | |
y |
number | the topleft-y coordinate of the Menu | |
dir |
number | 0 | The direction of the menu (0: vertical, 1: horizontal) |
Methods
add(btn)
Add a Button to the menu
Parameters:
| Name | Type | Description |
|---|---|---|
btn |
Button | the button to add to the menu |
click()
Passes the click event to all buttons for processing
layout()
Recalculate the position p for the layout of buttons in the menu
render()
Draw the menu by calling render on all buttons