#pragma once
#include <iostream>
#include <vector>

namespace MPFW {
	namespace Backends {
		namespace Video {
			namespace Agnostic {
				struct Color {
					unsigned char r, g, b, a;
				};
				struct Picture {
					std::vector<Color> data;
					int width, height;
				};
				struct Vertex2D {
					float x, y;
				};
				struct Vertex3D {
					float x, y, z;
				};
				struct Vertex4D {
					float x, y, z, w;
				};
				struct Triangle {
					Vertex3D a, b, c;
				};
				struct TexturedTriangle {
					Triangle tri;
					int textureId;
				};
			}


			
			struct ContextParameters {
				std::string name;
				int width, height, desiredFps;
			};


			 // note: backend inputs should ALWAYS be in quake coords
			// note 2: backends should ideally implement all functions. 
			class BackEnd {
			public:
				virtual void Create(ContextParameters param) = 0;

				virtual int BE_LoadFont(std::string path) = 0;
				virtual void BE_DrawText(int fontId, std::string text, int x, int y, int fontSize) = 0;

				virtual int BE_LoadTexture(Agnostic::Picture pic) = 0;
				virtual void BE_UnloadTexture(int picId) = 0;
				virtual void BE_DrawColorTriangle(Agnostic::Triangle tri, Agnostic::Color col) = 0;
				virtual void BE_DrawTexturedTriangle(Agnostic::TexturedTriangle tri) = 0;
				
				virtual void BE_ImGui_Begin() = 0;
				virtual void BE_ImGui_End() = 0;
			};
		}
	}
}