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 | #include "font/plain.hh"
|
---|
10 | #include <string.h>
|
---|
11 |
|
---|
12 | i4_plain_font_class::~i4_plain_font_class()
|
---|
13 | {
|
---|
14 | delete bitmap;
|
---|
15 | }
|
---|
16 |
|
---|
17 | i4_plain_font_class::i4_plain_font_class(i4_image_class *bitmap)
|
---|
18 | {
|
---|
19 | i4_plain_font_class::bitmap=bitmap->copy();
|
---|
20 | w=bitmap->width()/32;
|
---|
21 | h=bitmap->height()/8;
|
---|
22 | }
|
---|
23 |
|
---|
24 | void i4_plain_font_class::set_color(i4_color color)
|
---|
25 | {
|
---|
26 | /* w32 p[256];
|
---|
27 | memset(p,0,sizeof(p));
|
---|
28 | w8 r,g,b;
|
---|
29 |
|
---|
30 | i4_pixel_format *f=&pal.pal->source;
|
---|
31 | w32 rgb=(((color & f->red_mask)>>f->red_shift)<<(16+(8-f->red_bits))) |
|
---|
32 | (((color & f->green_mask)>>f->green_shift)<<(8+(8-f->green_bits))) |
|
---|
33 | (((color & f->blue_mask)>>f->blue_shift)<<(16+(8-f->blue_bits)));
|
---|
34 |
|
---|
35 | p[1]=rgb;
|
---|
36 |
|
---|
37 | i4_pixel_format fmt;
|
---|
38 | fmt.pixel_depth=I4_8BIT;
|
---|
39 | fmt.lookup=p;
|
---|
40 |
|
---|
41 | bitmap->set_pal(i4_pal_man.register_pal(&fmt));
|
---|
42 | return i4_T; */
|
---|
43 | }
|
---|
44 |
|
---|
45 | void i4_plain_font_class::put_string(i4_image_class *screen,
|
---|
46 | sw16 x, sw16 y,
|
---|
47 | const i4_const_str &string,
|
---|
48 | i4_draw_context_class &context)
|
---|
49 | {
|
---|
50 | if (!string.null())
|
---|
51 | {
|
---|
52 | i4_const_str::iterator p=string.begin();
|
---|
53 |
|
---|
54 | while (p!=string.end())
|
---|
55 | {
|
---|
56 | char ch=p.get().value();
|
---|
57 | i4_coord x1=((ch)%32)*w;
|
---|
58 | i4_coord y1=((ch)/32)*h;
|
---|
59 |
|
---|
60 | bitmap->put_part_trans(screen,x,y,x1,y1,x1+w-1,y1+h-1,0,context);
|
---|
61 | x+=w;
|
---|
62 |
|
---|
63 | ++p;
|
---|
64 | }
|
---|
65 | }
|
---|
66 | }
|
---|
67 |
|
---|
68 |
|
---|
69 | void i4_plain_font_class::put_character(i4_image_class *screen,
|
---|
70 | sw16 x, sw16 y,
|
---|
71 | const i4_char &c,
|
---|
72 | i4_draw_context_class &context)
|
---|
73 | {
|
---|
74 | char ch=c.value();
|
---|
75 | i4_coord x1=((ch)%32)*w;
|
---|
76 | i4_coord y1=((ch)/32)*h;
|
---|
77 | bitmap->put_part_trans(screen,x,y,x1,y1,x1+w-1,y1+h-1,0,context);
|
---|
78 | }
|
---|