Skip to content

Instantly share code, notes, and snippets.

@voidproc
Last active July 23, 2017 07:26
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 voidproc/4922180c5bde9ffbdc5ca01f61d13372 to your computer and use it in GitHub Desktop.
Save voidproc/4922180c5bde9ffbdc5ca01f61d13372 to your computer and use it in GitHub Desktop.
opensiv3d emoji-sparkle
#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