1 /**
2  * @file display_text_bitmap.h
3  * @brief Display bitmap strings
4  * @date 2007-11-16
5  * @copyright 1991-2014 TLK Games
6  * @author Bruno Ethvignot
7  * @version $Revision: 24 $
8  */
9 /*
10  * copyright (c) 1991-2014 TLK Games all rights reserved
11  * $Id: display_text_bitmap.h 24 2014-09-28 15:30:04Z bruno.ethvignot@gmail.com $
12  *
13  * TecnoballZ is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 3 of the License, or
16  * (at your option) any later version.
17  *
18  * TecnoballZ is distributed in the hope that it will be useful, but
19  * WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26  * MA  02110-1301, USA.
27  */
28 #ifndef __DISPLAY_TEXT_BITMAP__
29 #define __DISPLAY_TEXT_BITMAP__
30 
31 class display_text_bitmap;
32 
33 #include "../include/handler_display.h"
34 #include "../include/bitmap_data.h"
35 #include "../include/tecnoballz.h"
36 #include "../include/sprite_object.h"
37 
38 class display_text_bitmap:public virtual tecnoballz
39 {
40 protected:
41   static const Uint32 CHAR_WIDTH = 8;
42   static char ascii2code[128];
43   Sint32 off_desti1;            // modulo destination affichage ecran
44   Sint32 off_source;            // modulo source page graphique
45   bitmap_data *bitmap_fonts;
46   SDL_Surface *surface_fonts;
47   SDL_Rect rect_fonts;
48   SDL_Rect rect_destination;
49   char int_string_tmp[16];
50   char *caract_adr;
51 
52   /** Height of the chars in pixels */
53   Uint32 char_height;
54   /** Width of the chars in pixels */
55   Uint32 char_width;
56 
57 public:
58     display_text_bitmap ();
59    ~display_text_bitmap ();
60   void initial_me ();
61   void destroy_me ();
62   void initialize ();
63   Uint32 get_char_height ();
64   void load_bitmap_fonts (Uint32 resource_id);
65   void draw (offscreen_surface *dest, Uint32 xcoord, Uint32 ycoord, Sint32 value, Uint32 padding);
66   void draw (surface_sdl *dest, Uint32 xcoord, Uint32 ycoord, Sint32 value, Uint32 padding);
67   void draw (offscreen_surface *dest, Uint32 xcoord, Uint32 ycoord, const char* str, Uint32 length = 0);
68   void draw (surface_sdl *dest, Uint32 xcoord, Uint32 ycoord, const char* str, Uint32 length = 0);
69   void print_to_string (char *src, char *dst, Uint32 length = 0);
70   void print_int_to_string (Sint32 value, Sint32 padding, char *dst);
71   sprite_object *string2bob (const char *ptStr);
72 };
73 #endif
74