#ifndef __TEXT
#define __TEXT

#include "vectors.h"

enum{
	kTextAlignLeft,
	kTextAlignMiddle,
	kTextAlignRight
};

#define kTextXPos kScreenXPos
#define kTextYPos kScreenYPos

#define kFadingMessageXPos 0.0
#define kFadingMessageYPos 0.6
#define kFadingMessageSize 0.08

#define kTextAutoWrap (1<<31)
#define kTextAutoCut (1<<30)
#define kTextAlignMask (~(kTextAutoWrap|kTextAutoCut))

typedef struct{
	float x1,x2,y1,y2;
} tFontCharInfo;

typedef struct{
	int fontTexture;
	float ascent;
	int startChar,numChars;
	tFontCharInfo *chars;
} tFontInfo;

extern tVector2 gTextBufferScale;
extern float gTextOpacity;

float TextWidth(char *str,float size);
void TextDrawSimple(char *text,float maxWidth,float size,int align);
void TextLoadFont(int fontRef);
void TextPrintBuffer(float opacity,int useInstrumentColor);
void TextClearBuffer();
void TextClearBufferFading();
void TextPrintfToBuffer(const char *fmt, ...);
void TextPrintfToBufferFormated(tVector2 pos,float size,int align,const char *fmt, ...);
void TextPrintfToBufferFormatedVector3(tVector3 pos,float size,int align,const char *fmt, ...);
void TextPrintfToBufferFormatedFading(tVector2 pos,float size,int align,float startFade,float endFade,const char *fmt, ...);
void TextPrintfToBufferFormatedColored(tVector2 pos,float size,int align,float r,float g,float b,float a,const char *fmt, ...);
void TextPrintfToBufferFormatedColoredTilted(tVector2 pos,float size,int align,float tilt,float r,float g,float b,float a,const char *fmt, ...);

#endif