Rendering Engine 0.2.9
Modular Graphics Rendering Engine | v0.2.9
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) 2026 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#include "utility.hpp"
12
13#include <memory>
14#include <vector>
15
16namespace rendering_engine
17{
18class AppTime;
19class SceneManager;
20
21/**
22 * @class CoreApplication
23 * @brief Default implementation of the IApplication interface.
24 *
25 * Coordinates the main execution flow of a rendering-based application,
26 * including initialization, update, rendering, and shutdown. It acts as
27 * the central manager that connects the renderer, window system, and
28 * scene management subsystems.
29 *
30 * @see IApplication
31 * @see IWindowSystem
32 * @see IRenderer
33 */
35{
36public:
37 /**
38 * @brief Constructs a CoreApplication using settings from the config file.
39 *
40 * Loads AppConfig and applies its values to window setup.
41 */
43 /**
44 * @brief Constructs a CoreApplication with full-screen window size.
45 * @param appName Name of the application, used for window caption and logging.
46 */
47 CoreApplication(char const* appName);
48 /**
49 * @brief Constructs a CoreApplication with explicit window size.
50 * @param width Window width in pixels.
51 * @param height Window height in pixels.
52 * @param appName Name of the application.
53 */
54 CoreApplication(unsigned int width, unsigned int height, char const* appName);
55 /**
56 * @brief Constructs a CoreApplication with injected subsystems.
57 * @param width Window width in pixels.
58 * @param height Window height in pixels.
59 * @param appName Name of the application.
60 * @param windowSystem Shared pointer to a custom window system implementation.
61 * @param renderer Shared pointer to a custom renderer implementation.
62 */
63 CoreApplication(unsigned int width,
64 unsigned int height,
65 char const* appName,
66 std::shared_ptr<IWindowSystem> windowSystem,
67 std::shared_ptr<IRenderer> renderer);
68
69
70 /**
71 * @brief Constructs a CoreApplication with custom systems but default window size.
72 * @param appName Name of the application.
73 * @param windowSystem Shared pointer to a custom window system implementation.
74 * @param renderer Shared pointer to a custom renderer implementation.
75 */
76 CoreApplication(char const* appName,
77 std::shared_ptr<IWindowSystem> windowSystem,
78 std::shared_ptr<IRenderer> renderer);
79 virtual ~CoreApplication();
80
81 /** @copydoc IApplication::Initialize */
82 void Initialize() override;
83 /** @copydoc IApplication::Run */
84 void Run() override;
85 /** @copydoc IApplication::Update */
86 void Update(float deltaTime) override;
87 /** @copydoc IApplication::Draw */
88 void Draw() override;
89 /** @copydoc IApplication::Shutdown */
90 void Shutdown() override;
91 /** @copydoc IApplication::GetScreenSettings */
92 ScreenSettings GetScreenSettings() const override;
93 /** @copydoc IApplication::GetFrameMetrics */
94 FrameMetrics GetFrameMetrics() const override;
95
96protected:
98 unsigned int mWidth;
99 unsigned int mHeight;
100 std::string mAppName;
102
104
105 std::shared_ptr<AppTime> mAppTime;
106 std::shared_ptr<IWindowSystem> mWindowSystem;
107 std::shared_ptr<IRenderer> mRenderer;
108
109 std::shared_ptr<SceneManager> mSceneManager;
110};
111}
Default implementation of the IApplication interface.
std::shared_ptr< SceneManager > mSceneManager
std::shared_ptr< IWindowSystem > mWindowSystem
std::shared_ptr< AppTime > mAppTime
std::shared_ptr< IRenderer > mRenderer
Defines a generic application interface for rendering-based programs.
#define RE_API
Basic application settings loaded from a configuration file.
Definition: utility.hpp:27
Stores CPU timing statistics for a rendered frame.
Describes window and display configuration for the application.