5 * Copyright (C) 2003, 2007, 2008, 2009 Thomas Perl <thp@thpinfo.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
30 ANIMATION_FADE_IN
= 1<<0,
31 ANIMATION_FADE_OUT
= 1<<1,
32 ANIMATION_FROM_BOTTOM
= 1<<2,
33 ANIMATION_ZOOM_2X
= 1<<3,
34 ANIMATION_SLIDE_LEFT
= 1<<4,
35 ANIMATION_SLIDE_RIGHT
= 1<<5
38 #define ANIMATION_INTRO_EFFECTS (ANIMATION_FADE_IN | ANIMATION_FADE_OUT | ANIMATION_ZOOM_2X)
41 * How much time of the animation should be spent
42 * on fading (0.0..1.0) - usually 1/4 or so...
44 #define ANIMATION_FADE_PART (0.25)
49 GRAVITY_CENTER_SCREEN
,
50 GRAVITY_CENTER_UPPERHALF
,
51 GRAVITY_CENTER_BOTTOMHALF
54 struct _AnimationPart
{
65 unsigned char free_surface
;
71 struct _AnimationPart
* prev
;
72 struct _AnimationPart
* next
;
75 typedef struct _AnimationPart AnimationPart
;
91 Animation
* animation_new();
92 Animation
* animation_append(Animation
*, AnimationPart
*);
93 void animation_free(Animation
*);
95 AnimationState
* animation_state_new(Animation
*);
96 void animation_state_run(AnimationState
*, int);
97 int animation_state_update(AnimationState
*);
98 void animation_state_free(AnimationState
*);
100 AnimationPart
* animation_part_new_from_surface(Uint32
, Uint32
, unsigned int,
101 int, int, int, unsigned int, SDL_Surface
*, unsigned char, int, int);
103 AnimationPart
* animation_part_new_text(Uint32
, Uint32
, unsigned int,
104 int, int, int, unsigned int, font_id
, const char*, Uint8
, Uint8
,
107 void animation_part_display(AnimationPart
*, AnimationState
*);
108 void animation_part_free(AnimationPart
*);
111 /* simplified function calls */
112 #define animation_part_new_from_surface_simple(start, end, effects, \
113 surface, free_surface) \
114 (animation_part_new_from_surface(start, end, effects, 0, 0, 0, \
115 GRAVITY_CENTER_SCREEN, surface, free_surface, 0, 1))
117 #define animation_part_new_text_simple(start, end, effects, id, text) \
118 (animation_part_new_text(start, end, effects, 0, 0, 0, \
119 GRAVITY_CENTER_SCREEN, id, text, 255, 255, 255))
122 /* available animations */
123 Animation
* create_intro();
124 Animation
* create_credits();