00001
00002
00003
00004
00005
00006 #ifndef FONT_H
00007 #define FONT_H
00008
00009 #include<windows.h>
00010 #include<string>
00011
00012 class GLWindow;
00013
00017 class Font
00018 {
00019 friend GLWindow;
00020 public:
00022 static void setFont(Font *font) {
00023 defaultFont = font;
00024 }
00025
00027 static Font *getFont() {
00028 return defaultFont;
00029 }
00030
00032 static int getDefaultFontWidth() {
00033 return fontWidth;
00034 }
00035
00037 static int getDefaultFontHeight() {
00038 return fontWidth;
00039 }
00040
00042 virtual ~Font();
00043
00045 void printf(int x, int y, int width, const char *fmt, ...);
00046
00048 void print(int x, int y, int width, const string &text) {
00049 print(x, y, width, text.begin(), text.size());
00050 }
00051
00053 void print(
00054 int x, int y, int width, const char *str, int size);
00055
00056 protected:
00058 Font(HDC dc);
00059
00061 static Font *defaultFont;
00062
00064 static int fontHeight;
00065
00067 static int fontWidth;
00068
00070 int base;
00071 };
00072 #endif