AUI Framework  master
Cross-platform module-based framework for developing C++20 desktop applications
ARenderingContextOptions.h
1/*
2 * AUI Framework - Declarative UI toolkit for modern C++20
3 * Copyright (C) 2020-2024 Alex2772 and Contributors
4 *
5 * SPDX-License-Identifier: MPL-2.0
6 *
7 * This Source Code Form is subject to the terms of the Mozilla Public
8 * License, v. 2.0. If a copy of the MPL was not distributed with this
9 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 */
11
12#pragma once
13
14#include <AUI/Common/AVector.h>
15#include <variant>
16#include "AUI/Reflect/AEnumerate.h"
17
18
19
20AUI_ENUM_FLAG(ARenderContextFlags) {
21 DEFAULT = 0b0,
22
27 NO_SMOOTH = 0b1,
28
32 NO_VSYNC = 0b10,
33};
34
50struct API_AUI_VIEWS ARenderingContextOptions {
51public:
52
53 struct DirectX11 {
54 int majorVersion;
55 };
56
57 struct OpenGL {
58 int majorVersion = 2, minorVersion = 0;
59
60 enum class Profile {
61 CORE,
62 COMPAT
63 } profile = Profile::CORE;
64 };
65
66 struct Software {};
67
68 using InitializationVariant = std::variant<DirectX11,
69 OpenGL,
70 Software>;
71
72 AVector<InitializationVariant> initializationOrder;
73
74 ARenderContextFlags flags = ARenderContextFlags::DEFAULT;
75
76 static void set(ARenderingContextOptions options) {
77 inst() = std::move(options);
78 }
79 static const ARenderingContextOptions& get() noexcept {
80 return inst();
81 }
82
83private:
84 static ARenderingContextOptions& inst();
85};
86
87AUI_ENUM_VALUES(ARenderingContextOptions::OpenGL::Profile,
88 ARenderingContextOptions::OpenGL::Profile::CORE,
89 ARenderingContextOptions::OpenGL::Profile::COMPAT)
A std::vector with AUI extensions.
Definition: AVector.h:38
AUI_ENUM_FLAG(ASide)
Describes sides of a 2D rectangle.
Definition: ASide.h:24
AUI_ENUM_VALUES(ATextOverflow, ATextOverflow::ELLIPSIS, ATextOverflow::CLIP) enum class AOverflowMask
Controls the behaviour of the default AView::drawStencilMask() implementation.
Definition: AOverflow.h:55
@ DEFAULT
There's no concrete input action. Let the OS decide which action is the most appropriate.
Definition: ARenderingContextOptions.h:53
Definition: ARenderingContextOptions.h:57
Definition: ARenderingContextOptions.h:66
Defines rendering API priority and options for your application.
Definition: ARenderingContextOptions.h:50