resonance 1.0.1
Loading...
Searching...
No Matches
hudposition.h
Go to the documentation of this file.
1#pragma once
2
3#include <cmath>
4#include <vector>
5
6class PlayMap;
7
8namespace Rnd {
9class Font;
10class Mat;
11class Mesh;
12class MeshAnim;
13class Text;
14class View;
15} // namespace Rnd
16
32public:
40 HudPosition(PlayMap *pPlayMap);
41
52
60 void SetFrame(float flFrame) {
61 const int nBar = static_cast<int>(std::floor(flFrame / kTicksPerBar));
62 if (nBar != mBar) {
63 mBar = nBar;
64 Update();
65 }
66 }
67
79 void Update();
80
81private:
82 // One section of the level, with its block and its label.
83 struct Section {
84 Rnd::Mesh *mBlock;
85 Rnd::Text *mLabel;
86 // The first bar of the section and its length in bars.
87 int mStartBar;
88 int mBarCount;
89 // The frame of `HUD pos.msnm` the block was sized at. The repeat marker takes it too.
90 float mFrame;
91 };
92
93 // MIDI ticks in one bar.
94 static constexpr float kTicksPerBar = 1920.0f;
95
96 std::vector<Section> mSections;
97 PlayMap *mPlayMap;
98 Rnd::View *mView; // `<layout> pos.view`
99 Rnd::MeshAnim *mAnim; // `HUD pos.msnm`
100 Rnd::Mat *mCurrentMat; // `pos_current.mat`
101 Rnd::Mat *mNormalMat; // `pos_norm.mat`
102 Rnd::Mat *mPastMat; // `pos_past.mat`
103 Rnd::Font *mBlackFont; // `HUD pos_black.font`
104 Rnd::Font *mWhiteFont; // `HUD pos_white.font`
105 Rnd::View *mRepeatView; // `HUD pos_repeat.view`
106 // The width of all the blocks together.
107 float mWidth;
108 // The index of the current section, or -1.
109 int mCurrentSection;
110 // The bar Update() last styled for. Starts at -99999.
111 int mBar;
112 int mUnusedWord; // +0x3c Zeroed by the constructor and never read.
113};
HudPosition(PlayMap *pPlayMap)
Build one block and one label per section of a play map.
~HudPosition()
Delete every block and label and reset the container's origin.
void SetFrame(float flFrame)
Restyle the blocks for a new song position once the bar changes.
Definition hudposition.h:60
void Update()
Style every section block for the current bar.
Traversal order over one playable sequence.
Definition playmap.h:47
Glyph atlas, either a host font description or a grid of cells inside a material texture.
Definition font.h:59
Surface description a Rnd::Mesh draws with.
Definition mat.h:36
Per-vertex animation of one mesh.
Definition meshanim.h:45
Indexed triangle mesh with one material.
Definition mesh.h:46
Run of text drawn as a quad per glyph.
Definition text.h:57
Root of a loadable scene.
Definition view.h:47
The rendering engine.
Definition animhelper.h:3