倍速
在本章中,您将会学习到:
- 倍速变化的绘制
倍速变化
倍速变化原型的实现与前面章节的 BPM 变化原型非常类似。
class Sprites {
public:
// ...
int timeScaleChangeLine = 7;
}Sprites;
auto skins = defineSkins<class Sprites>({
// ...
{ SkinSpriteName.GridYellow, Sprites.timeScaleChangeLine }
});
class TimeScaleChange: public Archetype {
public:
static constexpr const char* name = "#TIMESCALE_CHANGE";
vector<pair<string, int> > imports = {
{ "#BEAT", 0 },
{ "#TIMESCALE", 1 }
};
Variable<EntityDataId> beat(0, true);
Variable<EntityDataId> timeScale(1, true);
SonolusApi render() {
FUNCBEGIN
line(Sprites.timeScaleChangeLine, beat, 0.5);
print(timeScale, BeatToTime(beat), PrintFormat.TimeScale, -1, PrintColor.Yellow, true);
return VOID;
}
};
// ...
#ifdef preview
using namespace previewData;
#include"preview/Initialization.cpp"
#include"preview/Stage.cpp"
#include"preview/Note.cpp"
#include"preview/BpmChange.cpp"
+ #include"preview/TimeScaleChange.cpp"
#elif watch
// ...
// ...
#ifdef preview
buffer data, configuration;
build<
// Replace with your archetypes here
Initialization,
Stage,
Note,
BpmChange,
+ TimeScaleChange
>(configuration, data);
// ...