ICT290 / src / scene / mainMenu / gui / mainMenu.h
mainMenu.h
Raw
#pragma once
#include "../../../engine/UI.h"
#include "../../../engine/resources.h"

/**
 * @namespace MENU_GUI
 * @brief The MENU_GUI namespace wraps the ImGui calls so that only a single
 * function is needed to load the menu. All menu functionality is handled
 * within, but the user has the choice to respond to Clicks, i.e. for sound and
 * is responsible for resetting it to false once handling it. The pause state
 * can also be accessed if further functionality such as key presses (Esc) want
 * to be used when interacting with the menu. The menu also sets a flag to let
 * the state know which game has been selected.
 *
 * @author Chase Percy
 *
 */
namespace MENU_GUI {
    /**
     * Struct to represent the current pause state of the menu
     */
    struct PauseState {
        bool gameSelect{false};  /// Game select menu is active
        bool options{false};     /// Options menu is active
        bool exit{false};        /// Exit has been set
        bool archConfig{false};  /// Config menu has been set
        bool lore{false};        /// Lore menu for arch
        bool credits{false};     /// Display the credits
    };

    /**
     * Struct to represent what game has been selected to play
     */
    struct Game {
        bool archanist{false};   /// If arachnist has been set
        bool shaysWorld{false};  /// If shays world has been set
    };

    /**
     * Struct to represent that a click has occurred
     */
    struct Click {
        bool occurred{false};  /// If a click has occurred
    };

    /**
     * Name space to represent ImGui frame specific data such as widgets and
     * window settings.
     */
    namespace FRAME {
        /**
         * Represents the main menu frame
         */
        void mainMenuFrame();

        /**
         * Represents the option menu frame and updates settings in resources
         * @param resources the resources to update
         */
        void optionMenuFrame(Resources& resources);

        /**
         * Represents the select game frame
         */
        void selectGameFrame();

        /**
         * Represents the lore frame
         */
        void loreFrame();

        /**
         * Represents the Archanist configuration frame. Takes data relevant to
         * the level generation as a parameter and updates it.
         * @param seed the seed variable to update
         * @param levels the level variable to update
         * @param difficulty the difficulty variable to update
         */
        void configureArchFrame(int& seed, int& levels, int& difficulty);

        /**
         * Display our cool names
         */
        void creditsFrame();

        /**
         * Predefined window flags to be used on all windows
         * @return the window flags
         */
        int windowSettings();
    }  // namespace FRAME

    extern PauseState pauseState;  /// The current pause sate of the menu
    extern Game game;              /// The current game selected
    extern Click click;            /// If any clicks have occurred

    /**
     * Draws the main menu and all sub menus
     * @param resources the resources to update in settings
     * @param seed the seed variable to set
     * @param levels the level variable to set
     * @param difficulty the difficulty variable to set
     */
    void mainMenu(Resources& resources,
                  int& seed,
                  int& levels,
                  int& difficulty);

    /**
     * Resets the pause and level state for the menu
     */
    void resetPauseState();
}  // namespace MENU_GUI