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 #ifndef TOLTECS_RENDER_H
23 #define TOLTECS_RENDER_H
24 
25 #include "graphics/surface.h"
26 
27 #include "toltecs/segmap.h"
28 #include "toltecs/screen.h"
29 #include "toltecs/microtiles.h"
30 
31 namespace Toltecs {
32 
33 enum RenderType {
34  kSprite,
35  kText,
36  kMask
37 };
38 
39 enum RenderFlags {
40  kNone = 1 << 0,
41  kRefresh = 1 << 1,
42  kRemoved = 1 << 2,
43  kMoved = 1 << 3,
44  kUnchanged = 1 << 4
45 };
46 
48  byte color;
49  uint fontResIndex;
50  byte *text;
51  int len;
52 };
53 
55  RenderType type;
56  uint flags;
57  Common::Rect rect;
58  int16 priority;
59  union {
60  SpriteDrawItem sprite;
61  RenderTextItem text;
62  SegmapMaskRect mask;
63  };
64 };
65 
66 class RenderQueue {
67 public:
69  ~RenderQueue();
70 
71  void addSprite(SpriteDrawItem &sprite);
72  void addText(int16 x, int16 y, byte color, uint fontResIndex, byte *text, int len);
73  void addMask(SegmapMaskRect &mask);
74  void update();
75  void clear();
76 
77 protected:
79 
80  ToltecsEngine *_vm;
81  RenderQueueArray *_currQueue, *_prevQueue;
82  MicroTileArray *_updateUta;
83 
84  bool rectIntersectsItem(const Common::Rect &rect);
85  RenderQueueItem *findItemInQueue(RenderQueueArray *queue, const RenderQueueItem &item);
86  bool hasItemChanged(const RenderQueueItem &item1, const RenderQueueItem &item2);
87  void invalidateItemsByRect(const Common::Rect &rect, const RenderQueueItem *item);
88 
89  void addDirtyRect(const Common::Rect &rect);
90  void restoreDirtyBackground();
91  void updateDirtyRects();
92 
93 };
94 
95 } // End of namespace Toltecs
96 
97 #endif /* TOLTECS_RENDER_H */
Definition: animation.h:28
Definition: list.h:44
Definition: rect.h:144
Definition: render.h:66
Definition: toltecs.h:94
Definition: screen.h:38
Definition: segmap.h:39
Definition: render.h:54
Definition: render.h:47
Definition: microtiles.h:37