Class Application

Synopsis

#include <include/Sirius/Core/Application.h>

class Application

Description

Application class.

This is the main class, where the application loop is located.

Methods

ApplicationDefault constructor.
getApplication getter.
getWindowApplication window getter.
onEventIs called when an event occurs.
onWindowCloseIs called when a WindowCloseEvent is triggered.
pushLayerPush a new window layer.
pushOverlayPush a new window overlay.
runMain application loop.

Source

Lines 32-95 in include/Sirius/Core/Application.h.

class Application
{
    private:
        static Application* instance;
        std::unique_ptr<Window> window;
        bool running = true;
        float lastFrameTime = 0.f;
        LayerStack layerStack;
        ImGuiLayer* imGuiLayer;
    public:
        /////////////////////////////////////////
        /// @brief Default constructor
        ///
        /// A single window is created, where the
        /// simulation lives.
        Application();
        //////////////////////////////////////////////////
        /// @brief Application getter
        /// 
        /// There is only one Application object per
        /// application, accessed with this getter.
        inline static Application& get() { return *instance; }
        ///////////////////////////////////////////////
        /// @brief Application window getter
        /// 
        /// Each simulation has a single window,
        /// which is accessed with this getter.
        ///
        /// @see Window class
        inline Window& getWindow() const { return *window; };
        /////////////////////////////////////////
        /// @brief Is called when an event occurs
        /// @see Event class
        void onEvent(Event& event);
        ///////////////////////////////////
        /// @brief Push a new window layer
        /// @see Layer class
        void pushLayer(Layer* layer);
        ////////////////////////////////////
        /// @brief Push a new window overlay
        /// @see Layer class
        void pushOverlay(Layer* overlay);
        /////////////////////////////////////////////////////////
        /// @brief Is called when a WindowCloseEvent is triggered
        /// @param event The WindowCloseEvent
        /// @return True
        bool onWindowClose(WindowCloseEvent& event);
        ///////////////////////////////////////////////////////////
        /// @brief Main application loop
        /// @see onUpdate()
        void run();
};





Add Discussion as Guest

Log in