1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/*
* mogltk
* Copyright (C) 1999-2004 Nicolas "Pixel" Noble
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* $Id: font.h,v 1.12 2006-10-28 16:50:46 pixel Exp $ */
#ifndef __FONT_H__
#define __FONT_H__
#include <SDL.h>
#include <stdarg.h>
#include <BString.h>
#include <Handle.h>
#include <Texture.h>
#include <mcolor.h>
#include <base.h>
namespace mogltk {
class Font : public Base {
public:
Font(Handle *);
virtual ~Font();
virtual void drawentry(Uint16, int, int, ColorP = WHITE);
void drawtotex(Texture *, Uint16, int, int, ColorP = WHITE);
void putcursor(int, int);
void putentry(Uint16, ColorP = WHITE);
void putentryontex(Texture *, Uint16, ColorP = WHITE);
void drawchar(unsigned char, ColorP = WHITE);
void drawcharontex(Texture *, unsigned char, ColorP = WHITE);
void newline(void);
int printf(const ugly_string &, ...);
int printf(const char *, ...);
int printf(const ugly_string &, va_list);
rect size(const ugly_string &, ...);
rect size(const char *, ...);
rect size(const ugly_string &, va_list);
rect printtotex(Texture *, const ugly_string &, ...);
rect printtotex(Texture *, const char *, ...);
rect printtotex(Texture *, const ugly_string &, va_list);
Texture * printtex(rect *, const ugly_string &, ...);
Texture * printtex(rect *, const char *, ...);
Texture * printtex(rect *, const ugly_string &, va_list);
void setcolor(ColorP);
void setshadow(int);
void setwspace(int);
int findchar(unsigned char) const;
int singletextsize(const String &) const;
protected:
Uint8 * sizes;
Uint16 nbentries, nbcT, nbT;
Uint8 flags, maxX, maxY, nbcU, nbcV, base, inter;
int cx, cy, ox;
ColorP textcolor;
int shadow, wspace;
Texture * alloctexture();
void Bind(int);
private:
void checknbind(int, ColorP);
Texture ** fonttex;
Texture ** fontcache[16];
Uint16 * corresp;
};
extern Font * SystemFont;
extern Font * FixedFont;
};
#endif
|