Skip to content

Instantly share code, notes, and snippets.

@Fuyutsubaki
Created January 3, 2018 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fuyutsubaki/a8eb4cf3cb5ddea9436bee4da8fe130a to your computer and use it in GitHub Desktop.
Save Fuyutsubaki/a8eb4cf3cb5ddea9436bee4da8fe130a to your computer and use it in GitHub Desktop.
# include <Siv3D.hpp> // OpenSiv3D v0.1.7
#include<memory>
#include <HamFramework.hpp>
struct Hoge{
Hoge(std::unique_ptr<Hoge> &&child)
:child(std::move(child))
{}
double rot = 1_pi / 32;
s3d::Point pos{ 0,20 };
std::unique_ptr<Hoge> child;
void draw() {
Transformer2D local{ s3d::Mat3x2::Rotate(rot).translated(pos) };
s3d::Circle{ 10 }.drawFrame();
if(child)
child->draw();
}
};
std::unique_ptr<Hoge> make_hoge(int n) {
return std::make_unique<Hoge>(n > 0 ? make_hoge(n - 1) : nullptr);
}
void Main()
{
auto hoge = make_hoge(62);
hoge->pos = s3d::Point{ 500,240 };
while (System::Update())
{
hoge->draw();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment