2 /****************************************************************************
3 * Copyright (C) 2002-2003 by Leo Khramov
4 * email: leo@xnc.dubna.su
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 ****************************************************************************/
16 // $Id: sdlwellimagefont.cxx,v 1.2 2003/02/20 15:09:41 leo Exp $
18 /// module description
19 /// SDL version of imagefont - displays text with SDL calls, work with pixmaps
20 /// loaded thought XWellEngine class
22 #include "sdlwellimagefont.h"
24 //===========================================================================
25 /// global WellImageFont(Images id, unsigned int ifl, unsigned int ifh, int idx, int idy)
26 /// Constructor of base draw text class
27 /// tags WellImageFont
28 SDLWellImageFont::SDLWellImageFont(Images id
, unsigned int ifl
, unsigned int ifh
,
30 WellImageFont(id
,ifl
,ifh
,idx
,idy
)
32 engine
=(SDLWellEngine
*) default_well_engine
;
33 font_surf
=engine
->get_pixmap_of_image(id
);
34 mainw
=engine
->get_main_window();
37 //===========================================================================
38 /// global clear_region()
39 /// clear region on screen for making output
40 /// tags SDLWellImageFont
41 void SDLWellImageFont::clear_region()
48 SDL_FillRect(mainw
, &dest
, 0);
49 SDL_UpdateRects(mainw
, 1, &dest
);
52 //===========================================================================
53 /// global clear_region()
54 /// clear region on screen for making output
55 /// tags SDLWellImageFont
56 void SDLWellImageFont::clear_region(Colors idx
)
59 Uint32
*cols
=engine
->get_colors();
66 SDL_FillRect(mainw
, &dest
, cols
[idx
]);
67 SDL_UpdateRects(mainw
, 1, &dest
);
70 //===========================================================================
71 /// global draw_symbol(...)
72 /// draw one symbol from font image to screen
73 /// tags SDLWellImageFont
74 void SDLWellImageFont::draw_symbol(int ix
, int iy
,
81 if(symb
<=32 || symb
>=127)
83 symb
-=33; //Translate to our indexation
90 src
.y
= dy
+(int)symb
*font_h
;
93 SDL_BlitSurface(font_surf
, &src
, mainw
, &dest
);
94 /* Update the changed portion of the screen */
95 SDL_UpdateRects(mainw
, 1, &dest
);