resonance 1.0.1
Loading...
Searching...
No Matches
drawable.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4
5#include "rnd/object.h"
6
7namespace Rnd {
8class Dbg;
9class Stream;
10} // namespace Rnd
11
12namespace Rnd {
13
32class Drawable : public virtual Object {
33public:
41
48 virtual ~Drawable();
49
59 void Draw();
60
73
85 void AddDraw(Drawable *pDraw, Drawable *pBefore);
86
94 void AddDraw(Drawable *pDraw);
95
105 void RemoveDraw(Drawable *pDraw);
106
114
127 void MoveDraw(Drawable *pDraw, int nSteps);
128
138 virtual void SetShowing(int nShowing);
139
151 void SetShowingRecursive(int nShowing) {
152 SetShowing(nShowing);
153 for (std::list<Drawable *>::iterator it = mDraws.begin(); it != mDraws.end(); ++it) {
154 (*it)->SetShowingRecursive(nShowing);
155 }
156 }
157
167 virtual void SetHighlight(int nHighlight);
168
176 int GetHighlight() const {
177 return mHighlight;
178 }
179
189 int GetShowing() const {
190 return mShowing;
191 }
192
204 static Drawable *Find(const HxStr &name);
205
213 std::list<Drawable *> &GetDraws() {
214 return mDraws;
215 }
216
228 virtual void DumpText(Dbg &sink);
229
237 virtual void Save(Stream &stream);
238
250 virtual void Replace(Object *pFrom, Object *pTo);
251
262 virtual void Copy(const Object *pSource, unsigned nFlags);
263
273 virtual void Load(Stream &stream);
274
275 // Declared in recovered offset order. Protected because Rnd::Mesh derives from this class and
276 // Mesh::FindCollisions tests this flag at its top.
277 // Public because the drawable show commands read it with no accessor in the image.
278 int mShowing; // +0x04
279
280protected:
291 virtual int DrawShowing();
292
302
303private:
310 void AcquireDrawsRefs();
311
312 int mHighlight; // +0x08
313 std::list<Drawable *> mDraws; // +0x0c
314};
315
316} // namespace Rnd
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Sink that the engine formats its diagnostic and failure text into.
Definition dbg.h:33
void AddDraw(Drawable *pDraw)
Insert pDraw at the front of mDraws.
static Drawable * Find(const HxStr &name)
Resolve a registry key to a drawable.
void MoveDraw(Drawable *pDraw, int nSteps)
Move pDraw nSteps places later in mDraws, or earlier for a negative count.
virtual void Save(Stream &stream)
Write the revision, the showing flag as one byte, and the draw list.
virtual ~Drawable()
Drop this object's references on its children.
virtual void Copy(const Object *pSource, unsigned nFlags)
Take the showing flag, and with kCopyChildLists the draw list, from another drawable.
void AddDraw(Drawable *pDraw, Drawable *pBefore)
Insert pDraw into mDraws in front of pBefore.
void ReleaseDrawsRefs()
Drop this object's reference on every mDraws entry without emptying the list.
virtual void Replace(Object *pFrom, Object *pTo)
Point every mDraws entry that is pFrom at pTo instead, moving the reference, and drop the entries lef...
virtual int DrawShowing()
Draw this object alone.
std::list< Drawable * > & GetDraws()
Report the child list.
Definition drawable.h:213
virtual void SetShowing(int nShowing)
Set whether this object draws at all.
void RemoveAllDraws()
Empty mDraws, dropping this object's reference on every entry.
virtual void DumpText(Dbg &sink)
Write a description of this object to sink.
Drawable()
Construct a visible drawable with no children.
int GetShowing() const
Report the showing flag.
Definition drawable.h:189
void RemoveDraw(Drawable *pDraw)
Erase pDraw from mDraws.
Drawable * Parent()
Report the drawable that draws this one.
int mShowing
Definition drawable.h:278
virtual void SetHighlight(int nHighlight)
Set whether this object draws with its highlight treatment.
virtual void Load(Stream &stream)
Read what Save() writes, replacing the draw list and moving its references.
void SetShowingRecursive(int nShowing)
Set whether this object and every drawable beneath it in mDraws draw at all.
Definition drawable.h:151
int GetHighlight() const
Report the highlight flag.
Definition drawable.h:176
void Draw()
Draw this object followed by each of its children.
Object()
Construct an unnamed object.
Byte stream that every renderer object serialises itself through.
Definition stream.h:31
The rendering engine.
Definition animhelper.h:3