ScummVM API documentation
render.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 // Main rendering loop - private header
23 
24 #ifndef SAGA_RENDER_H
25 #define SAGA_RENDER_H
26 
27 #include "saga/sprite.h"
28 #include "saga/gfx.h"
29 #include "common/list.h"
30 
31 namespace Saga {
32 
33 enum RENDER_FLAGS {
34  RF_RENDERPAUSE = (1 << 0),
35  RF_MAP = (1 << 1),
36  RF_DISABLE_ACTORS = (1 << 2),
37  RF_DEMO_SUBST = (1 << 3)
38 };
39 
40 // Extra render flags used for debugging
41 #ifdef SAGA_DEBUG
42 enum RENDER_DEBUG_FLAGS {
43  RF_SHOW_FPS = (1 << 4),
44  RF_PALETTE_TEST = (1 << 5),
45  RF_TEXT_TEST = (1 << 6),
46  RF_OBJECTMAP_TEST = (1 << 7),
47  RF_ACTOR_PATH_TEST = (1 << 8)
48 };
49 #endif
50 
51 class Render {
52 public:
53  Render(SagaEngine *vm, OSystem *system);
54  ~Render();
55  bool initialized();
56  void drawScene();
57 
58  unsigned int getFlags() const {
59  return _flags;
60  }
61 
62  void setFlag(unsigned int flag) {
63  _flags |= flag;
64  }
65 
66  void clearFlag(unsigned int flag) {
67  _flags &= ~flag;
68  }
69 
70  void toggleFlag(unsigned int flag) {
71  _flags ^= flag;
72  }
73 
74  Surface *getBackGroundSurface() {
75  return &_backGroundSurface;
76  }
77 
78  void addDirtyRect(Common::Rect rect);
79 
80  void clearDirtyRects() {
81  _dirtyRects.clear();
82  }
83 
84  void setFullRefresh(bool flag) {
85  _fullRefresh = flag;
86  }
87 
88  bool isFullRefresh() {
89  return _fullRefresh;
90  }
91 
97  void setSplitScreen(bool flag) {
98  _splitScreen = flag;
99  }
100 
101  void maskSplitScreen();
102  void drawDirtyRects();
103  void scale2xAndMergeOverlay(int x, int y, int w, int h);
104  void restoreChangedRects();
105 
106 private:
107 #ifdef SAGA_DEBUG
108  static void fpsTimerCallback(void *refCon);
109  void fpsTimer();
110  unsigned int _fps;
111  unsigned int _renderedFrameCount;
112 #endif
113 
114  SagaEngine *_vm;
115  OSystem *_system;
116  bool _initialized;
117  Common::List<Common::Rect> _dirtyRects;
118  bool _fullRefresh;
119  bool _dualSurface;
120  bool _splitScreen;
121 
122  // Module data
123  Surface _backGroundSurface;
124  Surface _mergeSurface;
125 
126  uint32 _flags;
127 };
128 
129 } // End of namespace Saga
130 
131 #endif
Definition: saga.h:497
Definition: gfx.h:96
Definition: rect.h:144
Definition: render.h:51
Definition: actor.h:34
void clear()
Definition: list.h:206
Definition: system.h:161
void setSplitScreen(bool flag)
Definition: render.h:97