|
SDLGameEngine
|
00001 #ifndef _SGEFONT_H 00002 #define _SGEFONT_H 00003 00004 #ifdef __cplusplus 00005 extern "C" { 00006 #endif 00007 00012 /* 00013 * Copyright (c) 2007 Heiko Irrgang 00014 * 00015 * The license and distribution terms for this file may be 00016 * found in the file COPYING in this distribution or at 00017 * http://93-interactive.com/cms/products/software/sdl-game-engine/license/ 00018 */ 00019 00046 #define SGEFONT_BITMAP 1 00047 00052 typedef struct { 00054 SDL_Surface *bitmap; 00055 unsigned char *charmap; 00056 SGEARRAY *info; 00057 } SGEBITMAPFONT; 00058 00063 typedef struct { 00065 int type; 00067 Uint8 alpha; 00069 void *data; 00070 } SGEFONT; 00071 00076 enum SGEFONTFX_TYPES { 00078 SGEFONTFX_FADE_IN, 00080 SGEFONTFX_FADE_OUT, 00082 SGEFONTFX_FADE_INOUT, 00084 SGEFONTFX_MOVE_IN, 00086 SGEFONTFX_MOVE_OUT, 00088 SGEFONTFX_MOVE_INOUT, 00090 SGEFONTFX_COUNTDOWN 00091 }; 00092 00097 enum SGEFONTFX_MOVEMENT { 00099 SGEFONTFX_MOVE_LINEAR, 00101 SGEFONTFX_MOVE_SLOWDOWN, 00103 SGEFONTFX_MOVE_ACCELERATE, 00105 SGEFONTFX_MOVE_BOUNCE 00106 }; 00107 00112 typedef struct { 00114 Uint32 runtime; 00115 Uint8 fade; 00116 } SGEFONTFXFADEINFO; 00117 00122 typedef struct { 00124 Uint32 runtime; 00125 Sint32 start; 00126 Sint32 end; 00127 } SGEFONTFXCOUNTDOWNINFO; 00128 00133 typedef struct { 00135 int startx, starty; 00136 int endx, endy; 00137 Uint32 type; 00138 Uint32 runtime; 00139 Uint32 startTime; 00140 Uint32 finishTime; 00141 Uint32 charOffset; 00142 Uint32 finished; 00143 Uint8 movement; 00144 SDL_Surface *surface; 00145 SGEFONT *font; 00146 void *data; 00147 void (*updateFunction)(void *); 00148 void (*freeFunction)(void *); 00149 char *text; 00150 SGEARRAY *textSprites; 00151 Uint32 preDelay; 00152 Uint32 postDelay; 00153 Uint8 hideOnPreDelay; 00154 } SGEFONTFX; 00155 00160 typedef struct { 00162 SGEFONTFX *fadeIn; 00163 SGEFONTFX *fadeOut; 00164 } SGEFONTFXFADEINOUTINFO; 00165 00172 SGEFONT *sgeFontNew(int type); 00173 00182 SGEFONT *sgeFontNewFile(SGEFILE *f, int type, const char *filename); 00183 00185 SGEFONT *sgeFontNewFileBitmap(SGEFILE *f, const char *filename); 00186 00191 void sgeFontDestroy(SGEFONT *f); 00192 00198 int sgeFontGetLineHeight(SGEFONT *f); 00200 int sgeFontGetLineHeightBitmap(SGEFONT *f); 00201 00210 int sgeFontPrint(SGEFONT *f, SDL_Surface *dest, int x, int y, const char *text); 00212 int sgeFontPrintBitmap(SGEFONT *f, SDL_Surface *dest, int x, int y, const char *text); 00213 00220 int sgeFontGetWidth(SGEFONT *f, const char *text); 00222 int sgeFontGetWidthBitmap(SGEFONT *f, const char *text); 00223 00231 void sgeFontIgnoreAlpha(SGEFONT *f); 00232 00238 void sgeFontUseAlpha(SGEFONT *f); 00239 00277 SGEFONTFX *sgeFontFXNew(SGEFONT *f, Uint32 fxtype, Uint8 movement, Uint32 runtime, Uint32 charOffset, int startx, int starty, int endx, int endy, const char *text); 00278 00283 void sgeFontFXDraw(SGEFONTFX *fx); 00284 00289 void sgeFontFXDestroy(SGEFONTFX *fx); 00290 00300 void sgeFontFXCountdownSetValues(SGEFONTFX *fx, Sint32 start, Sint32 end); 00301 00308 void sgeFontFXPreDelay(SGEFONTFX *fx, Uint32 delay); 00309 00316 void sgeFontFXHideOnPreDelay(SGEFONTFX *fx, Uint8 yesno); 00317 00324 void sgeFontFXPostDelay(SGEFONTFX *fx, Uint32 delay); 00325 00330 void sgeFontFXSetFinished(SGEFONTFX *fx); 00331 00342 int sgeFontFXFinished(SGEFONTFX *fx); 00343 00349 void sgeFontFXSetTarget(SGEFONTFX *fx, SDL_Surface *surface); 00350 00352 SGEFONTFXFADEINFO *sgeFontFXFadeInfoNew(Uint32 runtime); 00353 void sgeFontFXFadeInfoDestroy(SGEFONTFXFADEINFO *fi); 00354 SGEFONTFXFADEINOUTINFO *sgeFontFXFadeInOutInfoNew(SGEFONTFX *fx, Uint32 runtimein, Uint32 runtimeout,Uint8 fade); 00355 void sgeFontFXFadeInOutInfoDestroy(SGEFONTFXFADEINOUTINFO *fi); 00356 SGEFONTFXCOUNTDOWNINFO *sgeFontFXCountdownInfoNew(Uint32 runtime); 00357 void sgeFontFXCountdownInfoDestroy(SGEFONTFXCOUNTDOWNINFO *fi); 00358 int sgeFontFXGetPer10K(SGEFONTFX *fx, Uint32 current, Uint32 runtime, Uint32 currentElement, Uint32 numberOfElements); 00359 00360 void sgeFontFXFadeInUpdate(void *data); 00361 void sgeFontFXFadeInDestroy(void *data); 00362 00363 void sgeFontFXFadeOutUpdate(void *data); 00364 void sgeFontFXFadeOutDestroy(void *data); 00365 00366 void sgeFontFXFadeInOutUpdate(void *data); 00367 void sgeFontFXFadeInOutDestroy(void *data); 00368 00369 void sgeFontFXCountdownUpdate(void *data); 00370 void sgeFontFXCountdownDestroy(void *data); 00371 00372 // }@ 00373 00374 #ifdef __cplusplus 00375 } 00376 #endif 00377 00378 #endif