// =====================================================================================================================
//  fennec, a free and open source game engine
//  Copyright © 2025 - 2026  Medusa Slockbower
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================

///
/// \file fennec/platform/opengl/egl/context.h
/// \brief
///
///
/// \details
/// \author Medusa Slockbower
///
/// \copyright Copyright © 2025 - 2026 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
///
///


#ifndef FENNEC_PLATFORM_LINUX_WAYLAND_OPENGL_EGLCONTEXT_H
#define FENNEC_PLATFORM_LINUX_WAYLAND_OPENGL_EGLCONTEXT_H

#include <fennec/platform/opengl/glad/egl.h>
#include <fennec/platform/opengl/egl/error.h>

#include <fennec/platform/linux/wayland/server.h>
#include <fennec/renderers/opengl/glcontext.h>

namespace fennec
{

///
/// \brief base egl context with platform-independent behaviour
class eglcontext : public glcontext {

// Constructors & Destructor ===========================================================================================
public:

	/// \name Constructors & Destructor
	/// @{

	///
	/// \brief constructor
	/// \param display the corresponding display server
	eglcontext(display_server* display);

	///
	/// \brief destructor
	~eglcontext();

	/// @}


//

	///
	/// \returns \emph{true} if the context is valid, \emph{false} otherwise
	bool is_valid() override;

private:
	EGLDisplay _egldisplay;
	EGLContext _eglcontext;
	EGLConfig  _eglconfig;
	EGLint _eglvmajor, _eglvminor, _eglctype;
	cstring _extensions;

	FENNEC_RTTI_CLASS_ENABLE(glcontext) {
	}

	friend class eglsurface;
};

}

#endif // FENNEC_PLATFORM_LINUX_WAYLAND_OPENGL_EGLCONTEXT_H
