ScummVM API documentation
AnimationEffect.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
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.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /*
23  * This code is based on the CRAB engine
24  *
25  * Copyright (c) Arvind Raja Yadav
26  *
27  * Licensed under MIT
28  *
29  */
30 
31 #ifndef CRAB_ANIMATIONEFFECT_H
32 #define CRAB_ANIMATIONEFFECT_H
33 
34 #include "crab/loaders.h"
35 
36 namespace Crab {
37 
38 namespace pyrodactyl {
39 namespace anim {
40 // Types of fade effects
41 enum FadeType {
42  FADE_NONE,
43  FADE_IN,
44  FADE_OUT
45 };
46 
47 // Sometimes we need to stop drawing the game for proper fade effects
48 // Use DRAW_STOP to stop drawing the game until DRAW_START is called. DRAW_SAME doesn't change anything
49 enum DrawType {
50  DRAW_SAME,
51  DRAW_STOP,
52  DRAW_START
53 };
54 
56  // What sort of effect do we apply to the image
57  FadeType _type;
58 
59  // The duration of the effect relative to the start of this animation
60  uint32 _start, _finish;
61 
62  // Warning: the only way to start drawing the game again is having another animation event with DRAW_START
63  DrawType _drawGame;
64 
65  AnimationEffect() {
66  _type = FADE_NONE;
67  _drawGame = DRAW_SAME;
68  _start = 0;
69  _finish = 0;
70  }
71 
72  AnimationEffect(rapidxml::xml_node<char> *node) : AnimationEffect() {
73  if (nodeValid("effect", node)) {
74  rapidxml::xml_node<char> *effnode = node->first_node("effect");
75  loadNum(_start, "start", effnode);
76  loadNum(_finish, "finish", effnode);
77 
78  Common::String str;
79  loadStr(str, "type", effnode);
80  if (str == "fade_in")
81  _type = FADE_IN;
82  else if (str == "fade_out")
83  _type = FADE_OUT;
84  else
85  _type = FADE_NONE;
86 
87  loadStr(str, "game_draw", effnode);
88  if (str == "start")
89  _drawGame = DRAW_START;
90  else if (str == "stop")
91  _drawGame = DRAW_STOP;
92  else
93  _drawGame = DRAW_SAME;
94  }
95  }
96 };
97 } // End of namespace anim
98 } // End of namespace pyrodactyl
99 
100 } // End of namespace Crab
101 
102 #endif // CRAB_ANIMATIONEFFECT_H
Definition: str.h:59
Definition: moveeffect.h:37
Definition: AnimationEffect.h:55