ScummVM API documentation
transition.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  * Additional copyright for this file:
8  * Copyright (C) 1995-1997 Presto Studios, Inc.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24 
25 #ifndef PEGASUS_TRANSITION_H
26 #define PEGASUS_TRANSITION_H
27 
28 #include "pegasus/fader.h"
29 
30 namespace Graphics {
31 struct Surface;
32 }
33 
34 namespace Pegasus {
35 
36 class ScreenFader : public Fader {
37 public:
38  ScreenFader();
39  ~ScreenFader() override;
40 
41  void doFadeOutSync(const TimeValue = kOneSecondPerThirtyTicks, const TimeScale = kThirtyTicksPerSecond, bool isBlack = true);
42  void doFadeInSync(const TimeValue = kHalfSecondPerThirtyTicks, const TimeScale = kThirtyTicksPerSecond, bool isBlack = true);
43 
44  void setFaderValue(const int32) override;
45 
46 private:
47  bool _isBlack;
48  uint32 fadePixel(uint32 color, int32 percent) const;
49  Graphics::Surface _screen;
50 };
51 
52 // Transitions are faders that range over [0,1000], which makes their
53 // "resolution" one tenth of a percent
54 
55 static const int kTransitionBottom = 0;
56 static const int kTransitionTop = 1000;
57 
58 static const int kTransitionRange = kTransitionTop - kTransitionBottom;
59 
60 class Transition : public FaderAnimation {
61 public:
62  Transition(const DisplayElementID id);
63  ~Transition() override {}
64 
65  void setBounds(const Common::Rect &) override;
66 
67  virtual void setInAndOutElements(DisplayElement *, DisplayElement *);
68  DisplayElement *getInElement() { return _inPicture; }
69  DisplayElement *getOutElement() { return _outPicture; }
70 
71 protected:
72  DisplayElement *_outPicture;
73  DisplayElement *_inPicture;
74 
75  CoordType _boundsWidth, _boundsHeight;
76 };
77 
78 class Slide : public Transition {
79 public:
80  Slide(const DisplayElementID id) : Transition(id) {}
81  ~Slide() override {}
82 
83  virtual void setSlideDirection(SlideDirection dir) { _direction = dir; }
84  void draw(const Common::Rect &) override;
85 
86  virtual void setDirection(const SlideDirection dir) { _direction = dir; }
87 
88 protected:
89  virtual void adjustSlideRects(Common::Rect &, Common::Rect &);
90  virtual void drawElements(const Common::Rect &, const Common::Rect &, const Common::Rect &);
91  virtual void drawSlideElement(const Common::Rect &, const Common::Rect &, DisplayElement *);
92 
93  SlideDirection _direction;
94 };
95 
96 class Push : public Slide {
97 public:
98  Push(const DisplayElementID id) : Slide(id) {}
99  ~Push() override {}
100 
101 protected:
102  void adjustSlideRects(Common::Rect &, Common::Rect &) override;
103 };
104 
105 } // End of namespace Pegasus
106 
107 #endif
Definition: transition.h:60
Definition: transition.h:96
Definition: surface.h:67
Definition: fader.h:99
Definition: rect.h:144
Definition: fader.h:73
Definition: transition.h:36
Definition: formatinfo.h:28
Definition: elements.h:43
Definition: transition.h:78
Definition: ai_action.h:33