ScummVM API documentation
image_viewer.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 PSP_IMAGE_VIEWER_H
23 #define PSP_IMAGE_VIEWER_H
24 
25 #include "engines/engine.h" // for PauseToken
26 
27 class InputHandler;
28 
29 class ImageViewer : public DisplayClient {
30 public:
31  enum Event {
32  EVENT_NONE = -1,
33  EVENT_HIDE = 0,
34  EVENT_SHOW = 1,
35  EVENT_ZOOM_IN,
36  EVENT_ZOOM_OUT,
37  EVENT_MOVE_LEFT,
38  EVENT_MOVE_UP,
39  EVENT_MOVE_RIGHT,
40  EVENT_MOVE_DOWN,
41  EVENT_MOVE_STOP,
42  EVENT_NEXT_IMAGE,
43  EVENT_LAST_IMAGE,
44  };
45 
46 private:
47  Buffer *_buffer;
48  Palette *_palette;
49  GuRenderer *_renderer;
50  bool _visible;
51  bool _dirty;
52  bool _init;
53  uint32 _imageNum; // current image number
54  float _zoomFactor; // how much we're zooming in/out on the image
55  float _visibleHeight, _visibleWidth;
56  float _centerX, _centerY;
57  Event _movement;
58  PauseToken _pauseToken;
59 
60  InputHandler *_inputHandler;
61  DisplayManager *_displayManager;
62 
63  void setFullScreenImageParams();
64  void loadNextImage();
65  void loadLastImage();
66  void setViewerButtons(bool active);
67  void setConstantRendererOptions();
68  void moveImageX(float val);
69  void moveImageY(float val);
70  bool load(int imageNum);
71  void unload();
72  void runLoop(); // to get total pausing we have to do our own loop
73 
74  void setZoom(float value);
75  void setOffsetParams();
76  void modifyZoom(bool up); // up or down
77  void setVisible(bool visible);
78 
79 public:
80 
81  ImageViewer() : _buffer(0), _palette(0), _visible(false),
82  _dirty(false), _init(false), _imageNum(0),
83  _zoomFactor(0.0f), _visibleHeight(0.0f), _visibleWidth(0.0f),
84  _centerX(0.0f), _centerY(0.0f), _movement(EVENT_MOVE_STOP),
85  _inputHandler(0), _displayManager(0) {}
86  ~ImageViewer() { unload(); } // deallocate images
87  bool load();
88  void render();
89  bool isVisible() { return _visible; }
90  bool isDirty() { return _dirty; }
91  void setDirty() { _dirty = true; }
92  void setClean() { if (!_visible) // otherwise we want to keep rendering
93  _dirty = false;
94  }
95  void resetOnEngineDone();
96 
97  void handleEvent(uint32 event);
98 
99  // pointer setters
100  void setInputHandler(InputHandler *inputHandler) { _inputHandler = inputHandler; }
101  void setDisplayManager(DisplayManager *displayManager) { _displayManager = displayManager; }
102 };
103 
104 #endif /* PSP_IMAGE_VIEWER_H */
Definition: engine.h:102
Definition: input.h:165
Definition: display_manager.h:103
Definition: display_client.h:172
Definition: image_viewer.h:29
Definition: display_client.h:113
Definition: display_client.h:40
Definition: display_client.h:78