ScummVM API documentation
renderobjectmanager.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 /*
23  * This code is based on Broken Sword 2.5 engine
24  *
25  * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
26  *
27  * Licensed under GNU GPL v2
28  *
29  */
30 
31 /*
32  BS_RenderObjectManager
33  ----------------------
34  Diese Klasse ist für die Verwaltung von BS_RenderObjects zuständig.
35 
36  Sie sorgt z.B. dafür, dass die BS_RenderObjects in der richtigen Reihenfolge gerendert werden.
37 
38  Autor: Malte Thiesen
39 */
40 
41 #ifndef SWORD25_RENDEROBJECTMANAGER_H
42 #define SWORD25_RENDEROBJECTMANAGER_H
43 
44 #include "common/rect.h"
45 #include "sword25/kernel/common.h"
46 #include "sword25/gfx/renderobjectptr.h"
47 #include "sword25/kernel/persistable.h"
48 
49 #include "sword25/gfx/microtiles.h"
50 
51 namespace Sword25 {
52 
53 class Kernel;
54 class RenderObject;
55 class TimedRenderObject;
56 class RenderObjectManager;
57 
59  RenderObject *_renderObject;
60  Common::Rect _bbox;
61  int _version;
62  RenderObjectQueueItem(RenderObject *renderObject, const Common::Rect &bbox, int version)
63  : _renderObject(renderObject), _bbox(bbox), _version(version) {}
64 };
65 
66 class RenderObjectQueue : public Common::List<RenderObjectQueueItem> {
67 public:
68  void add(RenderObject *renderObject);
69  bool exists(const RenderObjectQueueItem &renderObjectQueueItem);
70 };
71 
79 public:
86  RenderObjectManager(int width, int height, int framebufferCount);
87  ~RenderObjectManager() override;
88 
89  // Interface
90  // ---------
99  void startFrame();
104  bool render();
109  return _rootPtr;
110  }
119  void attatchTimedRenderObject(RenderObjectPtr<TimedRenderObject> pRenderObject);
123  void detatchTimedRenderObject(RenderObjectPtr<TimedRenderObject> pRenderObject);
124 
125  bool persist(OutputPersistenceBlock &writer) override;
126  bool unpersist(InputPersistenceBlock &reader) override;
127 
128 private:
129  bool _frameStarted;
131  RenderObjectList _timedRenderObjects;
132 
133  MicroTileArray *_uta;
134  RenderObjectQueue *_currQueue, *_prevQueue;
135 
136  // RenderObject-Tree Variablen
137  // ---------------------------
138  // Der Baum legt die hierachische Ordnung der BS_RenderObjects fest.
139  // Zu weiteren Informationen siehe: "renderobject.h"
140  RenderObjectPtr<RenderObject> _rootPtr; // Die Wurzel der Baumes
141 };
142 
143 } // End of namespace Sword25
144 
145 #endif
Definition: renderobjectmanager.h:58
Definition: array.h:52
Definition: renderobjectptr.h:46
Definition: list.h:44
Definition: rect.h:144
Diese Klasse ist für die Verwaltung von BS_RenderObjects zuständig.
Definition: renderobjectmanager.h:78
Definition: persistable.h:39
RenderObjectPtr< RenderObject > getTreeRoot()
Gibt einen Pointer auf die Wurzel des Objektbaumes zurück.
Definition: renderobjectmanager.h:108
Definition: microtiles.h:41
Definition: console.h:27
Definition: inputpersistenceblock.h:40
Dieses ist die Klasse die sämtliche sichtbaren Objekte beschreibt.
Definition: renderobject.h:72
Definition: outputpersistenceblock.h:39
Definition: renderobjectmanager.h:66