rayfract
diff src/utktext.h @ 2:87b6a11c920b
added gui stuff
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Tue, 26 Oct 2010 08:49:09 +0300 |
parents | |
children | bf1d56975cc9 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/utktext.h Tue Oct 26 08:49:09 2010 +0300 1.3 @@ -0,0 +1,45 @@ 1.4 +#ifndef TEXT_H 1.5 +#define TEXT_H 1.6 + 1.7 +#if defined(WIN32) || defined(__WIN32__) 1.8 +#include <windows.h> 1.9 +#endif 1.10 + 1.11 +#include <vmath.h> 1.12 + 1.13 +class Color { 1.14 +public: 1.15 + float r, g, b, a; 1.16 + 1.17 + Color() {r = g = b = a = 1.0f;} 1.18 + Color(float r, float g, float b, float a = 1.0f) {this->r = r; this->g = g; this->b = b; this->a = a;} 1.19 +}; 1.20 + 1.21 + 1.22 +unsigned int CreateFont(const char *fname, int font_size); 1.23 +void DeleteFont(unsigned int fid); 1.24 +unsigned int GetFont(const char *fname, int sz); 1.25 +bool BindFont(unsigned int fid); 1.26 + 1.27 + 1.28 +void SetTextPos(const Vector2 &pos); 1.29 +Vector2 GetTextPos(); 1.30 + 1.31 +void TextLineAdvance(int adv = 1); 1.32 +void TextCRet(); 1.33 + 1.34 +void SetTextSize(float sz); 1.35 +float GetTextSize(); 1.36 + 1.37 +void SetTextColor(const Color &col); 1.38 +Color GetTextColor(); 1.39 + 1.40 +float PrintChar(char c); 1.41 +float PrintString(const char *text, bool standalone = true); 1.42 +void PrintStringLines(const char **str, int lines); 1.43 + 1.44 +float GetMaxDescent(); 1.45 +float GetLineAdvance(); 1.46 +float GetTextWidth(const char *str); 1.47 + 1.48 +#endif // TEXT_H