ScummVM API documentation
channel.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 #ifndef DIRECTOR_CHANNEL_H
23 #define DIRECTOR_CHANNEL_H
24 
25 #include "director/cursor.h"
26 #include "director/sprite.h"
27 
28 namespace Graphics {
29  struct Surface;
30  class ManagedSurface;
31  class MacWidget;
32 }
33 
34 namespace Director {
35 
36 class Sprite;
37 class Cursor;
38 class Score;
39 
40 class Channel {
41 public:
42  Channel(Score *sc, Sprite *sp, int priority = 0);
43  Channel(const Channel &channel);
44  Channel& operator=(const Channel &channel);
45  ~Channel();
46 
47  DirectorPlotData getPlotData();
48  const Graphics::Surface *getMask(bool forceMatte = false);
49 
50  inline int getWidth() { return _sprite->_width; };
51  inline int getHeight() { return _sprite->_height; };
52  inline Common::Point getPosition() { return _sprite->getPosition(); };
53  // Return the area of screen to be used for drawing content.
54  inline Common::Rect getBbox(bool unstretched = false) { return _sprite->getBbox(unstretched); };
55  Common::Rect getRollOverBbox();
56 
57  bool isStretched();
58  bool isDirty(Sprite *nextSprite = nullptr);
59  bool isEmpty();
60  bool isActiveText();
61  CollisionTest isMouseIn(const Common::Point &pos);
62  bool isMatteIntersect(Channel *channel);
63  bool isMatteBoxIntersect(Channel *channel);
64  bool isMatteWithin(Channel *channel);
65  bool isActiveVideo();
66  bool isVideoDirectToStage();
67 
68  inline void setWidth(int w) { _sprite->setWidth(w); replaceWidget(); setNeedsDraw(); };
69  inline void setHeight(int h) { _sprite->setHeight(h); replaceWidget(); setNeedsDraw(); };
70  inline void setBbox(int l, int t, int r, int b) { _sprite->setBbox(l, t, r, b); replaceWidget(); setNeedsDraw(); };
71  void setDirty();
72  void setNeedsDraw() { _needsDraw = true; }
73  void setPosition(int x, int y, bool force = false);
74  void setCast(CastMemberID memberID);
75  void setClean(Sprite *nextSprite, bool partial = false);
76  void setStretch(bool enabled);
77  bool getEditable();
78  void setEditable(bool editable);
79  void replaceSprite(Sprite *nextSprite);
80  void replaceWidget(CastMemberID previousCastId = CastMemberID(0, 0), bool force = false);
81  bool updateWidget();
82  void updateTextCast();
83 
84  bool isTrail();
85 
86  void updateGlobalAttr();
87 
88  bool canKeepWidget(CastMemberID castId);
89  bool canKeepWidget(Sprite *currentSprite, Sprite *nextSprite);
90 
91  int getMouseChar(int x, int y);
92  int getMouseWord(int x, int y);
93  int getMouseItem(int x, int y);
94  int getMouseLine(int x, int y);
95 
96  void updateVideoTime();
97 
98  // used for film loops
99  bool hasSubChannels();
100  Common::Array<Channel> *getSubChannels();
101  CastMemberID getSubChannelSound1();
102  CastMemberID getSubChannelSound2();
103 
104  Common::String formatInfo();
105 
106 public:
107  Sprite *_sprite;
108  Cursor _cursor;
109  Graphics::MacWidget *_widget;
110 
111  bool _widgetDirty;
112  bool _needsDraw;
113  bool _visible;
114  bool _hideFromStage; // Used in DT for hiding the channel from rendering
115  uint _constraint;
117 
118  int _priority;
119 
120  // Used in digital movie sprites
121  double _movieRate;
122  int _movieTime;
123  int _startTime;
124  int _stopTime;
125 
126  // Used in film loops
127  uint _filmLoopFrame;
128 
129  Common::Rect _rollOverBbox;
130  Common::Rect _lastRenderedBbox;
131  bool _lastTrail;
132 
133  int _startFrame;
134  int _endFrame;
135  Common::Array<Datum> _scriptInstanceList;
136 
137 private:
138  Graphics::ManagedSurface *getSurface();
139  Score *_score;
140 };
141 
142 } // End of namespace Director
143 
144 #endif
Definition: managed_surface.h:51
Definition: str.h:59
Definition: surface.h:67
Definition: channel.h:40
Definition: array.h:52
Definition: rect.h:524
Definition: archive.h:36
Definition: cursor.h:41
Definition: atari-cursor.h:35
Definition: sprite.h:100
Definition: formatinfo.h:28
Definition: score.h:66
Definition: rect.h:144
Definition: macwidget.h:39
Definition: types.h:423
Definition: director.h:350