Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
Loading...
Searching...
No Matches
core_application.hpp
Go to the documentation of this file.
1// This file is part of the Rendering Engine project.
2// Author: Alexander Obzherin <alexanderobzherin@gmail.com>
3// Copyright (c) 2025 Alexander Obzherin
4// Distributed under the terms of the zlib License. See LICENSE.md for details.
5#pragma once
6
8#include "i_application.hpp"
9#include "i_window_system.hpp"
10#include "i_renderer.hpp"
11
12#include <memory>
13#include <vector>
14
15namespace rendering_engine
16{
17class AppTime;
18class SceneManager;
19
20/**
21 * @class CoreApplication
22 * @brief Default implementation of the IApplication interface.
23 *
24 * Coordinates the main execution flow of a rendering-based application,
25 * including initialization, update, rendering, and shutdown. It acts as
26 * the central manager that connects the renderer, window system, and
27 * scene management subsystems.
28 *
29 * @see IApplication
30 * @see IWindowSystem
31 * @see IRenderer
32 */
34{
35public:
36 /**
37 * @brief Constructs a CoreApplication using settings from the config file.
38 *
39 * Loads AppConfig and applies its values to window setup.
40 */
42 /**
43 * @brief Constructs a CoreApplication with full-screen window size.
44 * @param appName Name of the application, used for window caption and logging.
45 */
46 CoreApplication(char const* appName);
47 /**
48 * @brief Constructs a CoreApplication with explicit window size.
49 * @param width Window width in pixels.
50 * @param height Window height in pixels.
51 * @param appName Name of the application.
52 */
53 CoreApplication(unsigned int width, unsigned int height, char const* appName);
54 /**
55 * @brief Constructs a CoreApplication with injected subsystems.
56 * @param width Window width in pixels.
57 * @param height Window height in pixels.
58 * @param appName Name of the application.
59 * @param windowSystem Shared pointer to a custom window system implementation.
60 * @param renderer Shared pointer to a custom renderer implementation.
61 */
62 CoreApplication(unsigned int width,
63 unsigned int height,
64 char const* appName,
65 std::shared_ptr<IWindowSystem> windowSystem,
66 std::shared_ptr<IRenderer> renderer);
67
68
69 /**
70 * @brief Constructs a CoreApplication with custom systems but default window size.
71 * @param appName Name of the application.
72 * @param windowSystem Shared pointer to a custom window system implementation.
73 * @param renderer Shared pointer to a custom renderer implementation.
74 */
75 CoreApplication(char const* appName,
76 std::shared_ptr<IWindowSystem> windowSystem,
77 std::shared_ptr<IRenderer> renderer);
78 virtual ~CoreApplication();
79
80 /** @copydoc IApplication::Initialize */
81 void Initialize() override;
82 /** @copydoc IApplication::Run */
83 void Run() override;
84 /** @copydoc IApplication::Update */
85 void Update(float deltaTime) override;
86 /** @copydoc IApplication::Draw */
87 void Draw() override;
88 /** @copydoc IApplication::Shutdown */
89 void Shutdown() override;
90 /** @copydoc IApplication::GetScreenSettings */
91 ScreenSettings GetScreenSettings() const override;
92
93protected:
95 unsigned int mWidth;
96 unsigned int mHeight;
97 std::string mAppName;
98
99 std::shared_ptr<AppTime> mAppTime;
100 std::shared_ptr<IWindowSystem> mWindowSystem;
101 std::shared_ptr<IRenderer> mRenderer;
102
103 std::shared_ptr<SceneManager> mSceneManager;
104};
105}
Manages current, total, and elapsed time for the application.
Definition app_time.hpp:36
std::shared_ptr< SceneManager > mSceneManager
CoreApplication()
Constructs a CoreApplication using settings from the config file.
ScreenSettings GetScreenSettings() const override
Retrieves the current screen or window settings.
std::shared_ptr< IWindowSystem > mWindowSystem
void Draw() override
Executes the rendering logic for the current frame.
void Shutdown() override
Performs cleanup and shuts down the application.
std::shared_ptr< AppTime > mAppTime
void Run() override
Runs the main application loop.
void Update(float deltaTime) override
Updates the application state.
std::shared_ptr< IRenderer > mRenderer
void Initialize() override
Initializes the application and its subsystems.
Defines a generic application interface for rendering-based programs.
Manages scenes, resource caches, and scene transitions within the rendering engine.
#define RE_API
Describes window and display configuration for the application.