-
-
Save voidproc/4922180c5bde9ffbdc5ca01f61d13372 to your computer and use it in GitHub Desktop.
opensiv3d emoji-sparkle
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 Main() | |
{ | |
Graphics::SetBackground(Color(40, 50, 80)); | |
const Array<Texture> texture{ | |
Texture{ Emoji{ L"🌕" } }, | |
Texture{ Emoji{ L"⭐️" } }, | |
Texture{ Emoji{ L"🌟" } }, | |
Texture{ Emoji{ L"✨" } }, }; | |
Array<std::tuple<Point, int>> sparkle; | |
while (System::Update()) | |
{ | |
if (Window::ClientRect().leftClicked()) | |
{ | |
sparkle.push_back(std::make_tuple(Cursor::Pos(), 0)); | |
} | |
sparkle.each([&](auto& f) { | |
texture[std::get<1>(f)++ / 4].drawAt(std::get<0>(f)); | |
}); | |
Erase_if(sparkle, [](auto& f) { return std::get<1>(f) >= 16; }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment