1
0
Files
BasaltMeter/BasaltPresenter/Plugins/AnimeLoader/ChickenNuggetAnimeLoader/main.cpp
2026-01-09 16:40:30 +08:00

40 lines
1.7 KiB
C++

#include <basalt/export_macro.hpp>
#include <basalt/anime_loader.hpp>
#include <basalt/math.hpp>
namespace anime_loader = ::basalt::shared::anime_loader;
using anime_loader::IAnimeLoader;
using anime_loader::KeyFrame;
using ::basalt::shared::math::FloatPoint;
#define F(x) (static_cast<FloatPoint>(x))
class ChickenNuggetAnimeLoader : public IAnimeLoader {
public:
ChickenNuggetAnimeLoader() {}
virtual ~ChickenNuggetAnimeLoader() {}
protected:
virtual void internal_load() override {
this->frames.emplace(60 * 0, KeyFrame{.position = {F(0), F(-10), F(10)}, .rotation = {F(0.382683), F(0), F(0), F(0.92388)}});
this->frames.emplace(60 * 1,
KeyFrame{.position = {F(-10), F(0), F(10)},
.rotation = {F(0.270598), F(-0.270598), F(-0.653282), F(0.653282)}});
this->frames.emplace(60 * 2, KeyFrame{.position = {F(0), F(10), F(10)}, .rotation = {F(0), F(-0.382683), F(-0.92388), F(0)}});
this->frames.emplace(60 * 3,
KeyFrame{.position = {F(10), F(0), F(10)},
.rotation = {F(-0.270598), F(-0.270598), F(-0.653282), F(-0.653282)}});
this->frames.emplace(60 * 4,
KeyFrame{.position = {F(0), F(-10), F(10)},
.rotation = {F(0.382683), F(0), F(0), F(0.92388)}}); // Same as the first
}
};
BS_EXPORT void* BSCreateInstance() {
return static_cast<IAnimeLoader*>(new ChickenNuggetAnimeLoader());
}
BS_EXPORT void BSDestroyInstance(void* instance) {
delete dynamic_cast<ChickenNuggetAnimeLoader*>(static_cast<IAnimeLoader*>(instance));
}