Skip to content

Instantly share code, notes, and snippets.

@Reputeless
Created October 28, 2014 12:04
Show Gist options
  • Save Reputeless/dc5bbdd1dd2137634894 to your computer and use it in GitHub Desktop.
Save Reputeless/dc5bbdd1dd2137634894 to your computer and use it in GitHub Desktop.
# include <Siv3D.hpp>
void Main()
{
const Font font(20);
while (System::Update())
{
const String string = L"The quick brown fox jumps over the lazy dog\nあいう え お か き くけこ";
std::vector<Vec2> offsets;
auto kineticFunction = [&](KineticTypography& k)
{
offsets.push_back(k.pos); // 座標を記録
k.pos.y = -1000; // 記録したら画面外に飛ばす
};
font.drawKinetic(string, Vec2::Zero, kineticFunction);
size_t index = 0;
for (auto ch : string)
{
if (Char(ch).isSpace)
{
continue;
}
const TextureRegion textureRegion = font.getTexture(ch);
if (textureRegion.size.x == 0)
{
continue;
}
if (index >= offsets.size())
{
break;
}
textureRegion
.rotate(Mouse::Pos().x/100.0)
.draw(offsets[index]);
++index;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment