1 /*
2   Copyright (C) 2009 Facundo Domínguez
3 
4   This file is part of Spacejunk.
5 
6   Spacejunk is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10 
11   Foobar is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15 
16   You should have received a copy of the GNU General Public License
17   along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef FADE_H
21 #define FADE_H
22 
23 #include "SDL.h"
24 #include "global.h"
25 
26 class Fade {
27 public:
28     typedef enum {IN,OUT,NONE} FadeMode;
Fade()29     Fade() : mode(NONE), delta(0) {}
30     void setMode(FadeMode fm,int delta);
getMode()31     FadeMode getMode() {
32         return mode;
33     }
34     bool step();
35 private:
36     FadeMode mode;
37     SDL_Color mycolors[256];
38     int inittime,delta;
39 
40     void dark_fade_end();
41     void light_fade_end();
42     void fade(float f);
43     bool fade_in(int max,int delta);
44     bool fade_out(int max,int delta);
45 };
46 
47 
48 #endif // FADE_H
49