resonance 1.0.1
Loading...
Searching...
No Matches
creditsroll.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "os/hxstr.h"
6
8
9namespace Rnd {
10class Cam;
11class Mesh;
12class Text;
13} // namespace Rnd
14
33public:
44 CreditsRoll(const HxStr &picturePrefix,
45 const HxStr &textPrefix,
46 Rnd::Cam *pCam,
47 int nFirstIndex);
48
55 void Reset();
56
67 int Update();
68
75 void HideAll();
76
86 void Build();
87
88#ifdef ENABLE_PATCHES
102 float AddLeadingCredit(const HxStr &text, const unsigned char *pTexels, int nSize);
103#endif
104
105private:
106 // Where a credit lies against the visible band. The values are bits, and the classifiers
107 // combine them.
108 enum Band {
109 kBandAbove = 1,
110 kBandVisible = 2,
111 kBandBelow = 4,
112 kBandAbsent = 8,
113 };
114
115 // The four persona burn textures are used in turn.
116 static constexpr int kBurnSlotCount = 4;
117
129 int ClassifyPicture(Rnd::Mesh *pPicture);
138 int ClassifyText(Rnd::Text *pText);
145 int Classify(Rnd::Mesh *pPicture, Rnd::Text *pText);
154 Rnd::Mesh *GetPicture(int nIndex);
163 Rnd::Text *GetText(int nIndex);
170 void SetShowing(Rnd::Mesh *pPicture, Rnd::Text *pText, int nShowing);
177 static inline MetPersonaData *FindPersona(const HxStr &name,
178 const std::vector<MetPersonaData *> &identities);
179
180 HxStr picturePrefix_;
181 HxStr textPrefix_;
182 Rnd::Cam *cam_;
183 int firstVisible_; // The first credit Update() examines.
184 int firstIndex_;
185 std::vector<Rnd::Mesh *> pictures_;
186 std::vector<Rnd::Text *> texts_;
187 std::vector<HxStr> personaNames_; // Empty for a credit without a persona.
188 std::vector<bool> burned_; // Set once a credit's persona has been drawn.
189 std::vector<MetPersonaData *> *identities_;
190 int burnSlot_; // The burn texture the next persona is drawn into.
191};
void Build()
Find the credits in the render manager and assign the persona names.
void Reset()
Rewind to the first credit, forget which personas were drawn, and fetch the identity list.
CreditsRoll(const HxStr &picturePrefix, const HxStr &textPrefix, Rnd::Cam *pCam, int nFirstIndex)
Record the naming scheme and the camera, and reset the scroll.
int Update()
Show the credits in the visible band and hide the ones that have left it.
void HideAll()
Hide every picture and every text.
Heap-allocated NUL-terminated string.
Definition hxstr.h:41
Saved record of one player persona.
Definition metpersonadata.h:39
Camera.
Definition cam.h:53
Indexed triangle mesh with one material.
Definition mesh.h:46
Run of text drawn as a quad per glyph.
Definition text.h:57
The rendering engine.
Definition animhelper.h:3