|
Vesper 0.5.1
Vesper is short form for the Latin word for "Bat", as Vesper is designed to be small, lightweight, and easily handle things like particles and flocking behaviors in accordance with the nature of bats. \n It is meant to be a particle simulation, VFX editor, and CAN be used secondarily as a small game engine. GitHub | Vesper Updates | Creator |
The core application class that manages the main loop, window, layers, and event handling. More...
#include <Application.h>
Public Member Functions | |
| Application (const std::string &name="") | |
| Constructs the Application with the given name. | |
| virtual | ~Application () |
| void | Run () |
| Starts the main application loop. | |
| void | OnEvent (Event &e) |
| Handles incoming events and dispatches them to the appropriate handlers. | |
| void | PushLayer (Layer *layer) |
| Adds a layer to the application layer stack. | |
| void | PushOverlay (Layer *overlay) |
| Adds an overlay layer to the application layer stack. | |
| void | Close () |
| Closes the application. | |
| ImGuiLayer * | GetImGuiLayer () |
| Retrieves the ImGui layer. | |
| Window & | GetWindow () |
| Retrieves the application window. | |
Static Public Member Functions | |
| static Application & | Get () |
| Retrieves the singleton instance of the Application. | |
Private Member Functions | |
| bool | OnWindowClose (WindowCloseEvent &e) |
| Event handler for window close events. | |
| bool | OnWindowResize (WindowResizeEvent &e) |
| Event handler for window resize events. | |
Private Attributes | |
| Scope< Window > | m_Window |
| Scoped pointer to the applications underlying window. | |
| ImGuiLayer * | m_ImGuiLayer |
| ImGui layer for rendering GUI elements. | |
| bool | m_Running = true |
| Flag indicating whether the application is running. | |
| bool | m_Minimized = false |
| Flag indicating whether the application is minimized. | |
| LayerStack | m_LayerStack |
| Stack of layers managed by the application. | |
| float | m_LastFrameTime = 0.0f |
| Time of the last frame, used for calculating timestep. | |
Static Private Attributes | |
| static Application * | s_Instance = nullptr |
The core application class that manages the main loop, window, layers, and event handling.
| Vesper::Application::Application | ( | const std::string & | name = "" | ) |
Constructs the Application with the given name.
| name | The name of the application. Defaults to an empty string. |
References Vesper::ImGuiLayer::ImGuiLayer(), Vesper::Renderer::Init(), m_ImGuiLayer, PushOverlay(), and s_Instance.
|
virtual |
| void Vesper::Application::Close | ( | ) |
Closes the application.
References m_Running.
Referenced by Vesper::EditorLayer::OnImGuiRender().
|
inlinestatic |
Retrieves the singleton instance of the Application.
References s_Instance.
Referenced by Vesper::ImGuiLayer::End(), Vesper::Input::GetMousePosition(), Vesper::Input::IsKeyPressed(), Vesper::Input::IsMouseButtonPressed(), Vesper::ImGuiLayer::OnAttach(), and Vesper::EditorLayer::OnImGuiRender().
|
inline |
Retrieves the ImGui layer.
References m_ImGuiLayer.
Referenced by Vesper::EditorLayer::OnImGuiRender().
|
inline |
Retrieves the application window.
Referenced by Vesper::ImGuiLayer::End(), Vesper::Input::GetMousePosition(), Vesper::Input::IsKeyPressed(), and Vesper::Input::IsMouseButtonPressed().
| void Vesper::Application::OnEvent | ( | Event & | e | ) |
Handles incoming events and dispatches them to the appropriate handlers.
References Vesper::EventDispatcher::EventDispatcher(), OnWindowClose(), and OnWindowResize().
|
private |
|
private |
Event handler for window resize events.
References Vesper::WindowResizeEvent::GetHeight(), Vesper::WindowResizeEvent::GetWidth(), m_Minimized, and Vesper::Renderer::OnWindowResize().
Referenced by OnEvent().
| void Vesper::Application::PushLayer | ( | Layer * | layer | ) |
Adds a layer to the application layer stack.
References Vesper::Layer::OnAttach().
Referenced by Vesper::VesperEditor::VesperEditor().
| void Vesper::Application::PushOverlay | ( | Layer * | overlay | ) |
Adds an overlay layer to the application layer stack.
References Vesper::Layer::OnAttach().
Referenced by Application().
| void Vesper::Application::Run | ( | ) |
Starts the main application loop.
References Vesper::ImGuiLayer::Begin(), Vesper::ImGuiLayer::End(), m_ImGuiLayer, m_LastFrameTime, m_Minimized, and m_Running.
|
private |
ImGui layer for rendering GUI elements.
Referenced by Application(), GetImGuiLayer(), and Run().
|
private |
Time of the last frame, used for calculating timestep.
Referenced by Run().
|
private |
Stack of layers managed by the application.
|
private |
Flag indicating whether the application is minimized.
Referenced by OnWindowResize(), and Run().
|
private |
Flag indicating whether the application is running.
Referenced by Close(), OnWindowClose(), and Run().
Scoped pointer to the applications underlying window.
|
staticprivate |
Referenced by Application(), and Get().