// =====================================================================================================================
//  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/surface.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_OPENGL_EGL_SURFACE_H
#define FENNEC_PLATFORM_OPENGL_EGL_SURFACE_H

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

#include <fennec/renderers/interface/gfxsurface.h>


namespace fennec
{
/// \brief base egl surface with platform-independent behaviour
class eglsurface : public gfxsurface {

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

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

	/// \brief constructor
	/// \param win the associated window
	/// \param ctx the associated context
	/// \param eglwindow the create egl window
	eglsurface(fennec::window* win, eglcontext* ctx, void* eglwindow);

	///
	/// \brief Destructor
	~eglsurface();


// Operations ==========================================================================================================
public:

	/// \name Operations
	/// @{

	void make_current() override; //!< makes this surface the current target of the context
	void swap() override;         //!< swaps the front and back buffers

	/// @}


// Protected Member Variables ==========================================================================================
protected:
	void*      _eglwindow;  //!< the underlying handle to the window
	EGLSurface _eglsurface; //!< the handle for the surface
};

} // fennec

#endif // FENNEC_PLATFORM_OPENGL_EGL_SURFACE_H