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

/**
 * @namespace ARCH_GUI
 * @brief The ARCH_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.
 *
 * @author Chase Percy
 *
 */
namespace ARCH_GUI {
    /**
     * Struct to represent the current menu state
     */
    struct PauseState {
        bool resume{false};   /// The menu has been set to resume
        bool options{false};  /// The menu has been set to options
        bool exit{false};     /// The menu has been set to exit
    };

    /**
     * Struct to represent if a click has occurred
     */
    struct Click {
        bool occurred{false};  /// A click event has occurred
    };

    /**
     * Name space to represent ImGui frame specific data such as widgets and
     * window settings.
     */
    namespace FRAME {
        /**
         * Draws the pause menu frame and displays the FPS from resources.
         * @param resources Struct containing FPS to draw
         */
        void pauseMenuFrame(Resources& resources);

        /**
         * Updates the settings in resources based on user input.
         * @param resources the resources to update.
         */
        void optionMenuFrame(Resources& resources);

        /**
         * Predefined window flags to be used on all windows
         * @return the window flags
         */
        int windowSettings();
    }                              // namespace FRAME
    extern PauseState pauseState;  /// The pauseState of the pause menu
    extern Click click;            /// The click state of the menu

    /**
     * Draws the pause menu and all sub menus
     * @param resources The resources needed for updating the settings and
     * drawing the FPS.
     */
    void pauseMenu(Resources& resources);

    /**
     * Resets the pause state to all false.
     */
    void resetPauseState();
}  // namespace ARCH_GUI