Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
Loading...
Searching...
No Matches
i_window_system.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
7#include "i_application.hpp"
8#include <string>
9
10namespace rendering_engine
11{
12/**
13 * @struct WindowResolution
14 * @brief Represents the pixel resolution of a window or display.
15 */
17{
18 /** @brief Window or screen width in pixels. */
19 unsigned int width;
20 /** @brief Window or screen height in pixels. */
21 unsigned int height;
22};
23
24/**
25 * @class IWindowSystem
26 * @brief Abstract interface for platform-specific window management.
27 *
28 * Provides a unified API for creating, managing, and querying window state.
29 * Platform-specific implementations (e.g., GLFW, SDL, Win32, X11) are expected
30 * to implement this interface to integrate with the rendering engine.
31 *
32 * @see IApplication
33 */
35{
36public:
37 /**
38 * @brief Creates the main application window.
39 * @param width Width of the window in pixels.
40 * @param height Height of the window in pixels.
41 * @param title Title displayed in the window caption.
42 */
43 virtual void CreateAppWindow(unsigned int width, unsigned int height, const std::string& title) = 0;
44 /** @brief Polls and processes OS-level window events (input, resize, close, etc.). */
45 virtual void PollEvents() = 0;
46 /** @brief Checks whether the user has requested to close the window. */
47 virtual bool ShouldClose() const = 0;
48 /**
49 * @brief Returns a pointer to the underlying native window handle.
50 * @return Platform-specific native handle (e.g., HWND, GLFWwindow*, X11 Window).
51 */
52 virtual void* GetNativeHandle() const = 0;
53 /** @brief Checks if the framebuffer has been resized since the last frame. */
54 virtual bool IsFramebufferResized() const = 0;
55 /** @brief Resets the framebuffer resized flag after handling a resize event. */
56 virtual void ResetFramebufferResizedFlag() = 0;
57 /** @brief Performs cleanup and releases window-related resources. */
58 virtual void Shutdown() = 0;
59 /**
60 * @brief Retrieves a reference to the owning application instance.
61 * @return Reference to the associated IApplication object.
62 */
63 virtual const IApplication& GetApplication() = 0;
64 /**
65 * @brief Queries the resolution of the full-screen display mode.
66 * @return The native screen resolution when running in full-screen mode.
67 */
69 /** @brief Virtual destructor for safe polymorphic cleanup. */
70 virtual ~IWindowSystem() = default;
71};
72} //rendering_engine
Defines a generic application interface for rendering-based programs.
Abstract interface for platform-specific window management.
virtual void Shutdown()=0
Performs cleanup and releases window-related resources.
virtual void ResetFramebufferResizedFlag()=0
Resets the framebuffer resized flag after handling a resize event.
virtual void CreateAppWindow(unsigned int width, unsigned int height, const std::string &title)=0
Creates the main application window.
virtual void * GetNativeHandle() const =0
Returns a pointer to the underlying native window handle.
virtual ~IWindowSystem()=default
Virtual destructor for safe polymorphic cleanup.
virtual bool ShouldClose() const =0
Checks whether the user has requested to close the window.
virtual const IApplication & GetApplication()=0
Retrieves a reference to the owning application instance.
virtual WindowResolution GetFullScreenResolution() const =0
Queries the resolution of the full-screen display mode.
virtual bool IsFramebufferResized() const =0
Checks if the framebuffer has been resized since the last frame.
virtual void PollEvents()=0
Polls and processes OS-level window events (input, resize, close, etc.).
Represents the pixel resolution of a window or display.
unsigned int height
Window or screen height in pixels.
unsigned int width
Window or screen width in pixels.