Menu

The Menu class manages the user interface for the game’s menu system, including buttons, input fields, and sprites. It handles the creation and rendering of menu entities, input handling, and transitions between different menu states.

FunctionsDescription
createEntityButtonCreates a button entity with a title, font, size, position, and a callback function to be triggered on click.
createEntitySpriteCreates a sprite entity with given size, texture, texture rectangle, and position.
createEntityRectCreates a rectangular button entity with size, position, color, and a callback function to be triggered on click.
createEntityInputCreates an input field entity with a font, size, position, and default text value for user input.
isClickedInputUpdates the state of whether the input fields (IP, port, or username) have been clicked.
setupInputHandles text input events to update the IP, port, or username fields based on user input.
initMainMenuInitializes and displays the main menu, creating and positioning all necessary UI elements.
displayMenuDisplays the appropriate menu (Main or Options) based on the current menu state, calling the relevant display functions.