//Copyright (C) 2007 SiegeLord
//See ReadMe.txt and License.txt for copying information

#pragma once

#include "engine.h"
#include "math_types.h"
#include "bitmap.h"

void InitGfx();

void Present();

void SetColor(zColor color);

void SetModelMatrix(const transform2d& trans);
void SetCameraMatrix(const transform2d& trans);

void DrawRect(float x1, float y1, float x2, float y2, float depth, zColor color);
void DrawFilledRect(float x1, float y1, float x2, float y2, float depth, zColor color);

void DrawBitmap(const SBitmap* bmp, float depth);
void DrawBitmap(const SBitmap* bmp, float x, float y, float depth);
void DrawBitmapStretched(const SBitmap* bmp, float x, float y, float depth, float w, float h);
void DrawBitmapTiled(const SBitmap* bmp, float x, float y, float depth, float w, float h);
void DrawBitmapTiled(const SBitmap* bmp, float x, float y, float depth, float w, float h, float offset_x, float offset_y);

void EnableDepthTesting(bool enable);
float SetLineThickness(float thickness);

void DrawModeMask();
void DrawModeSolid();
void DrawModeAdd();
void DrawModeAlpha();
void DrawModeAlphaAdd();

int BlendColors(zColor color1, zColor color2, float factor);

void DrawTextAlign(const char* text, float x, float y, int v_align, int h_align, zColor color, FONT* fnt);

void DrawPolyLine(vector2d* pts, float depth, int num, zColor color, bool closed);
void DrawLine(float x1, float y1, float x2, float y2, float depth, zColor color);

//if segments < 0 then we automatically determine the number
void DrawCircle(float _x, float _y, float _r, float depth, zColor color, int segments = -1);
//if segments < 0 then we automatically determine the number
void DrawArc(float _x, float _y, float _r, float depth, float start_angle, float d_angle, zColor color, int segments = -1);

void DrawQuadBuffer(SBitmap* bmp, int num_entities, float* vertices, float* tcoords, int* colors);
void DrawQuadStripBuffer(SBitmap* bmp, int num_entities, float* vertices, float* tcoords, int* colors);

//2 uv's, 1 color,  3 positions
void DrawQuadStripInterleaved(SBitmap* bmp, int num_entitities, void* ptr, int stride);

//vertex types
struct SVertexPosColTex
{
	vector2d tex;

	zColor color1;

	vector2d pos2d;
	float z;
};

struct SVertexPos
{
	vector2d pos2d;
	float z;
};

