Documentation > Menus > MenuManager

Parent du composant : Manager

Version: 3.2.0
Constructor MenuManager(CtrlSpace)

This function creates an instance of the MenuManager object.

CtrlSpace

Length (in pixels) of the space between the menu items.

Return

Returns an instance of the MenuManager object.

MenuManager:setNextKeys(Args...)

This function defines the given keys to use to go to the next menu item.

By default, the Down key on the keyboard, the down left axis on the gamepad,

the scroll wheel down on the mouse and if you move over the menu item with the mouse.

Args...

Keys to use to go to the next menu item

MenuManager:setPreviousKeys(Args...)

This function defines the given keys to use to go to the previous menu item.

By default, the Up key on the keyboard, the up left axis on the gamepad,

the scroll wheel up on the mouse and if you move over the menu item with the mouse.

Args...

Keys to use to go to the previous menu item

MenuManager:setValidateKeys(Args...)

This function defines the given keys to use to validate the selected menu item.

By default, the Space key on the keyboard, the A button on the gamepad and the mouse left button.

Args...

Keys to use to validate the selected menu item

MenuManager:addImage(ImageName, X, Y, CenterOrigin)

This function allows you to add an image to the menu.

ImageName

Path and name of the image.

X

X-axis coordinate of the image

Y

Y-axis coordinate of the image

CenterOrigin

Specifies whether the origin of the image will be the center of the image.

Return

Returns the new image.

MenuManager:addTitle(Title, Y, FontName, FontSize, TitleColor, WithShadow, ShadowColor, ShadowOffsetX, ShadowOffsetY)

This function allows you to add a title to the menu.

Title

Game title

Y

Position of the text in height.

FontName

Font name.

FontSize

Font size.

TitleColor

Color of the title.

WithShadow

Indicates if you want to have a shadow on the title.

ShadowColor

Color of the shadow.

ShadowOffsetX

Shift of the shadow in pixels on the X axis.

ShadowOffsetY

Offset of the shadow in pixels on the Y axis. If not indicated, the X axis is used.

MenuManager:setCtrlSpace(Value)

This function sets the space between the menu items.

CtrlSpace

Length (in pixels) of the space between the menu items.

MenuManager:addItem(Text, OnSelection, OnDeselection, onValidation)

This function allows you to add an item to the menu.

Text

Text to display.

OnSelection

Function to be executed when the item is selected.

OnDeselection

Function to be executed when leaving the selection.

onValidation

Function to be executed when the selected item is activated.

Return

Returns the menu item.

MenuManager:getItemsDimensions()

This function returns the position and dimensions (width and height) of the menu items.

Return

Returns the position X and Y of the menu items and the width and height used.

MenuManager:setItemsDimensions(Width, Height, Mode, Centered)

This function sets the dimensions (width and height) of the menu items.

Width

Width of the space occupied by the menu items.

Height

Height of the space occupied by the menu items.

Mode

Mode 'vertical' (default) or 'horizontal'

Centered

Indicate if the items must be centered (ignored for 'horizontal' mode).

MenuManager:setItemsPosition(X, Y)

This function sets the position of the menu items.

X

Position on the X-axis.

Y

Position on the Y-axis.

MenuManager:nextItem()

This function allows you to select the next menu item.

MenuManager:previousItem()

This function allows you to select the previous menu item.

MenuManager:validateItem()

This function allows you to validate the selected menu item.