ScummVM API documentation
panorama.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_NEIGHBORHOOD_NORAD_ALPHA_PANORAMA_H
26 #define PEGASUS_NEIGHBORHOOD_NORAD_ALPHA_PANORAMA_H
27 
28 #include "pegasus/movie.h"
29 
30 namespace Pegasus {
31 
32 /*
33 
34  Panorama implements a wide image using a specially constructed movie file.
35  The movie holds the image as a series of vertical strips, say 16 or 32 pixels wide.
36 
37  The panorama bounds defines the entire panorama. The view bounds represents the
38  area on the panorama that is kept in memory.
39 
40  The panorama bounds is also stored in the movie file; it cannot be changed. The
41  view bounds must always be a subset of the panorama bounds.
42 
43  In actuality, the area kept in memory is at least as wide as the view bounds (but
44  may be wider to coincide with the width of the movies slices), and is as tall as
45  the panorama bounds. The view bounds is used by the drawPanorama function to draw
46  a piece of the panorama to the current screen.
47 
48  The panorama movie is built at a time scale of 1, with each strip lasting for one
49  second, so that strip number corresponds exactly with the time value at which the
50  strip is stored.
51 
52  TO USE:
53 
54  Call one initFromMovieFile to open the movie. Then set up a view rect by
55  calling setViewBounds. Once these two functions have been called, drawPanorama
56  will draw the panorama.
57 
58 */
59 
60 class Panorama {
61 public:
62  Panorama();
63  virtual ~Panorama();
64 
65  void initFromMovieFile(const Common::Path &);
66  void releasePanorama();
67  bool isPanoramaOpen() { return _panoramaMovie.isMovieValid(); }
68 
69  void setViewBounds(const Common::Rect &);
70  void getViewBounds(Common::Rect &) const;
71 
72  void setMask(Surface *);
73 
74  void getPanoramaBounds(Common::Rect &) const;
75 
76  void drawPanorama(const Common::Rect &);
77 
78 protected:
79  void blankFields();
80  void makeNewSurface(const Common::Rect &);
81  void calcStripRange(const Common::Rect &, CoordType &, CoordType &);
82  void loadStrips(CoordType, CoordType);
83  void loadOneStrip(CoordType, CoordType);
84 
85  Movie _panoramaMovie;
86  Surface _panoramaWorld, *_mask;
87  Common::Rect _viewBounds;
88  Common::Rect _drawBounds;
89  CoordType _panoramaWidth, _panoramaHeight;
90  CoordType _stripWidth; // Pixels per strip.
91  CoordType _numStrips;
92  CoordType _stripLeft, _stripRight;
93 };
94 
95 } // End of namespace Pegasus
96 
97 #endif
Definition: movie.h:40
Definition: rect.h:144
Definition: path.h:52
Definition: panorama.h:60
Definition: surface.h:50
Definition: ai_action.h:33