2
* @file sprites_string.h
3
* @brief Handle the strings fonts of sprites
6
* @author Bruno Ethvignot
9
* copyright (c) 1998-2007 TLK Games all rights reserved
10
* $Id: sprites_string.h,v 1.31 2007/08/19 19:21:15 gurumeditation Exp $
12
* Powermanga is free software; you can redistribute it and/or modify
13
* it under the terms of the GNU General Public License as published by
14
* the Free Software Foundation; either version 3 of the License, or
15
* (at your option) any later version.
17
* Powermanga is distributed in the hope that it will be useful, but
18
* WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* You should have received a copy of the GNU General Public License
23
* along with this program; if not, write to the Free Software
24
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27
#ifndef __SPRITES_STRING_
28
#define __SPRITES_STRING__
35
#define FONTS_MAX_OF_IMAGES 16
63
FONTS_WITCH_OFFSCREEN;
65
typedef struct sprite_char_struct
67
/** If TRUE char is displayed */
73
/** If TRUE char is animated */
75
/** Number of sprite images of the animation */
79
/** Delay before next image: speed of the animation */
81
Uint32 anim_speed_inc;
82
Uint32 anim_speed_count;
83
/** Type of font used: FONT_GAME, FONT_BIG or FONT_SCROLL */
85
/* Width and height of a font in pixels */
87
/** Indicate in which screen the chars must be drawed */
88
Uint32 which_offscreen;
101
* Data structure for string of chars sprites
103
typedef struct sprite_string_struct
105
/** Current number of the chars */
107
/** Maximum number of the chars */
109
/** Indicate in which screen the chars must be drawed */
110
Uint32 which_offscreen;
111
/** X and y coordinates of the string */
117
/** At least a character was animated */
118
bool at_least_one_char_changed;
119
/** No character was animated */
120
bool none_char_animated;
121
/** Space in pixel between 2 chars */
123
/** Delay before process next char */
124
Sint32 delay_next_char;
125
Sint32 delay_next_char_count;
126
Sint32 delay_add_to_last;
127
/** Index of the next char to be animated */
132
Sint32 angle_increment;
137
/** True if the string was allocated */
138
bool is_string_allocated;
139
sprite_char_struct *sprites_chars;
141
Uint32 cursor_status;
142
} sprite_string_struct;
144
bool sprites_string_once_init (void);
145
void sprites_string_free (void);
146
sprite_string_struct *sprites_string_new (const char *const string,
147
Uint32 more_chars, Uint32 type,
148
float coordx, float coordy);
149
sprite_string_struct *sprites_string_create (char *string, Uint32 size,
150
Uint32 type, float coordx,
152
void sprites_string_delete (sprite_string_struct * sprite_str);
153
void sprite_char_initialize (sprite_char_struct * sprite_char, char code,
154
Sint32 xcoord, Sint32 ycoord, Uint32 type);
155
void sprite_set_char (sprite_char_struct * sprite_char, char code);
156
void sprite_char_init_rotate (sprite_char_struct * sprite_char,
157
Uint32 angle, Sint32 angle_inc,
158
Uint32 radius_x, Uint32 radius_y);
159
bool sprite_char_anim (sprite_char_struct * sprite_char, bool restart);
160
bool sprite_char_rotate (sprite_char_struct * sprite_char, Sint32 decx,
161
Sint32 decy, Sint32 min);
162
bool sprite_char_rotate_enlarge (sprite_char_struct * sprite_char,
163
Sint32 incx, Sint32 incy, Sint32 max_x,
166
bool sprite_string_set_char (sprite_string_struct * sprite_str, char *str);
167
void sprite_chars_to_image (sprite_string_struct * sprite_str);
169
void sprite_string_init_rotation (sprite_string_struct * sprite_str,
170
Uint32 angle, Uint32 angle_increment,
171
Uint32 radius_x, Uint32 radius_y);
172
void sprite_string_set_center (sprite_string_struct * sprite_str,
173
Sint32 centerx, Sint32 centery);
174
void sprite_string_centerx (sprite_string_struct * sprite_str, float coordy,
176
void sprite_string_center (sprite_string_struct * sprite_str);
177
bool sprites_string_rotation_dec (sprite_string_struct * sprite_str,
178
Uint32 dec_x, Uint32 dec_y,
180
bool sprites_string_rotation_inc (sprite_string_struct * sprite_str,
181
Uint32 inc_x, Uint32 inc_y,
182
Sint32 xmax_pos, Sint32 ymax_pos);
183
void sprite_string_coords (sprite_string_struct * sprite_str);
184
void sprite_string_init_anim (sprite_string_struct * sprite_str,
185
Uint32 anim_speed_inc, Uint32 anim_speed,
186
bool is_anim, Uint32 anim_speed_count);
187
void sprite_string_restart_anim (sprite_string_struct * sprite_str);
188
void sprite_string_set_anim (sprite_string_struct * sprite_str);
189
Sint32 sprite_string_anim (sprite_string_struct * sprite_str, bool restart);
190
bool sprite_string_anim_one (sprite_string_struct * sprite_str);
191
void sprite_string_draw (sprite_string_struct * sprite_str);
193
Sint32 sprites_string_input (sprite_string_struct * sprite_str);
194
void sprites_string_input_code (sprite_string_struct * sprite_str,
196
void sprites_string_set_joy (Uint32 code);
197
void sprites_string_clr_joy (Uint32 code);
198
void sprites_string_key_down (Uint32 code, Uint32 sym);
199
void sprites_string_key_up (Uint32 code, Uint32 sym);
200
void sprites_string_set_cursor_pos (sprite_string_struct * sprite_str,