// Copyright (C) 2015 Jérôme Leclercq // This file is part of the "Nazara Engine - Renderer module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_CONTEXT_HPP #define NAZARA_CONTEXT_HPP #include #include #include #include #include #include #include #include class NzContext; using NzContextConstListener = NzObjectListenerWrapper; using NzContextConstRef = NzObjectRef; using NzContextLibrary = NzObjectLibrary; using NzContextListener = NzObjectListenerWrapper; using NzContextRef = NzObjectRef; class NzContextImpl; class NAZARA_API NzContext : public NzRefCounted { friend NzContextImpl; friend NzContextLibrary; friend class NzOpenGL; public: NzContext() = default; ~NzContext(); bool Create(const NzContextParameters& parameters = NzContextParameters()); void Destroy(); void EnableVerticalSync(bool enabled); const NzContextParameters& GetParameters() const; bool IsActive() const; bool SetActive(bool active) const; void SwapBuffers(); static bool EnsureContext(); static const NzContext* GetCurrent(); static const NzContext* GetReference(); static const NzContext* GetThreadContext(); private: static bool Initialize(); static void Uninitialize(); NzContextParameters m_parameters; NzContextImpl* m_impl = nullptr; static std::unique_ptr s_reference; static std::vector> s_contexts; static NzContextLibrary::LibraryMap s_library; }; #endif // NAZARA_CONTEXT_HPP