AUI Framework  develop
Cross-platform base for C++ UI apps
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Modules Pages Concepts
ARenderingContextOptions.h
    1/*
    2 * AUI Framework - Declarative UI toolkit for modern C++20
    3 * Copyright (C) 2020-2025 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 {
   51    struct DirectX11 {
   52        int majorVersion;
   53    };
   54
   55    struct OpenGL {
   56        int majorVersion = 2, minorVersion = 0;
   57
   58        enum class Profile {
   59            CORE,
   60            COMPAT
   61        } profile = Profile::CORE;
   62    };
   63
   64    struct Software {};
   65
   66    using InitializationVariant =  std::variant<DirectX11,
   67            OpenGL,
   68            Software>;
   69
   70    AVector<InitializationVariant> initializationOrder;
   71
   72    ARenderContextFlags flags = ARenderContextFlags::DEFAULT;
   73
   74    static void set(ARenderingContextOptions options) {
   75        inst() = std::move(options);
   76    }
   77    static const ARenderingContextOptions& get() noexcept {
   78        return inst();
   79    }
   80
   81private:
   82    static ARenderingContextOptions& inst();
   83};
   84
   85AUI_ENUM_VALUES(ARenderingContextOptions::OpenGL::Profile,
   86                ARenderingContextOptions::OpenGL::Profile::CORE,
   87                ARenderingContextOptions::OpenGL::Profile::COMPAT)
A std::vector with AUI extensions.
Definition AVector.h:39
#define AUI_ENUM_FLAG(name)
Make a bitfield-style enum class.
Definition AEnumerate.h:227
#define AUI_ENUM_VALUES(enum_t,...)
Defines all enum values for AEnumerate.
Definition AEnumerate.h:208
@ DEFAULT
There's no concrete input action. Let the OS decide which action is the most appropriate.
Definition ATextInputActionIcon.h:36
Definition ARenderingContextOptions.h:51
Definition ARenderingContextOptions.h:55
Definition ARenderingContextOptions.h:64
Defines rendering API priority and options for your application.
Definition ARenderingContextOptions.h:50