1 | /********************************************************************** <BR>
|
---|
2 | This file is part of Crack dot Com's free source code release of
|
---|
3 | Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
|
---|
4 | information about compiling & licensing issues visit this URL</a>
|
---|
5 | <PRE> If that doesn't help, contact Jonathan Clark at
|
---|
6 | golgotha_source@usa.net (Subject should have "GOLG" in it)
|
---|
7 | ***********************************************************************/
|
---|
8 |
|
---|
9 | #ifndef R1_FONT_HH
|
---|
10 | #define R1_FONT_HH
|
---|
11 |
|
---|
12 | #include "font/font.hh"
|
---|
13 | #include "tex_id.hh"
|
---|
14 | class i4_image_class;
|
---|
15 | class r1_render_api_class;
|
---|
16 |
|
---|
17 | class r1_font_class : public i4_font_class
|
---|
18 | {
|
---|
19 |
|
---|
20 | struct char_def
|
---|
21 | {
|
---|
22 | w8 x,y,w;
|
---|
23 | };
|
---|
24 |
|
---|
25 |
|
---|
26 | float xs,ys;
|
---|
27 | char_def pos[256];
|
---|
28 | int longest_w, largest_h;
|
---|
29 | r1_texture_handle texture;
|
---|
30 |
|
---|
31 | r1_render_api_class *api;
|
---|
32 | float r,g,b;
|
---|
33 |
|
---|
34 | i4_bool expand(i4_image_class *from, i4_image_class *to, int start_ch);
|
---|
35 |
|
---|
36 | public:
|
---|
37 |
|
---|
38 | r1_font_class(r1_render_api_class *api, i4_image_class *im, int start_ch=33);
|
---|
39 |
|
---|
40 | virtual void set_color(i4_color color);
|
---|
41 |
|
---|
42 | virtual void put_string(i4_image_class *screen,
|
---|
43 | sw16 x, sw16 y,
|
---|
44 | const i4_const_str &string,
|
---|
45 | i4_draw_context_class &context);
|
---|
46 |
|
---|
47 | virtual void put_character(i4_image_class *screen,
|
---|
48 | sw16 x, sw16 y,
|
---|
49 | const i4_char &c,
|
---|
50 | i4_draw_context_class &context);
|
---|
51 |
|
---|
52 | virtual w16 width(const i4_char &character) { return pos[character.ascii_value()].w; }
|
---|
53 | virtual w16 height(const i4_char &character) { return largest_h; }
|
---|
54 |
|
---|
55 | virtual w16 width(const i4_const_str &string)
|
---|
56 | {
|
---|
57 | int w=0;
|
---|
58 | for (i4_const_str::iterator i=string.begin(); i!=string.end(); ++i)
|
---|
59 | w+=width(i.get());
|
---|
60 | return w;
|
---|
61 | }
|
---|
62 |
|
---|
63 | virtual w16 height(const i4_const_str &string) { return largest_h; }
|
---|
64 |
|
---|
65 | virtual w16 largest_height() { return largest_h; }
|
---|
66 | virtual w16 largest_width() { return longest_w; }
|
---|
67 |
|
---|
68 | virtual ~r1_font_class() { ; }
|
---|
69 | };
|
---|
70 |
|
---|
71 |
|
---|
72 |
|
---|
73 |
|
---|
74 |
|
---|
75 | #endif
|
---|