Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5131 | clevermous | 1 | /* |
2 | SDL_flic - renders FLIC animations |
||
3 | Copyright (C) 2003 Andre de Leiradella |
||
4 | |||
5 | This library is free software; you can redistribute it and/or |
||
6 | modify it under the terms of the GNU Lesser General Public |
||
7 | License as published by the Free Software Foundation; either |
||
8 | version 2.1 of the License, or (at your option) any later version. |
||
9 | |||
10 | This library is distributed in the hope that it will be useful, |
||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||
13 | Lesser General Public License for more details. |
||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public |
||
16 | License along with this library; if not, write to the Free Software |
||
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
18 | |||
19 | For information about SDL_flic contact leiradella@bigfoot.com |
||
20 | |||
21 | Version 1.0: first public release. |
||
22 | Version 1.1: fixed bug to set *error to FLI_OK when returning successfully from FLI_Open |
||
23 | added function FLI_Reset to reset the animation to the first frame |
||
24 | Version 1.2: added function FLI_Skip to skip the current frame without rendering |
||
25 | FLI_Animation->surface is now correctly locked and unlocked |
||
26 | the rwops stream is now part of the FLI_Animation structure and is closed inside FLI_Close |
||
27 | renamed FLI_Reset to FLI_Rewind |
||
28 | added function FLI_Version that returns the library version |
||
29 | */ |
||
30 | #ifndef __SDL_flic_h__ |
||
31 | #define __SDL_flic_h__ |
||
32 | |||
33 | #include |
||
34 | #include |
||
35 | |||
36 | #ifdef __cplusplus |
||
37 | extern "C" { |
||
38 | #endif |
||
39 | |||
40 | /* Supported formats. */ |
||
41 | #define FLI_FLI 0xAF11 |
||
42 | #define FLI_FLC 0xAF12 |
||
43 | |||
44 | /* Error codes. */ |
||
45 | |||
46 | /* No error. */ |
||
47 | #define FLI_OK 0 |
||
48 | /* Error reading the file. */ |
||
49 | #define FLI_READERROR 1 |
||
50 | /* Invalid frame size (corrupted file). */ |
||
51 | #define FLI_CORRUPTEDFILE 2 |
||
52 | /* Error in SDL operation. */ |
||
53 | #define FLI_SDLERROR 3 |
||
54 | /* Out of memory. */ |
||
55 | #define FLI_OUTOFMEMORY 4 |
||
56 | |||
57 | /* |
||
58 | The animation structure, all members are read-only, don't try to longjmp to |
||
59 | error. |
||
60 | */ |
||
61 | typedef struct { |
||
62 | Uint32 format, numframes, width, height, depth, delay, offframe1, nextframe, offnextframe; |
||
63 | /* rwops is where the animation is read from. */ |
||
64 | SDL_RWops *rwops; |
||
65 | /* surface is where the frames is rendered to. */ |
||
66 | SDL_Surface *surface; |
||
67 | /* error is used to longjmp in case of error so to avoid a chain of if's. */ |
||
68 | jmp_buf error; |
||
69 | } FLI_Animation; |
||
70 | |||
71 | /* |
||
72 | Returns the library version in the format MAJOR << 16 | MINOR. |
||
73 | */ |
||
74 | extern int FLI_Version(void); |
||
75 | /* |
||
76 | Opens a FLIC animation and return a pointer to it. rwops is left at the same |
||
77 | point it was before the the call. error receives the result of the call. |
||
78 | */ |
||
79 | extern FLI_Animation *FLI_Open(SDL_RWops *rwops, int *error); |
||
80 | /* |
||
81 | Closes the animation, closes the stream and frees all used memory. |
||
82 | */ |
||
83 | extern void FLI_Close(FLI_Animation *flic); |
||
84 | /* |
||
85 | Renders the next frame of the animation returning an int to indicate if it was |
||
86 | successfull or not. |
||
87 | */ |
||
88 | extern int FLI_NextFrame(FLI_Animation *flic); |
||
89 | /* |
||
90 | Rewinds the animation to the first frame. |
||
91 | */ |
||
92 | extern int FLI_Rewind(FLI_Animation *flic); |
||
93 | /* |
||
94 | Skips the current frame of the animation without rendering it. |
||
95 | */ |
||
96 | extern int FLI_Skip(FLI_Animation *flic); |
||
97 | |||
98 | #ifdef __cplusplus |
||
99 | }; |
||
100 | #endif |
||
101 | |||
102 | #endif><> |