// =====================================================================================================================
//  fennec, a free and open source game engine
//  Copyright © 2025  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/>.
// =====================================================================================================================

#ifndef FENNEC_PLATFORM_INTERFACE_GFXCONTEXT_H
#define FENNEC_PLATFORM_INTERFACE_GFXCONTEXT_H

#include <fennec/langproc/strings/string.h>
#include <fennec/lang/typeuuid.h>
#include <fennec/platform/interface/fwd.h>

namespace fennec
{

class gfxcontext {
public:
	const string name;
	const uint64_t uuid;

	virtual bool connected() = 0;
	virtual int32_t get_version_major() = 0;
	virtual int32_t get_version_minor() = 0;
	virtual int32_t get_context_version() = 0;
	virtual const cstring& get_context_name() = 0;

	virtual bool check_extension(const cstring& ext) = 0;
	virtual void make_current(gfxsurface* surface) = 0;

	virtual ~gfxcontext() = default;

protected:
	display* _display;

	template<typename ContextT>
	gfxcontext(display* display, const cstring& name, ContextT*)
		: name(name)
		, uuid(typeuuid<ContextT>())
		, _display(display) {
	}
};

}

#endif // FENNEC_PLATFORM_INTERFACE_GFXCONTEXT_H
