Created
January 3, 2018 14:41
-
-
Save Fuyutsubaki/a8eb4cf3cb5ddea9436bee4da8fe130a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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