Rendering Engine 0.2.9
Modular Graphics Rendering Engine | v0.2.9
i_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
6#pragma once
7
8#include "i_renderer.hpp"
9#include <string>
10
11namespace rendering_engine
12{
13
14/**
15 * @struct ScreenSettings
16 * @brief Describes window and display configuration for the application.
17 *
18 * This structure holds parameters defining how the application window
19 * or rendering surface is initialized, including its name, resolution,
20 * and display mode.
21 */
23{
24 /** @brief The window or application name. */
25 std::string name;
26 /** @brief Whether the application runs in fullscreen mode. */
28 /** @brief Screen or window width in pixels. */
29 unsigned int width;
30 /** @brief Screen or window height in pixels. */
31 unsigned int height;
32};
33
34/**
35 * @struct FrameMetrics
36 * @brief Stores CPU timing statistics for a rendered frame.
37 *
38 * Contains frame duration, update time, draw time,
39 * and FPS values (raw and smoothed).
40 *
41 * All time values are in milliseconds.
42 */
44{
45 /** Total frame duration (ms). */
46 float frameDurationMs = 0.0f;
47 /** Time spent in Update() (ms). */
48 float updateTimeMs = 0.0f;
49 /** Time spent in Draw() (ms). */
50 float drawTimeMs = 0.0f;
51 /** Instantaneous FPS (1000 / frameDurationMs). */
52 float fpsRaw = 0.0f;
53 /** Smoothed FPS value. */
54 float fpsSmoothed = 0.0f;
55};
56
57/**
58 * @class IApplication
59 * @brief Defines a generic application interface for rendering-based programs.
60 *
61 * Provides lifecycle control for initialization, main loop, update, rendering,
62 * and shutdown. All specific applications built on top of the Rendering Engine
63 * should implement this interface.
64 *
65 * @see IRenderer
66 */
68{
69public:
70 /** @brief Initializes the application and its subsystems. */
71 virtual void Initialize() = 0;
72 /** @brief Runs the main application loop. */
73 virtual void Run() = 0;
74 /**
75 * @brief Updates the application state.
76 * @param deltaTime Time elapsed since the previous frame, in milliseconds.
77 */
78 virtual void Update(float deltaTime) = 0;
79 /** @brief Executes the rendering logic for the current frame. */
80 virtual void Draw() = 0;
81 /** @brief Performs cleanup and shuts down the application. */
82 virtual void Shutdown() = 0;
83 /** @brief Virtual destructor for safe polymorphic deletion. */
84 virtual ~IApplication() = default;
85 /**
86 * @brief Retrieves the current screen or window settings.
87 * @return A structure describing screen configuration parameters.
88 */
89 virtual ScreenSettings GetScreenSettings() const = 0;
90 /**
91 * @brief Returns performance metrics of the last processed frame.
92 *
93 * @return FrameMetrics structure containing timing and FPS data.
94 */
95 virtual FrameMetrics GetFrameMetrics() const = 0;
96};
97} //rendering_engine
Defines a generic application interface for rendering-based programs.
virtual void Shutdown()=0
Performs cleanup and shuts down the application.
virtual FrameMetrics GetFrameMetrics() const =0
Returns performance metrics of the last processed frame.
virtual void Initialize()=0
Initializes the application and its subsystems.
virtual ScreenSettings GetScreenSettings() const =0
Retrieves the current screen or window settings.
virtual void Run()=0
Runs the main application loop.
virtual ~IApplication()=default
Virtual destructor for safe polymorphic deletion.
virtual void Draw()=0
Executes the rendering logic for the current frame.
virtual void Update(float deltaTime)=0
Updates the application state.
Stores CPU timing statistics for a rendered frame.
Describes window and display configuration for the application.
std::string name
The window or application name.
unsigned int width
Screen or window width in pixels.
unsigned int height
Screen or window height in pixels.
bool isFullScreen
Whether the application runs in fullscreen mode.