-
-
Save anonymous/7e2fcd9e774f8d4d51f0 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> | |
void DrawCarpet(int left, int top, int size); | |
void Main() | |
{ | |
Graphics::SetBackground(Palette::Black); | |
int size = Window::Width(); | |
while (System::Update()) | |
{ | |
DrawCarpet(0, 0, size); | |
size *= 1.02; | |
if (size > Window::Width() * 3)size /= 3; | |
} | |
} | |
void DrawCarpet(int left, int top, int size){ | |
//再帰的に白い正方形を描いていくだけ | |
Rect(left + size / 3, top + size / 3,size / 3,size / 3).draw(Palette::White); | |
if (size < 3)return; | |
DrawCarpet(left, top, size / 3); | |
if (size / 3 < Window::Width()) | |
{ | |
DrawCarpet(left + size / 3, top, size / 3); | |
DrawCarpet(left, top + size / 3, size / 3); | |
if (size * 2 / 3 < Window::Width()) | |
{ | |
DrawCarpet(left + size * 2 / 3, top, size / 3); | |
DrawCarpet(left + size * 2 / 3, top + size / 3, size / 3); | |
DrawCarpet(left, top + size * 2 / 3, size / 3); | |
DrawCarpet(left + size / 3, top + size * 2 / 3, size / 3); | |
DrawCarpet(left + size * 2 / 3, top + size * 2 / 3, size / 3); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment