#pragma once

#include "render.h"
#include <color.h>

namespace render{
namespace primitives2d{

void init();
void free();

void flush();

using color::rgba;

extern rgba pointColor, lineColor, fillColor;

// точка
void point(const vec2f&, const rgba& = color::white, float size = 1.0f);

// линия
void line(const vec2f&, const vec2f&, const rgba& = lineColor);
inline void line(const vec2f&, const vec2f&, const rgba&, const rgba&);

// треугольник
void triangle(const vec2f&, const vec2f&, const vec2f&, // x/y
              const rgba&, const rgba&, const rgba&); // color

void triangle(const vec2f&, const vec2f&, const vec2f&, const rgba& = color::white);

//квадрат
void quad(const vec2f& pos, const vec2f& size, const rgba& = color::white);

//круг из треугольников
void circle(const vec2f& pos, float radius, const rgba& = color::white, float angle = 0, uint edges = 0);

//окружность из линий
void round(const vec2f& pos, float radius, const rgba& = color::white, float angle = 0, uint edges = 0);

//квадрат из линий
void rect(const vec2f&, const vec2f&, const rgba& = color::white);

//кривая
void curve(uint size, const vec2f *data, const rgba& = color::white, float quality = 1);

//дуги
void ark(const vec2f& pos, float radius, float angle, float value, const rgba& = color::white, uint quality = 0);
void arkSolid(const vec2f& pos, float radius, float angle, float value, const rgba& = color::white, uint quality = 0);
void arkBorder(const vec2f& pos, float radius, float angle, float value, const rgba& = color::white, uint quality = 0);

//кольцо
void ring(const vec2f &pos, float radius, float radius2, const rgba& = color::white, float angle = 0, uint quality = 0);
void ringBorder(const vec2f &pos, float radius, float radius2, const rgba& = color::white, float angle = 0, uint quality = 0);

//кольцо-дуга о_о
void ringArk(const vec2f &pos, float radius, float radius2, float angle, float value, const rgba& = color::white, uint quality = 0);
void ringArkBorder(const vec2f &pos, float radius, float radius2, float angle, float value, const rgba& = color::white, uint quality = 0);
void ringArkRadius(const vec2f &pos, vec2f radiusPair1, vec2f radiusPair2, float angle, float value, const rgba& = color::white, uint quality = 0);

void polygone(const vec2f *vertices, uint count, const rgba &color, bool ccwOrder = false);

//void drawGui(const vec2f& pos, float type, const vec2f& size, const rgba& color, const rgba &borderColor = color::black, const vec4f &border = vec4f(4));

}

}
