wavelength 1.0.0
Loading...
Searching...
No Matches
vortex.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
5#include "math/interpolator.h"
6#include "math/vector2.h"
7#include "rnd/rndloader.h"
8#include "rnd/rndview.h"
9#include "script/dataarray.h"
10
17class Vortex {
18public:
20 enum Mode {
23 kModeIn = 2,
26 };
27
35 explicit Vortex(const char *pszName);
36
44
52 float GetOutroLength() const;
53
61 float GetInLength() const;
62
70 float GetOutLength() const;
71
81 void Start(float fLength, int eMode);
82
89 void Poll();
90
97 void Draw();
98
105 void Load();
106
113 void Unload();
114
116 int GetMode() const {
117 return mMode;
118 }
119
121 float GetFrame() const {
122 return mFrame;
123 }
124
127 return mInterp;
128 }
129
130private:
131 DataArray *mConfig;
132 std::unique_ptr<RndLoader> mLoader;
133 RndView *mTopView;
134 RndView *mTransitionView;
135 RndView *mAmbientView;
136 RndView *mWiggle;
137 RndView *mWiggleXAnim;
138 RndView *mWiggleYAnim;
139 int mMode;
140 int mPrevMode;
141 LinearInterpolator mInterp;
142 float mFrame;
143 float mAmbientFrame;
144 float mStartMs;
145 Vector2 mOutroFrames;
146 Vector2 mInFrames;
147 Vector2 mOutFrames;
148 Vector2 mMotionRange;
149 Vector2 mStick;
150
152 static constexpr float kNotStarted = -1e9f;
153};
Reference-counted array of script data nodes.
Definition dataarray.h:20
Straight-line interpolator.
Definition interpolator.h:99
View that shows the children of another view, its children owner, under its own transform and frame.
Definition rndview.h:27
~Vortex()
Release the configuration.
float GetFrame() const
Definition vortex.h:121
float GetOutLength() const
Report the length of the run out of the play field.
void Load()
Queue the load of the file of the configuration and find its views.
Vortex(const char *pszName)
Construct an idle vortex from its configuration.
void Start(float fLength, int eMode)
Start a run.
void Poll()
Advance the run to the time of the system clock.
float GetInLength() const
Report the length of the run into the play field.
const LinearInterpolator & GetInterp() const
Definition vortex.h:126
void Draw()
Draw the vortex while a run is in progress.
int GetMode() const
Definition vortex.h:116
Mode
The values of mMode.
Definition vortex.h:20
@ kModeOutro
Definition vortex.h:22
@ kModeHold
Definition vortex.h:24
@ kModeIn
Definition vortex.h:23
@ kModeIdle
Definition vortex.h:21
@ kModeOut
Definition vortex.h:25
float GetOutroLength() const
Report the length of the run at the end of a song.
void Unload()
Stop the run, forget the views, and delete the loader with its objects.
Two-component vector, used for texture coordinates.
Definition vector2.h:12