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
6
class
PlayMap
;
7
8
namespace
Rnd
{
9
class
Font
;
10
class
Mat
;
11
class
Mesh
;
12
class
MeshAnim
;
13
class
Text
;
14
class
View
;
15
}
// namespace Rnd
16
31
class
HudPosition
{
32
public
:
40
HudPosition
(
PlayMap
*pPlayMap);
41
51
~HudPosition
();
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
81
private
:
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::HudPosition
HudPosition(PlayMap *pPlayMap)
Build one block and one label per section of a play map.
HudPosition::~HudPosition
~HudPosition()
Delete every block and label and reset the container's origin.
HudPosition::SetFrame
void SetFrame(float flFrame)
Restyle the blocks for a new song position once the bar changes.
Definition
hudposition.h:60
HudPosition::Update
void Update()
Style every section block for the current bar.
PlayMap
Traversal order over one playable sequence.
Definition
playmap.h:47
Rnd::Font
Glyph atlas, either a host font description or a grid of cells inside a material texture.
Definition
font.h:59
Rnd::Mat
Surface description a Rnd::Mesh draws with.
Definition
mat.h:36
Rnd::MeshAnim
Per-vertex animation of one mesh.
Definition
meshanim.h:45
Rnd::Mesh
Indexed triangle mesh with one material.
Definition
mesh.h:46
Rnd::Text
Run of text drawn as a quad per glyph.
Definition
text.h:57
Rnd::View
Root of a loadable scene.
Definition
view.h:47
Rnd
The rendering engine.
Definition
animhelper.h:3
src
app
hudposition.h
Generated by
1.15.0