/*
 * GcDisplayExtraInfo.h
 *
 *  Created on: 25/ago/2020
 *      Author: chessaa
 */

#ifndef GCDISPLAYEXTRAINFO_H_
#define GCDISPLAYEXTRAINFO_H_


struct gfd_font256_tag_t;
struct gfd_framebuffer_struct_t;

class GcDisplayExtraInfo;

class GcDisplayExtraInfoHandler
{
public:
	GcDisplayExtraInfoHandler()
	{
	}


	virtual ~GcDisplayExtraInfoHandler()
	{
	}

	virtual int displayExtraInfo(GcDisplayExtraInfo& d, GcDisplayExtraInfo& ed, void* cookie)=0;
};

class GcDisplayExtraInfo
{
public:
	typedef int (*handler_t)(GcDisplayExtraInfo& d, GcDisplayExtraInfo& ed, void* cookie);

	static GcDisplayExtraInfo& instance();
	static GcDisplayExtraInfo& engInstance();

	void addVideoFrameHandler(handler_t handler, void* cookie=0);
	void addVideoFrameHandler(GcDisplayExtraInfoHandler& handler);

	void print_error_c(int col, int row, const char* fmt, ...);

	void print(int x, int y, const char* fmt, ...);
	void print_c(int col, int row, const char* fmt, ...);

	void phy_print(int x, int y, const char* fmt, ...);
	void phy_print_c(int col, int row, const char* fmt, ...);

	void phy_print_small(int x, int y, const char* fmt, ...);
	void phy_print_small_dbg(int x, int y, const char* fmt, ...);

	void* opaqueFramebuffer();
	void* opaquePhysicalFramebuffer();

	void color_print(int color, int x, int y, const char* fmt, ...);
	void color_print_c(int color, int col, int row, const char* fmt, ...);

	gfd_framebuffer_struct_t* frameBuffer() { return sfb;}
	gfd_framebuffer_struct_t* physicalFrameBuffer() { return pfb;}

private:
	GcDisplayExtraInfo(int idx);

	GcDisplayExtraInfo(const GcDisplayExtraInfo&);
	void operator=(const GcDisplayExtraInfo&);

	const gfd_font256_tag_t* font_normal;
	const gfd_font256_tag_t* font_small;

	gfd_framebuffer_struct_t* sfb;
	gfd_framebuffer_struct_t* pfb;

	friend class GcDisplayExtraInfoImplementation;
};


#endif /* GCDISPLAYEXTRAINFO_H_ */
